iphone - 32 pixel gap at top of opengl es texture -


I'm trying to render in a texture using the first OpenGL ES (for Iphone) and its After displaying the texture. Screen. Everything works except that there is 32 row difference at the top of the texture and the 32 rows below are cut. It is offset 32 ​​pixels like all of my pictures, which are not being drawn down as 32 rows because they are out of texture.

Here's a very simple example:

  zero rendering (int textured) {unsigned char buffer [4 * 320 * 480]; Unsigned four colors [4]; Color [0] = 255; Color [1] = 0; Color [2] = 0; Color [3] = 128; For (int i = 0; i & lt; 4 * 320 * 480; i + = 4) {buffer [i] = color [0]; Buffer [i + 1] = color [1]; Buffer [i + 2] = color [2]; Buffer [i + 3] = color [3]; } GlBindTexture (GL_TEXTURE_2D, textured); GlTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 320, 480, GL_RGBA, GL_UnSIGNED_BYTE, buffer); }  

And its result is:

Using glColor4f () instead of calling RenderToTexture () results in just one red screen

Any help from that 32 will be greatly appreciated, thanks. The pixels are missing 512: 512 - 480 = 32. The reason for this is that you can only use the shape of texture which has the powers of GL_ITOCHAR_DD with two, then you have to increase your width and height to 512. You can display only part of the desired texture by using texture coordinates or by setting texture matrix.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -