Jump to content
  • Advertisement
Sign in to follow this  
gcmonk

OpenGL common lighting/texture problems

This topic is 4768 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

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!