MS3D OpenGL Texturing Question
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 ==--
--== discman1028 ==--
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
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
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.
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.
--== discman1028 ==--
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
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
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!!
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!!
--== discman1028 ==--
(i.e.)
http://www.angelfire.com/retro/here/ie.JPG
--== discman1028 ==--
http://www.angelfire.com/retro/here/ie.JPG
--== discman1028 ==--
--== discman1028 ==--
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.
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.
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 ==--
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 ==--
--== discman1028 ==--
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement