Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: OpenGL: Tweaking and performance

  1. #11

    OpenGL: Tweaking and performance

    Code:
        glPushMatrix;
        glTranslatef(pos.x, pos.y, pos.z);
        glRotatef(rot, 0, 0, 1);
    
        glInterleavedArrays(GL_T2F_V3F, 0, @edges[0]);
        glDrawElements(GL_quads, 4, GL_UNSIGNED_BYTE, @tennumbers[0]);
    
        glpopMatrix;
    where you have gltranslate, glrotate, etc.. do those functions yourself on the cpu, and store the data in some buffer.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  2. #12

    OpenGL: Tweaking and performance

    Combining as many sprites as possible in single texture really is a speed trick. I'd keep something like 512x512 a limit but sort sprites so that you only need to bind each texture once. Don't try to load too many textures at the beginning if there is a lot. Instead load on demand for texture sets where entering levels, replacing current ones if that is possible for the game.

    I never used manual rotating over glRotate. I suppose if you could pre-calculate vertex coordinates (Just UP and LEFT vectors needed) for angles 0-359 with step 1 or some would make a difference, however it needs to be added to position vector. Scaling works fine with this too.

    Thanks for the glDrawElements reminder i never really knew how to use it. It's of the bit harder part of OpenGL imo.

  3. #13

    OpenGL: Tweaking and performance

    i'm also combining particle sprites into one, i remember one glscene demo which had option to sort material / textures when rendering - and when the materials were sorted so it did low amout of texture state swtches, it really shown in the FPS counter.

    another idea is, to use multitexturing, and have 4 different textures bound at all times, and cycle thru them to minimize binding textures.. this way you get even less texture switches, but if you use shaders or special effects much you can't use this technique.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

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