Imagination PowerVR SDK Blog

glGenerateMipmap fails silently...


#1

Hello folks,





I’m currently working with the PowerVR OpenglES 2.0 Emulator for Windows.


I’m running on a ATI Radeon X1550 graphics card.





I tried using glGenerateMipmap for automatically generating mipmaps.


However, all textures show up as black after I enable Mipmapping…





my code is as follows:





   glGenTextures (1, aTexture.m_Name);


   glBindTexture (GL_TEXTURE_2D, aTexture.m_Name);





   glTexImage2D   (GL_TEXTURE_2D,      // target


                   0,                  // level


                   aTexture.m_Format,    // internalFormat


                   aTexture.m_Width,     // width


                   aTexture.m_Height,    // height


                   0,                  // border


                   aTexture.m_Format,    // format


                   aTexture.m_TexelType, // type


                   aTexture.m_Data );    // data pointer





   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);


   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);


   glEnable(GL_TEXTURE_2D);


   glGenerateMipmap(GL_TEXTURE_2D);








It works okay without “glGenerateMipmap(GL_TEXTURE_2D);”, however, as soon as I put that line in and enable Mipmapping, all my textures show up as black.


No OpenGL error is returned…


It looks like glGenerateMipmap simply doesn’t work and leaves me with an incomplete texture pyramid.





I suppose it’s a bug in either the ATI drivers or the IMGtech emulator…


Do you guys have any ideas on how I could work around this problem?





Regards,


Robert



#2

Could you please provide some additional information:


What version of the SDK are you using?


What are the values you are passing to glTexImage2D?





glEnable(GL_TEXTURE_2D) is not used in OpenGL ES 2.0, texture enable state is determined by the shader program.


#3

Hello,





I’m currently using build 2.06.26.0649





The whole application is a terrain rendering engine.





Width and height are both 128 or both 256 - depending on the size of the terrain patches.





Format and Internalformat are GL_RGBA





Type is GL_UNSIGNED_BYTE





I added the “glEnable(GL_TEXTURE_2D)” because it is a workaround for a known driver bug on ATI cards. However, I also tested it on a PC with an NVidia graphics card, it didn’t work there, too.





Is there any sample code available that makes use of glGenerateMipmap(GL_TEXTURE_2D) ?





I found that GL_LINEAR and GL_NEAREST still work after glGenerateMipmap, so my guess is that


glGenerateMipmap just doesn’t do anything.