Jump to content
  • Advertisement


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


absolute coordinates(not glTranslatef!)

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

with glTranslatef()i can move the "center of drawing", it''s always relative to the last position of glTranslatef(). this is shit when i want to draw a few objects... is it possible to set the new center of drawing to absolute coordinate?

Share this post

Link to post
Share on other sites
If I''m understnding you right, you can just use glLookAt(). You could also call glPush/PopMatrix() before and after evry item. A slowere yet easier version of this is to call glLoadIdentity() before every glTranslatef().

Open mouth, insert foot

Share this post

Link to post
Share on other sites
call glLoadIdentity(); before translating each time should work


life is unfair, take advantage of it.
UNMB2 - if the link doesn''t work, try clicking it

Share this post

Link to post
Share on other sites
Well, there are several ways to solve this problem...
One use glLoadIdentity() before drawing each object. the problem with this is that it also resest the rotation.
the second is to push the matrix draw the object the pop the matrix. this works good if you don''t have nested objects as theres no garuentee of the stack depth.
the third method works the best for me and will work great for nested and hirarcial object drawing. use glTranslatef() to translate to the center of drawing before drawing the object then use the negitives of the value to glTranslate to the previous postition afterwords.
A good exapmle of how this can be handy is if you have an object that is made up of 2 or more other objects...

void DrawObjectA(){
< Draw Object A >

void DrawObjectB(){
< Draw Object B >

void DrawObjectC(){

Hope this didn''t confuse you too much!

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!