Im trying to render to a texture (shadowmap) but if I try to generate the framebuffer I always get GL_UNSUPORTED_FRAMEBUFFER_EXT.
I have a Nvidia GPU (GTX950 oc).
Texture generation :
void GenEmtyTexture(int sizeX, int sizeY, GLuint * ID, GLubyte * imagePtr, int unbind, int colorMode0, int colorMode1, GLuint dataType, GLint activeTexture, char mipmap)
{
//imagePtr should have enougth/be NULL memory...
printf("Generating texture...
");
glGenTextures(1, ID);
glActiveTexture(activeTexture);
glBindTexture(GL_TEXTURE_2D, *ID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if(mipmap)
{
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
}
glTexImage2D(GL_TEXTURE_2D, 0, colorMode0, sizeX, sizeY, 1, colorMode1, dataType, imagePtr);
printf("ERROR : %s
", gluErrorString( glGetError() ) );
if(unbind)
{
glBindTexture(GL_TEXTURE_2D, 0);
}
}
I use it like this :
GenEmtyTexture(2048, 2048, &textureIDs[0], NULL, 0, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, GL_TEXTURE0, 1);
This is how I generate the FBO :
glGenFramebuffers(1, &frameBufferIDs[0]);
glBindFramebuffer(GL_FRAMEBUFFER, frameBufferIDs[0]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureIDs[0], 0);
printf("FRAMEBUFFERSTATUS : %x
", glCheckFramebufferStatus(GL_FRAMEBUFFER));
printf always prints : FRAMEBUFFERSTATUS : 8cdd
-->
#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
I read that this is Nvidia specific :
Warning: NVIDIA's OpenGL driver has a known issue with using incomplete textures. If the texture is not texture complete, the FBO itself will be considered GL_FRAMEBUFFER_UNSUPPORTED, or will have GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT. This is a driver bug, as the OpenGL specification does not allow implementations to return either of these values simply because a texture is not yet complete. Until this is resolved in NVIDIA's drivers, it is advised to make sure that all textures have mipmap levels, and that all glTexParameteri values are properly set up for the format of the texture. For example, integral textures are not complete if the mag and min filters have any LINEAR fields.
I dont know how to fix that.