OpenGL ES reloading textures
Hi there!
I'm working with OpenGL ES and my system does not have enough VRAM so what I am doing is keeping the textures in RAM and unloading/reloading as necessary.
The problem is that it does not work. When I unload, reloading gives me a blank texture. It renders the quads white.
I added glGetError after all opengl calls of the process and did not find any errors. And I'm getting desperate.
Here's a streamlined version of what I'm doing. I kept only the opengl calls, from deleting the textures to loading them again. Before deleting they work fine. After, blank square:
// deleting
glDeleteTextures(m_uiTextures, (GLuint*)m_pTexture);
sdelete [] m_pTexture;
m_pTexture = 0;
// reloading
m_pTexture = (void**)snew GLuint[m_uiTextures];
glGenTextures(m_uiTextures, (GLuint*)m_pTexture);
glBindTexture(GL_TEXTURE_2D,m_pTexture[0]);
glTexImage2D(GL_TEXTURE_2D, whole_bunch_of_parameters);
I then set the filter mode and the wrap mode.
Can you see something wrong? Any help would be appreciated.
Cheers,
Cesar
I'm not a GL ES expert but you probably have this problem
http://www.opengl.org/wiki/Common_Mistakes#Creating_a_Texture
Because getting a white quad means that your texture is invalid.
Are you setting the filter modes to GL_LINEAR or GL_NEAREST?
http://www.opengl.org/wiki/Common_Mistakes#Creating_a_Texture
Because getting a white quad means that your texture is invalid.
Are you setting the filter modes to GL_LINEAR or GL_NEAREST?
I looked at that page, went through my algorithms and everything seemed fine. I then noticed because I was saving the texture state locally, my system thought the texture was already with the correct filter mode. I reset the filter mode at unload, just to force the update on load, and it worked.
Thanks for the help!
Thanks for the help!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement