common lighting/texture problems

Started by
2 comments, last by gcmonk 18 years, 8 months ago
I just got an MD2 model loaded and the texture is incorrect.

I've looked through the code and yet can't find the error yet. Lighting seems off too. There should be text on the upper left colored white. I use display lists for the text. So, since I'm new and still learning OpenGL, I'de like to know, what are the most common pitfalls when first learning OpenGL lighting and texturing? The list might help me find the errors in my code. Sorry if this has been asked before.

:: site :: project ::
Advertisement
One common problem in texturing that bites me in the ass occasionally is inverted textures. Some image formats store bitmaps 'upside down' relative to what you might think it should be, causing texturing to be wrong unless you flip it before uploading it to texture memory. Can't say if that is your problem, but it is something to watch out for.
Quote:Original post by gcmonk
I just got an MD2 model loaded and the texture is incorrect.





I've looked through the code and yet can't find the error yet. Lighting seems off too. There should be text on the upper left colored white. I use display lists for the text. So, since I'm new and still learning OpenGL, I'de like to know, what are the most common pitfalls when first learning OpenGL lighting and texturing? The list might help me find the errors in my code. Sorry if this has been asked before.



IIRC MD2 you have to divide by the skinwidth, are you doing that?

In the MD2 there should be something like GL_commands, if you parse them than you can use them to send stuff to OpenGL without much fiddling. Ok, for historical purposes, Quake I used Alias models and was for software rendering, and than later GLQuake came out. Now Quake I you had to check for when a triangle was backfacing and onseam and you had to push the ST to the other half of the skin (pain in the neck) but in OpenGL models are rendered with verts not edges, so they would convert the Alias into Tristrips/Trifans... well anyways, that carried over into Quake 2 ( and they nicely made that now available in the MD2 for you).. and Quake 2 skins were much nicer than Quake 1 skin textures and you didn't have to check for the onseam condition, and also the GL stuff is already done for you in the command buffer.

Anyways enough of a history lesson, Google for MD2 and you should find a tutorial on how to get the GL_commands out of the model. It is much easier to use them if you can.
"It's such a useful tool for living in the city!"
Quote:
One common problem in texturing that bites me in the ass occasionally is inverted textures. Some image formats store bitmaps 'upside down' relative to what you might think it should be, causing texturing to be wrong unless you flip it before uploading it to texture memory.


Wow. Hit that one on the nail. I lazily didn't want to write a pcx loader so I just converted the textures to bmp. I've been blitting bitmaps with the DrawPixels command though with no inverting problems, but when I inverted the texture for the models, they became textured correctly. Thanks for the help!
:: site :: project ::

This topic is closed to new replies.

Advertisement