Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

discman1028

MS3D OpenGL Texturing Question

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

Hey, like many others on this forum, I am having trouble getting the model to show a texture. Only showing plain white. I know about the ASCII export -> edit -> import fix, but that is not working for me, and I have tried many things, to no avail. I had tried to make changes to make the "main" cpp easier to edit... putting some of the model/texture loading code into different classes to start... the model loads, but the texture won''t. I''ve been trying not to ask for help; but I''ve spent very long and I need some. :-/ Oh, and there is also glut code used. The project is here: http://www.angelfire.com/retro/here/glut1.zip Thanks all! --== discman1028 ==--

Share this post


Link to post
Share on other sites
Advertisement
Yep this was a shocker for me too

I even went unto the brett porter site as there is a lesson31_new there but it never worked either.

Ive sent you a few files that might help its not for animated ms3d but they work its by the guy that did thrust on the nehe website downloads under T his site seems to hav vanished but he was sound about using his code just give him the credit


later

Share this post


Link to post
Share on other sites
Thanks, that is much simplified!

Still if anyone could figure out the problem with the original, I''d be very glad to know... it''s been eating at me for a while now.

Share this post


Link to post
Share on other sites
Hi.

Had a quick look at the code and while I haven''t had a chance to test anything I get the feeling that it wasn''t working because you tried to load the textures in practically first thing, before calling a glEnable( GL_TEXTURE_2D ) or setting up opengl''s pixel format.

The model itself is successfully loaded because you''re just storing it as a set of values in normal, everyday memory, and then calling lots of glVertex3fv''s when it comes time to draw it. When you''re loading in the textures though, you have to have access to the video card so it can go into the special texture memory there. At least I think that''s what''s happening, I''ll probably be proven wrong.

Try putting truck.loadModel() at the end of init() and see if there is any improvement.

Best of Luck

John

Share this post


Link to post
Share on other sites
John.... where have you been all my life?!?

I swore I had tried everything, but I guess not, thanks!

Now the texture shows, but it looks like the back textures are showing in front... But I haven''t even tried searching for this problem yet, which I''ll do now.


Big thanks to you John!!

Share this post


Link to post
Share on other sites
Glad it worked out.

The screenshot you''ve posted looks very much like a depth buffer problem. Again I don''t know if this will work and am not really in a position to test it right now, but you could try changing

glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);

in the init() function to:

glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);

as that should explicitly request a window that has a depth buffer. The actual depth testing mode you''re using looks ok.

Good luck again.

Share this post


Link to post
Share on other sites
Well that didn''t fix it, but knowing that it''s a depth buffer problem, I will keep looking!

I had read about this exact problem in a post somewhere, about 10 minutes before I actually had the problem myself... and I couldn''t find it again.


Thanks!
--== discman1028 ==--

Share this post


Link to post
Share on other sites
I think this might be more or less the same as the previous error. Sorry about that, I should have thought. We''re in init() again. For safety''s sake, just move the block of code beginning...

glEnable(GL_TEXTURE_2D);// Enable Texture Mapping ( NEW )

...and ending...

glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);// Really Nice Perspective Calculations

...to the point immediately after...

glutCreateWindow("WAP :: Physics Engine");

Hopefully it should now work. I think you might have been trying to control the depth buffer prior to asking for one, which would confuse GL. I suggest here that you stick to

glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);

rather than revert it to its original state. Again, all of this could be wrong, but I hope it works out ok.

John

Share this post


Link to post
Share on other sites

  • 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!