Jump to content
• Advertisement

# OpenGL Geometry and Transformations (Basic understanding of OpenGL applications)

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

I have recently run into a problem with a little program of mine. It's a pretty basic question about the way to handle geometry and transformations in an OpenGL application. As far as I can tell from various tutorials, the usual way to do this is something like this: glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Apply Transformations glBegin(/* Something */); // Draw Geometry glEnd(); However, this means all the transformations are applied during rendering. That means I run into a problem if I need to know the final coordinates in my program logic. For example, if I wanted to write a picking algorithm, I would have to apply the transformations beforehand and all the OpenGL transformations would become more or less useless, since I already know the absolute position of the object. I hope that was more or less understandable. What is the correct way to do this?

#### Share this post

##### Share on other sites
Advertisement
Opengl is ONLY for rendering.
If you want to apply in-game transformations to an object and know it's final location; then you need to calculate that yourself.

#### Share this post

##### Share on other sites
P.S.

since for our game-logic we end up doing a lot of these transforms ourselves.
the function GlMultMatrix() becomes our friend.
It allows us to take our in-game matrix math, and plug it directly into opengl.

(thus we avoid your point about duplicating work and having useless duplicated transforms)

#### Share this post

##### Share on other sites
I see, thanks for your input. That glMultMatrix() function seems to be what I'm looking for.

#### Share this post

##### Share on other sites

• Advertisement

### Announcements

• Advertisement

• ### Popular Contributors

1. 1
2. 2
3. 3
4. 4
5. 5
Rutin
17
• Advertisement

• 10
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631420
• Total Posts
2999987
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!