Hi. Is there something unique to SDL that I should be aware of when trying to write to an offscreen FBO & texture when using OpenGL with SDL2?
I posted the below question to Stackoverflow here but I have narrowed down my problem to the size of the texture I create with glTexImage2D(). Originaly I was trying to create a texture 512x512 pixels to draw into and then use glReadPixels() to get the RGB values back. Same code works fine in a non-SDL framework application but I always get black (zero RGB) when running under SDL framework unless I use a texture of 1024x1024 or larger.
I’m aware of the “power of 2 rule” for texture dimensions but I wasn’t aware of a minimum size for texture dimensions.
Is this an SDL feature specific to FBO drawing or is there perhaps an SDL configuration parameter that I’m not aware of?
When I switch to using the FBO, I should be configuring the ortho projection for the FBO as well - and to use the texture width and height instead of the screen width and height.
Awesome! Thanks for pointing me in the right direction. Funny, I tried changing the g_ScreenHeight inside the glReadPixels() code and that wasn’t working either - because the whole projection must have been a mess.