# OpenGl and physics question

This topic is 4587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Lets say you have a falling box, it falls on one of its corners. I have a general idea of how the simulation would work but my question is how it the box's (or different object) mesh data handled? Is every vertex transformed with its rotation and translation then put into some array for processing or is it handled differently. I just started coding a simple physics plugin for my engine (opengl renderer) so please forgive me if this is a stupid question. Also if you know of any tutorials or simple demos with source that would be a big help. -Nomad-

##### Share on other sites
You need to learn how to display rotated objects in OpenGL. Check out these OpenGL tutorials: NeHe.

##### Share on other sites
I think you are looking for a translation matrix in openGL. a 4x4 matrix would be projected over the whole object. you shouldn't have to go through an array and apply the change yourself openGL will do it for you. you have to calculate the forces on the cube after the colision and then put them in terms of acceleration, or velocity and then apply then to the idenity matrix based off of the time it takes to render each frame. this way the velocitys units are in units/sec instead of units/frame.

##### Share on other sites
I know how to do rotations and stuff in opengl. But lets say a corner of the box hits something, how do i know where the vertex's are ( for collision/response ). Once you apply a transform and draw the object, opengl takes over and transforms your input data and draws it without changing the original data.

##### Share on other sites
Quote:
 Original post by maxamI know how to do rotations and stuff in opengl. But lets say a corner of the box hits something, how do i know where the vertex's are ( for collision/response ). Once you apply a transform and draw the object, opengl takes over and transforms your input data and draws it without changing the original data.
You have to maintain and manage the transformed geometry yourself. Technically speaking there may be some duplicated effort, but there are various ways to keep the geometry that must be transformed manually to an absolute minimum. Also, many simple shapes (such as boxes) can be represented implicitly and don't require any vertex transformations at all, per se.

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5
JoeJ
12

• 14
• 9
• 22
• 9
• 31
• ### Forum Statistics

• Total Topics
632618
• Total Posts
3007485
• ### Who's Online (See full list)

There are no registered users currently online

×