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 9 of 9

Thread: OpenGLed but slow

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    6

    OpenGLed but slow

    Hello everyone!

    I'm a college student I'm writing a program for my faculty, and I meet with some bottleneck here:

    it's a demonstration of some particles moving around, and I do it like this: a timer call InvalidateRect every 50ms, and in OnPaint, I call a function updates the particles' positions and redraw the whole scene, it was ok, but after I add some texture mapping on the experiment devices, the speed becomes unbearably slow, I think redrawing the whole scene rapidly cost much resource, but I wonder how those 3D games make it? For examp, in a tank game, when a tank fires a bullet out, don't it need to redraw the whole scene?

    So I need some help to boost my program's performance here ...

    Thank you ahead!

    ps: I used gluBuild2DMipmap, I've already seen in some post that it's slow, but I don't know what to take the place of it...

  2. #2
    Intern Contributor
    Join Date
    Apr 2002
    Posts
    87

    Re: OpenGLed but slow

    First, the obvious questions:

    Does your test-computer contain a videocard which accelerates opengl?

    If so, are the correct drivers for this card installed?

    And are you requesting an accelerated pixel format?

  3. #3
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: OpenGLed but slow

    Using gluBuild2DMipmap in your paint function?
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  4. #4
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    6

    Re: OpenGLed but slow

    Originally posted by V-man:
    Using gluBuild2DMipmap in your paint function?
    Yep, the paint function repaints everything on the screen, including the texture.

  5. #5
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    6

    Re: OpenGLed but slow

    Originally posted by kansler:
    First, the obvious questions:

    Does your test-computer contain a videocard which accelerates opengl?

    If so, are the correct drivers for this card installed?

    And are you requesting an accelerated pixel format?
    I think the video card supports at least OpenGL 1.1 and the operation system is Windows 2000; and when I rotate or translate the world coordinate by the mouse, it's not slow, just when I call the timer to reposition the particles and repaint the screen, the particles seems moving more slowly with the texture.


    [This message has been edited by piccaliili (edited 11-18-2003).]

    [This message has been edited by piccaliili (edited 11-18-2003).]

  6. #6
    Intern Contributor
    Join Date
    Apr 2002
    Posts
    87

    Re: OpenGLed but slow

    And what do the functions

    glGetString(GL_RENDERER)
    and
    glGetString(GL_VENDOR)

    return?

  7. #7
    Advanced Member Frequent Contributor
    Join Date
    Oct 2001
    Posts
    612

    Re: OpenGLed but slow

    gluBuild2DMipmap upload a texture to opengl, no need to do that more than once if you dont change teh content of it each frame

  8. #8
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,527

    Re: OpenGLed but slow

    If you use more than one texture, use texture objects. Functions are glGenTextures, glBindTexture, glDeleteTextures.
    Texture objects store TexParameter with them.
    Texture object id 0 is the immediate (default) texture if you need to switch back from a texture object to the immediate texture.

  9. #9
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    6

    Re: OpenGLed but slow

    Wow, I got it, thank you all!

Posting Permissions

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