Advertisement

Please help me

Started by March 21, 2001 12:54 PM
15 comments, last by Sam Gamgee 23 years, 8 months ago
Hi everyone, I went through just about all of NeHe''s tutorials for GL and wanted to say they are the best tutorials I''ve ever read about OpenGL! However now I''m working with DirectX 8. I tried to implement one of NeHe''s tutorial (the one where you can walk around the world), but for some reason the results aren''t the same. Maybe someone here can help me. I''m trying to get the code below to work: Level1.Level.MeshPos.x -= (float)sin (Level1.Level.MeshAngle.y*piover180)*0.005f; Level1.Level.MeshPos.z -= (float)cos(Level1.Level.MeshAngle.y*piover180)*0.005f; The above code gets called whenever the user hits the UP arrow key, however it doesn''t work like it did in OpenGL. I''m probably missing something simple, but maybe you could point it out to me? Thank you very much for any help anyone can give me, -Sam. p.s. The above code is the same as it is in the tutorial (I think it''s tutorial 10, but I''m not sure)
In OpenGL is the Z-axis pointing out of screen D3D default is the other way around. I think that you can set the coordinate system in D3D so it will be like OpenGL.
Advertisement
Hi,

Thanks for your reply! However I don''t think I know what you mean. Acording to my experiments in DX8 all the axis seem the same.

-Sam.

p.s. I forgot to mention that I also tried the following:

Level1.Level.MeshPos.x -= (float)sin(Level1.Level.MeshAngle.y)*0.005f;
Level1.Level.MeshPos.z -= (float)cos(Level1.Level.MeshAngle.y)*0.005f;

Only difference is no piover180, but it still doesn''t work Thanks for any help anyone can give.
Arrgh! I can sympathise on this one.

unfortunately, all I can say is keep plugging at it...

I''ve done this three times now.

I write the code, as I think it should work.
It doesn''t.
I fiddle with it for hours.
It still doesn''t work.
I change it back to what I thought I started with and it works...

very annoying, and probably says a lot about my coding skills!

good luck though!




I used to be indecisive. Now I''m not so sure...
_________________________________I used to be indecisive. Now I'm not so sure...
Arrgh! I can sympathise on this one.

unfortunately, all I can say is keep plugging at it...

I''ve done this three times now.

I write the code, as I think it should work.
It doesn''t.
I fiddle with it for hours.
It still doesn''t work.
I change it back to what I thought I started with and it works...

very annoying, and probably says a lot about my coding skills!

good luck though!




I used to be indecisive. Now I''m not so sure...
What are the symptoms ? I mean, you say it doesn''t work like it''s supposed to do, but in what way is it diffrent ?

(eg, you walk backwards instead of forward? or you fly up in the air? perhaps pink elephants spawn and do the kalinka?.. now that would be really weird.. )



return 1;
Advertisement
To be honest I can''t really tell whats going on, but I''ll try to describe it. When the level first loads, and everything is setup at angle 0 and position 0, everything works fine. Because whenever I press the up arrow key, the camera moves forward like it''s supposed to. However when I rotate just a little bit & then press the up arrow key, the camera still moves in the same direction as it did before when I didn''t rotate!

However if I rotate a lot (>20 degrees), then the camera moves in yet another direction...but not where I want it to go! It''s very wierd!

I can''t find a pattern to whats going on...it''s really confusing!

(BTW: actually the elephants are blue )

Thanks for any help.

-Sam.
Ohps...I forgot to enter my user info in the above post. Sorry.

-Sam.
I think there''s a DirectX version of NeHe''s tutorials called NeXe. I don''t know where it is, but I''m sure there''s a link around here somewhere.
When the anonymous poster said the z-axis was reversed, what he meant was this:

The x-axis increases as it goes right. That means an object at x-coordinate 2 is to the right of an object at x-coordinate 1.

The y-axis increases as it goes up. So an object at y-coordinate 2 is above an object at y-coordinate 1.

But which direction does the z-axis go? Well, it can go either way (farther or closer). One way is called "right-handed", the other is "left-handed." OpenGL is right-handed, and Direct3D is left-handed by default, though you can make it right-handed. If you''re using the D3DX functions, D3DXLookAtLH is left-handed, D3DXLookAtRH is right-handed. There are LH and RH versions of the other view-related matrix operations as well.

But I don''t even think that''s the cause of your problem. It sounds like the problem is with setting your transformation matrix. How do you calculate it?

~CGameProgrammer( );

~CGameProgrammer( ); Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.

This topic is closed to new replies.

Advertisement