Rotation of simple objects,
Members - Reputation: 122
Posted 24 July 2001 - 09:50 PM
Members - Reputation: 351
Posted 24 July 2001 - 11:19 PM
> I want the data in 1 vertexlist, so glRotate and such wont
> work...The data in the vertexlist has to be prerotated
I''m sure you could rotate it by incorporating the object rotate matrix into the matrix used to render the object. E.g. you should have a view matrix that transforms the vertices to the screen. To rotate an object in the world just combine (multiply) it''s rotation matrix with the view matrix before rendering, then restore the view matrix afterwards if there are other objects in the scene which have not been rotated. I think GL has funcitons for this.
Alternately you can pre-multiply the object vertices by an appropriate matrix. The matrix is the same and you should get the same result each way.
You can use angles. One way is to use the input angles to generate two or three rotation matrices about two perpendicular axes and multiply them to produce the object rotation matrix. This is OK for just rotating an object interactively but it does not produce very realistic behaviour, for which you''ll want to use object dyamics appropriate to your game type.
Members - Reputation: 1377
Posted 25 July 2001 - 04:05 AM
I wonder why you want to send all your vertices at once? Why not send them for each object separately, with different glBegin()...glEnd() blocks? If you have objects with only a very few triangles then I can see sending them at once, but if you have T&L hardware the pretransformation of the vertices may be more costly than splitting the objects up....
Applied Research Associates, Inc.