// create new texture
glGenTextures(0, &m_TexId);
// bind the texture
glBindTexture(GL_TEXTURE_2D, m_TexId);
// set texture stuff
glTexParameteri(
GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR );
glTexParameteri(
GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,
GL_LINEAR_MIPMAP_NEAREST );
gluBuild2DMipmaps(
GL_TEXTURE_2D, m_Bpp, m_Width, m_Height, m_Type,
GL_UNSIGNED_BYTE, m_pImageData );
Texture binding and toggling screen mode
Hi.
Apparently I'm relatively new to OpenGL programming.
Right now I have to use the code below each frame.
When I toggle between fullscreen/windowed mode and use the code below only once ...
( and glBindTexture(GL_TEXTURE_2D, m_TexId); each frame )
... the texture disappears.
I guess there is something seriously wrong with the design I chose? How is this usually done?
Or does a program generally have to go through all the textures whenever the window has been killed and recreated?
Writing errors since 10/25/2003 2:25:56 AM
Unless it's just a typo, the line 'glGenTextures(0, &m_TexId);' should be 'glGenTextures(1, &m_TexId);'. If it is just a typo then you should check that your pixel data 'm_pImageData' is valid before the call to it.
In answer to your question, yes you do have to re-create your textures when you toggle from windowed to fullscreen. The reason is a little out of my knowledge but I suspect it has to do with the rendering context for OpenGL changing, therefore meaning you have to re-create your textures.
Hope this helped.
In answer to your question, yes you do have to re-create your textures when you toggle from windowed to fullscreen. The reason is a little out of my knowledge but I suspect it has to do with the rendering context for OpenGL changing, therefore meaning you have to re-create your textures.
Hope this helped.
--
Cheers,
Darren Clark
Cheers,
Darren Clark
I'm sure he may have this question too but what about resolution switching seems to me with the way the window is setup, to switch the resolution you'd hve to destroy the context and recreate it.
Yes, that's correct. To change resolution (NOT dimensions) you must destroy and re-create the window.
--
Cheers,
Darren Clark
Cheers,
Darren Clark
Ehm, why is that?
I usually set up a window of X x Y pixels and then change the resolution through the win32 api. I don not have to create a new window for that... I do have to resize it and pass that new size to opengl though. I have never run into this problem.
Look up
ChangeDisplaySettings(...)
on MSDN and see if you have use for it.
I usually set up a window of X x Y pixels and then change the resolution through the win32 api. I don not have to create a new window for that... I do have to resize it and pass that new size to opengl though. I have never run into this problem.
Look up
ChangeDisplaySettings(...)
on MSDN and see if you have use for it.
Thank you very much for the replies.
It was not a typo btw. I did create 0 texture names.
I think ChangeDisplaySettings is used in the newer version of the basecode.
I'll just kill/recreate the window and tell the resource manager to recreate the textures.
Later I'll take a closer look at the Win32 specific rendering stuff.
Thanks again.
It was not a typo btw. I did create 0 texture names.
I think ChangeDisplaySettings is used in the newer version of the basecode.
I'll just kill/recreate the window and tell the resource manager to recreate the textures.
Later I'll take a closer look at the Win32 specific rendering stuff.
Thanks again.
Writing errors since 10/25/2003 2:25:56 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement