Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

use glTranslate for each primitive?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
5 replies to this topic

#1 Gammastrahler   Members   

150
Like
Likes
Like

Posted 22 June 2001 - 12:01 PM

hello again, for my ego-shooter engine, i currently use one call to glTranslate() to move through my 3d-world. this is pretty simple, but on the other side, i need to specify the absolute coordinates for every polygon in 3d space which can be annoying... since i need to readjust 10 times in many cases..... but i wan´t to rewrite my engine so that every polygon hold a x,y,z val for position and only the dimensions in relative units. this would mean that i have to call glTranslate() for every polygon. but i think it could slow down the game, because the matrix would be recalculated for every poly each frame.... any idea? thanks & greets gammastrahler

#2 Obelix   Members   

122
Like
Likes
Like

Posted 22 June 2001 - 12:34 PM

quote:
Original post by Gammastrahler
but i wan´t to rewrite my engine so that every polygon hold a x,y,z val for position and only the dimensions in relative units. this would mean that i have to call glTranslate() for every polygon.


You are talking about polygons. Do you not use models?
It seems like you are moving by using glTranslate and that can also be little confusing.

Some pseudo code for the standard way:

glLoadIdentity();
gluLookAt(...); // move here
for(allModels) {
glPushMatrix();
translateAndRotateModelToTheProperPlace(...);
drawModel(...);
glPopMatrix();
}





#3 Gammastrahler   Members   

150
Like
Likes
Like

Posted 22 June 2001 - 12:49 PM

@obelix:

no, i´m currently using no models, all polygons i use are coded coordinate by coordinate in c++.

the pseudo-code you stated is exactly what i mean, but as i said, you must translate and rotate for each model or poly, and i think that would slow down the engine, does it?

thanks
gammastrahler!

#4 Obelix   Members   

122
Like
Likes
Like

Posted 22 June 2001 - 09:24 PM

Yes, it would slow down the engine if you called it for each polygon. A model has many polygons so it does not make any difference. You can always write a function that transform your new format to absolute vertex coordinates. I think that you should write a editor before you get mad by hardcoding everything.
Perhaps can a editor made for another game like Quake be used?

#5 Slinger   Members   

122
Like
Likes
Like

Posted 24 June 2001 - 07:24 PM

Why dont you use gluLookAt(); instead of translating and rotating your scene.

#6 AIRmichael   Members   

136
Like
Likes
Like

Posted 27 June 2001 - 12:20 AM

What about useing glTranslate to every vertex instead of every polygon




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.