Sign in to follow this  

textures turn to white

This topic is 3773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everybody, I'm having trouble with textures, and i think it's pretty weird... The thing is that i have a big square with a texture mapped on it, and it works fine, but after 3-4 minutes, the texture disappears and all i can see is the same big square but completely white...without me doing nothing else than looking at the screen. The funy part is that another texture that i have in the application also disappears when the first does, turning also to white... If anybody could help me with this would be great Thanks in advance

Share this post


Link to post
Share on other sites
Check to see if your code is somehow binding texture #0, because it is reserved and filled white. Also, make sure you're not binding a texture that hasn't been described yet.

Share this post


Link to post
Share on other sites
I've checked if any texture binds #0 and the answer is no [sad].

Both textures are described before binding, because when i start the app i see both objects mapped, each with its texture.

Thanks for your answer anyway



PS:I put the code i use to bind the textures to see if it helps...


glEnable(GL_TEXTURE_2D);
glGenTextures(1, &g_texture);
glBindTexture(GL_TEXTURE_2D, g_texture);
glTexImage2D(GL_TEXTURE_2D, 0, 3, rawWidth,
rawHeight, 0, GL_RGB, GL_UNSIGNED_BYTE,
data);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

Share this post


Link to post
Share on other sites
Are you calling any other functions during that 3-4 minutes? make sure you aren't disabling GL_TEXTURE_2D anywhere...

it may be a problem in this line:

glGenTextures(1, &g_texture);

if you are using this exact code to generate all your textures, it may be overwriting the previously generated texture. generate all your textures at the same time and if you are generating 2 or 3 than change that 1 to a 2 or 3.

hope this helps

Share this post


Link to post
Share on other sites
>>PS:I put the code i use to bind the textures to see if it helps..

you should only do that when u create the texture not every frame
(youve run out of mnemory that way, + i think thats whats happening)

just stick in
glBindTexture(GL_TEXTURE_2D, g_texture);
to rebind the texture

u should see a major speed boost as well

Share this post


Link to post
Share on other sites
Quote:
Original post by zedz
>>PS:I put the code i use to bind the textures to see if it helps..

you should only do that when u create the texture not every frame
(youve run out of mnemory that way, + i think thats whats happening)

just stick in
glBindTexture(GL_TEXTURE_2D, g_texture);
to rebind the texture

u should see a major speed boost as well


Ok that was it !, thank you very much... i should have seen it myself ! [embarrass]

Thank you very much to all of you for your help !

Share this post


Link to post
Share on other sites

This topic is 3773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this