我想拍摄一张.png图像,并将其用作我的GLView的背景。我听说glDrawTex*是最好的方法,但我在互联网上搜索过,没有找到一个如何使用它的例子(至少没有一个对我有效)。有什么帮助吗?
发布于 2011-04-29 00:14:59
虽然OES_draw_texture extension是一种足够好的绘制背景的方法,因为它有时可能比使用几何体快一点,但我建议不要过度使用它,因为iPhones不会在ES 2下实现它,而且你不想把自己困在角落里。
这就是说,类似于:
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);应该是正确的。
https://stackoverflow.com/questions/5811035
复制相似问题