Opengl Matrix Translation Issues - having trouble with my 3D game.

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > Game Programming

Opengl Matrix Translation Issues - having trouble with my 3D game.

switch
hey

i'm making a game, and just went to implement collision detection when i found that it would be incredibly difficult because of a shortcut i added to work around a problem. now i'm going back to fix that problem, but i'm running out of ideas.

i'm trying to do this... (in c++)
CODE

xPos = (whatever); //the x and z coordinates of the object.
zPos = (whatever);
rotation = (whatever); //the rotation of the object in degrees.

glPushMatrix();
   glTranslatef(xPos, 0, yPos);
   glRotatef(rotation);
   renderObject();
glPopMatrix();


and draw an object at xPos,0,yPos with a rotation of 'rotation'.

instead, the object appears at xPos, 0, -yPos. the problem can be fixed by putting doing this for the translation:
CODE
glTranslatef(xPos, 0, yPos);
and until now this is what i was doing, but it makes things like collision detection and camera work much more complicated later on.

does anyone have any ideas on why this would be occuring and/or how to fix it?

thanks, muchly appreciated.

 

 

 


Reply

switch
ok sorry that post was riddled with problems. zPos (in the second line of the first block of code) should be yPos, and the second block of code should read
CODE
glTranslatef(xPos, 0, -yPos);


ok thanks sorry about that.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : opengl matrix translation issues 3d


    Looking for opengl, matrix, translation, issues, trouble, 3d, game

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for opengl, matrix, translation, issues, trouble, 3d, game

*MORE FROM TRAP17.COM*
advertisement



Opengl Matrix Translation Issues - having trouble with my 3D game.



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE