Textures aren't loaded
Hello list,
I''m still working on the problem that textures aren''t loaded sometimes, why ever. I''ve noticed something strange:
I kill a texture with glDeleteTextures() that was loaded properly. Now I call glGenTextures() to create a new texture (and I receive the same GLuint as the texture that I''ve deleted before). If I specify a new texturemap with glTexImage2D() now, the texture image isn''t replaced?! Any ideas?
Nils
_____________________________________
Visit http://www.nilsschneider.de for finest trance music, studio, bio, guestbook and more!
_____________________________________http://www.winmaze.de, a 3D shoot em up in OpenGL, nice graphics, multiplayer, chat rooms, a nice community, worth visiting! ;)http://www.spheretris.tk, an upcoming Tetrisphere clone for windows, a 3D tetris game on a sphere with powerful graphics for Geforce FX and similar graphics cards.
Ufff...
Source code?
PM
Times change.
Excuse my poor english!
Source code?
PM
Times change.
Excuse my poor english!
PM Times change...
Excuse my poor english!
make sure your texture sizes are in powers of two (that is, if you''re not building mip-maps)
quote:
(that is, if you''re not building mip-maps)
Mipmaps also have to be a power of two.
quote:
Original post by Brother Bob
Mipmaps also have to be a power of two.
That''s right, but if u use gluBuild2DMipmaps, it will scale your image to the next higher power of two...
PM
Times change.
Excuse my poor english!
PM Times change...
Excuse my poor english!
Lyve, the behavior is correct, if you glDeleteTexture() a texture, then that texture ID is free to be used again, and will be for your next texture.
My theory is you are not clearing your variables.
If that doesn''t work, post source, because this is a complicated problem, one I''ve never delt with...
My theory is you are not clearing your variables.
If that doesn''t work, post source, because this is a complicated problem, one I''ve never delt with...
~~~~~Screaming Statue Software. | OpenGL FontLibWhy does Data talk to the computer? Surely he's Wi-Fi enabled... - phaseburn
Ok, here is the source code. I've checked power of two, and I've also checked rebinding, everything is ok. Any wrong things in this code?
Lyve
------------------------
_____________________________________
Visit < href="http://www.nilsschneider.de">http://www.nilsschneider.de for finest trance music, studio, bio, guestbook and more!
[edited by - Lyve on March 6, 2003 11:15:18 AM]
[edited by - Lyve on March 6, 2003 11:16:40 AM]
Lyve
------------------------
CTexture::CTexture(){ // ....load texture..... ASSERT( m_nWidth ); ASSERT( m_nHeight ); ASSERT( !(m_nWidth & (m_nWidth-1)) ); ASSERT( !(m_nHeight & (m_nHeight-1)) ); ASSERT( m_pRgbaData ); GLVERIFY( glGenTextures( 1, &m_textureIdx ) ); GLVERIFY( glBindTexture( GL_TEXTURE_2D, m_textureIdx) ); GLVERIFY( glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR) ); GLVERIFY( glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST) ); GLVERIFY( glTexImage2D(GL_TEXTURE_2D, 0, 4, m_nWidth, m_nHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_pRgbaData) ); GLVERIFY( gluBuild2DMipmaps(GL_TEXTURE_2D, 4, m_nWidth, m_nHeight, GL_RGBA, GL_UNSIGNED_BYTE, m_pRgbaData) );}CTexture::~CTexture(){ GLVERIFY( glDeleteTextures( 1, &m_textureIdx ) ); delete[] m_pRgbaData;}
_____________________________________
Visit < href="http://www.nilsschneider.de">http://www.nilsschneider.de for finest trance music, studio, bio, guestbook and more!
[edited by - Lyve on March 6, 2003 11:15:18 AM]
[edited by - Lyve on March 6, 2003 11:16:40 AM]
_____________________________________http://www.winmaze.de, a 3D shoot em up in OpenGL, nice graphics, multiplayer, chat rooms, a nice community, worth visiting! ;)http://www.spheretris.tk, an upcoming Tetrisphere clone for windows, a 3D tetris game on a sphere with powerful graphics for Geforce FX and similar graphics cards.
1. Why your are calling gluBuild2DMipmaps after glTexture2D???
2. Are u sure m_pRgbaData was reloaded? (
)
PM
I hope GeForce FX is a joke
.
Excuse my poor english!
2. Are u sure m_pRgbaData was reloaded? (

PM
I hope GeForce FX is a joke

Excuse my poor english!
PM Times change...
Excuse my poor english!
Hm, you''re right. I''ve removed the other call. And yes, the texture data is destroyed, look into the destructor 
Lyve

Lyve
_____________________________________http://www.winmaze.de, a 3D shoot em up in OpenGL, nice graphics, multiplayer, chat rooms, a nice community, worth visiting! ;)http://www.spheretris.tk, an upcoming Tetrisphere clone for windows, a 3D tetris game on a sphere with powerful graphics for Geforce FX and similar graphics cards.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement