Strange problem

Started by
1 comment, last by BradDaBug 21 years, 10 months ago
I''m using OpenGL and SDL in Linux. I have a text file that lists the images that need to be loaded and used as textures. They''re a mixture of bitmaps and .tga''s. Some of the textures show up as just white boxes! But I know they''re being loaded correctly! But the wierd thing is I can change around the images that are being loaded, and other textures suddenly work and others suddenly stop working! But its not the ones I change! I may change something down at the bottom of the list, and it makes a texture at the top of the list either show up or not show up! If I put some gibberish where an image should be, it gives me the proper "cannont find image" thing and doesn''t put anything where the texture should be (no white box). What is goin on here?!
I like the DARK layout!
Advertisement
your code is broken
Sounds like an issue I had recently regarding resources being lost. If you do anything which invalidates your opengl rendering context with SDL (for me, it was resizing) then you will need to generate new texture objects, and then reload your textures into it. You will have to re-initialize your sdl display with opengl before this.

Also, if you are reloading your resources... and have some class which gens textures on construction and deletes them on destruction, make sure those destructors are being called *before* your context is invalidated, otherwise while generating new ones, you may also be deleting those from the last context (which really aren''t valid) and confusing opengl.

Once you have a new display initialized, reload your textures.

As an example of confusing opengl:
You might generate "1" from your first reloaded texture.
While destroying your second old texture, you may delete "1", and then generate another texture "1".

This can cause your objects to use the wrong textures, or use an invalid texture (blank white).


"Don''t be afraid to dream, for out of such fragile things come miracles."

This topic is closed to new replies.

Advertisement