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: Low FPS with DLL

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    18

    Low FPS with DLL

    Hello,

    I have 2 versions of code.

    In version 1 I have all the code in the same project and the application runs good.

    In version 2 I have some of the code in a dll and the basic window creation in the application.

    Im using VC++ 2008.

    My problem is when I use the dll version of the code, I have almost 1/2 the fps as the version 1.

    Any ideas to help me understand the problem and solve it are highly appreciated.

    thanks.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Jan 2007
    Posts
    982
    This is nothing to do with use of a DLL - Quake 2 used DLLs back in 1998 and didn't suffer from this kind of problem (what's more, OpenGL itself is implemented as a DLL). You've got something else different between the two sets of code, or you've a bad DLL implementation, that's causing this. Whichever, the problem will be in your own code, not in use of a DLL itself, and definitely not coming from the compiler.

    One example might be if you're doing LoadLibrary/GetProcAddress/FreeLibrary for every single call into the DLL code. That would be expected to run slower, and the solution would be to LoadLibrary and GetProcAddress for each entry point one-time-only at startup. But that's just an example; we haven't seen any details of your DLL implementation so the best you'll get is guesses.

  3. #3
    Intern Contributor uwi2k2's Avatar
    Join Date
    Mar 2011
    Posts
    82
    hi,

    pls give the code how you implement the DLL

    uwi

  4. #4
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    18
    Hi guys,

    Thanks for the reply. I'm exporting classes from the dll.
    As far as I know, once the class is instantiated, it doesn't matter where from the class came right?
    Please take a look at the attached code and let me know your opinion.

    thanks.
    Attached Files Attached Files

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    18
    HI,

    I'm using the glm library for the math and there is a warning that the glm functions are not exported with the dll signature. Can that be the cause?

    I will check that tonight.

    thanks.

  6. #6
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421
    Quote Originally Posted by drmz0counting View Post
    HI,

    I'm using the glm library for the math and there is a warning that the glm functions are not exported with the dll signature. Can that be the cause?

    I will check that tonight.

    thanks.
    Sounds like you are compiling a DEBUG version of the DLL and it isn't able to export the symbols for GLM.
    ------------------------------
    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);

  7. #7
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    18
    I had the camera update in the wrong place. I had it in the Windows callback. I moved it to the rendering function and all is well.

    thanks.

Posting Permissions

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