View Full Version : Matrix Translation/Rotation
10-09-2001, 03:47 AM
Hi, I am writing a little 3d jump'n'run-like game. I want to use matrix transformation to do all the rotation/transformation stuff instead of calling glTranslatef(...) and glRotatef(..) . But will it slow down my prog? Imagine:
I have about 2000 triangles in a scene, some of them culled (frustum). Then I have to multiply each vertex of all the triangles to do transformation. I planned to do some more culling after transformation to save drawing time. Will this method be more efficient than doing only frustum culling and let OpenGL do the transformations?
10-09-2001, 09:29 AM
I would say the custom method would be slower since OpenGL can Attain Hardware acceleration for its calculations.
10-09-2001, 11:13 AM
Why do you want to use your own matrix transformation calculations when there`re only 2000 triangles in the scene ? If there were 20000 or 50000 it would be different. But there`s no reason for just 2000 tris. I doubt you can do it faster than OpenGL for such a small amount of tris.
Anyway if you want to do it yourself try quaternions (www.google.com) - they take less space and just 4 numbers instead of nine.
10-10-2001, 03:12 AM
Well, I would like to have the vertex data translated in the memory, so I can something like LOD or so, where I would only have to test the z value then. Is there any way to get the transformed vertex data from openGL? Maybe with vertex lists???
Well - another thing. If I build my transformation matrix and call glLoadMatrix() - would that be faster?
10-10-2001, 03:16 AM
I forgot to say:
The 2000 triangles are only a small test level. There will surely be a lot more. And I have a far value of 55.0 in gluPerspective - that will also be increased. I am just worried about the framerate on slower machines, I got Athlon Thunderbird 800 and a nVidia geForce 2 card with 32 MB RAM - and my game runs at 80-160 fps (depending on the triangles being displayed). I think that's not enough, is it?
10-10-2001, 06:24 AM
I don't understanf why you want to transfoem the vertices yourself, what has that got to do with LOD? In general, doing your own matrix calculations, i.e. not using glTranslae and glRotate is not bad for performance, rather the opposite. However, it's pretty unlikely that doing your own vertex transforms will be faster than the driver unless you're pretty experienced at 3d ggraphics. So, do store your own tranform data in matrices but let OpenGL handle the vertex transformations.
10-11-2001, 09:16 AM
I think what you might be getting at is this:
If you transform all the polygons first and then cull, you are going to be slower than opengl doing the same.
However, if you can group your polygons into regions, say rectangular, then transform just the boundary, test it, cull if the whole thing is out of range, you will be much faster than opengl, because you only tested a few points and were able to throw the whole thing out, as opposed to testing every polygon.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.