Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: Matrix Translation/Rotation

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2001
    Location
    84061 Ergoldsbach, Bavaria, Germany
    Posts
    13

    Matrix Translation/Rotation

    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?

    Cheeeers,
    Thomas Gahr

  2. #2
    Intern Contributor
    Join Date
    Aug 2001
    Posts
    65

    Re: Matrix Translation/Rotation

    I would say the custom method would be slower since OpenGL can Attain Hardware acceleration for its calculations.

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2001
    Location
    Slovakia
    Posts
    17

    Re: Matrix Translation/Rotation

    Hello

    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.

    See ya

  4. #4
    Junior Member Newbie
    Join Date
    Mar 2001
    Location
    84061 Ergoldsbach, Bavaria, Germany
    Posts
    13

    Re: Matrix Translation/Rotation

    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?

  5. #5
    Junior Member Newbie
    Join Date
    Mar 2001
    Location
    84061 Ergoldsbach, Bavaria, Germany
    Posts
    13

    Re: Matrix Translation/Rotation

    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?

  6. #6
    Advanced Member Frequent Contributor
    Join Date
    Sep 2000
    Location
    SWEDEN
    Posts
    718

    Re: Matrix Translation/Rotation

    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.

  7. #7
    Member Regular Contributor nickels's Avatar
    Join Date
    Feb 2000
    Location
    Colorado
    Posts
    298

    Re: Matrix Translation/Rotation

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •