View Full Version : Stretching to cover the viewport in Opengl ES 2.0 with glTexSubImage2D

03-03-2014, 03:25 AM
-I have a texture quad which is smaller than the device screen.

-The viewport is set to actually match the device screen, though as said, the texture size is smaller.

-I'm rendering the texture quad with glTexImage2D.

At this point the expected behaviour is the correct one, which is when rendering even though the texture is smaller than the viewport, the final render stretches to cover the full viewport.

The problem is when I use the glTexSubImage2D. The data being pushed into the GPU is still the same as it was with glTexImage2D, which is smaller than the Viewport. But differently of what glTexImage2D did, now the render does not cover the full viewport, only the real texture size leaving most of the screen empty.

How can I render with glTexSubImage2D, and make it to stretch the full viewport?


03-03-2014, 03:38 AM
glTexImage2D and glTexSubImage2D do not render anything. Read the documentation for these methods, they are used to transport texel data from client side memory to the graphics card.
Rendering is done with glDrawArrays, glDrawElements or glBegin / glEnd or similar methods.