I followed tutorial 13 to draw staff to a texture. I found that if the texture is a NPOT one (a quarter of the screen resolution for example) , I just got a totally black screen.
According to Kronos (http://www.khronos.org/opengles/sdk/doc ... ameter.xml) this makes sense.
In short this means you need the following lines to use NPOT texture as a rendering target. Without these lines you are going to get a black screen.Suppose that a texture is accessed from a fragment shader or vertex shader and has set GL_TEXTURE_MIN_FILTER to one of the functions that requires mipmaps. If either the dimensions of the texture images currently defined (with previous calls to glTexImage2D, glCompressedTexImage2D, or glCopyTexImage2D) do not follow the proper sequence for mipmaps (described above), or there are fewer texture images defined than are needed, or the set of texture images were defined with different formats or types, then the texture image unit will return (R, G, B, A) = (0, 0, 0, 1).
Similarly, if the width or height of a texture image are not powers of two and either the GL_TEXTURE_MIN_FILTER is set to one of the functions that requires mipmaps or the GL_TEXTURE_WRAP_S or GL_TEXTURE_WRAP_T is not set to GL_CLAMP_TO_EDGE, then the texture image unit will return (R, G, B, A) = (0, 0, 0, 1).
Code: Select all
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);