首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使用glDrawTex*

如何使用glDrawTex*
EN

Stack Overflow用户
提问于 2011-04-28 05:49:56
回答 1查看 1.6K关注 0票数 2

我想拍摄一张.png图像,并将其用作我的GLView的背景。我听说glDrawTex*是最好的方法,但我在互联网上搜索过,没有找到一个如何使用它的例子(至少没有一个对我有效)。有什么帮助吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-04-29 00:14:59

虽然OES_draw_texture extension是一种足够好的绘制背景的方法,因为它有时可能比使用几何体快一点,但我建议不要过度使用它,因为iPhones不会在ES 2下实现它,而且你不想把自己困在角落里。

这就是说,类似于:

代码语言:javascript
复制
int sourceRect[4] = {0, 24, 8, 16};  // we'll use the rectangle from (0, 24) of
                                     // size (8, 16) in the texture or textures
                                     // that are currently active as the
                                     // source graphic...

// ... by saying as much to OpenGL
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, sourceRect);


// we'll then draw that at (x, y), with nominal depth z, so as
// to cover the screen area (width, height)
glDrawTexiOES(x, y, z, width, height);

应该是正确的。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5811035

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档