🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Texture-Mapping not working

Started by
2 comments, last by dinotrack 23 years, 11 months ago
I am trying to just display a texture on a simple quad. I am using 24bit TGA loading code from my heightmap renderer, which works fine, so I don''t think that could be my problem. I looked at NeHe''s tutorials, and I initialized my textures the same as far as I can tell. I did glEnable(GL_TEXTURE_2D). I bind the texture and I assigned the texture coords to vertices and everything. But all it does is display an untextured quad. What could be the problem? I''ve tested it on different machines, with a variety of 3d cards, and some without any cards. Thanks, Jonathan
Advertisement
Well, from what you''ve told me I can''t say exactly, but here''s a couple of suggestions you can take to find out what''s going wrong:

* If you''re sure your TGA loader is fine, ignore this first one, but if not, try dumping the raw image info to a file to check it.

* Check for an error after calling glTexImage2d (or gluBuild2dMipmaps - if you''re using that), because if you specify a bad value for components or format then it won''t work.

* Check you''ve got the right amount (this sounds silly) of corresponding glTexCooord calls to glVertex...

* Check you''ve actually bound the texture!

If the cube looks grey, then it''s probably glTexImage.

Post your code so I know what''s happening...

========
Smidge
smidge@smidge-tech.co.uk
--Mr Smidge
I decided to try using the code from NeHe''s tutorial to load a BMP. I made sure everything I had was the same, it was. Yet it still didnt work!

The only difference I can think of is that I am using GLUT.

Could this make a difference? Is there something different you have to do in GLUT for texturing?
Okay, I ended up solving my own problem!

After re-doing my TGA loading and rendering code about 5 times each, I finally got it working!

I am not still not entirely certain, but I believe it was not displaying a texture because I was missing this:

glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);

If so, then I wasted an entire day re-writing code for nothing!

Well, I guess it was quite a learning experience if nothing else.


Now I have a texture-mapped 3d landscape!

This topic is closed to new replies.

Advertisement