Results 1 to 8 of 8

Thread: link with opengl32.lib???

  1. #1
    Guest

    link with opengl32.lib???

    should i do this when building for win32 or should i make my own prototypes for all opengl functions i use and load the opengl32.dll myself at runtime?

    i think noticed thats what is done in the quake source. but they did that partially for debugging reasons, i gather.

    so, is it bad for me to link with the .lib statically?

  2. #2
    Member Contributor
    Join Date
    Jul 2002
    Location
    Southampton, PA, USA
    Posts
    61

    Re: link with opengl32.lib???

    Why waste time making your own function declarations? Just link it.

  3. #3
    Member Newbie
    Join Date
    Aug 2003
    Location
    asda
    Posts
    47

    Re: link with opengl32.lib???

    I really dont know why they did that with Quake. Could it be some gain in performance? The functions is in the dll from the hardware vendor so maybe is it little faster to have prototypes?

    OpenGL32.lib is a import library so most people would not call it static linking.
    asd

  4. #4
    Junior Member Newbie
    Join Date
    Jul 2003
    Posts
    23

    Re: link with opengl32.lib???

    I dont mean to be stupid, and this might be a stupid logical comment, but by creating "aliases" for these openGL calls, it would actually take more time, because you are adding one extra command per openGL command. Do you see the extra layer you are adding.?

  5. #5
    Member Newbie
    Join Date
    Aug 2003
    Location
    asda
    Posts
    47

    Re: link with opengl32.lib???

    Is not adding an extra layer the same as adding at least one more function call? I was thinking of function variables that is set to the address from the vendor dll. Like the ordinary use of extensions.

    I dont know if this is faster but its likely so. If you are going through opengl32.dll is the call redirected anyway to the function from the vendor.
    asd

  6. #6
    Senior Member Regular Contributor
    Join Date
    Jun 2002
    Posts
    365

    Re: link with opengl32.lib???

    Originally posted by Some guy:
    I really dont know why they did that with Quake. Could it be some gain in performance?
    I think they did it because of problems with opengl support for earlier cards(think 3dfx). And to be able to switch renderers. If I remember correctly q2 supported something like: software,"default opengl", and 3dfxGL/glide.

  7. #7
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Naarn, Austria
    Posts
    1,102

    Re: link with opengl32.lib???

    An import library does not add an extra layer. It just adds something in the exe header so the functions are loaded at program loading time, not at runtime.

    As far as I can see it only has portability reasons:

    Under Linux you have a dynamic library where you load your OpenGL 1.whatever and extension calls. Under Windows you have a library where you load your OpenGL 1.1 calls and you load extensions with a wgl function. For Glide cards the functions are not loaded from the standard opengl.dll but from a wrapper library.

    When loaded dynamically at run time it is just more portable. You have function pointers to every OpenGL and extension function you need, and the only difference between Windows and Linux code is that under Linux you load all functions from libopengl.so, under Windows you load some from opengl32.dll or the glide wrapper and some with wglGetProcAddress.

  8. #8
    Member Newbie
    Join Date
    Aug 2003
    Location
    asda
    Posts
    47

    Re: link with opengl32.lib???

    The overhead doesnt come from the import library itself but from the fact that the function being used is not in opengl32.dll. Its not just the functions with hardware support that is loaded from the vendor dll. I think that both nVidia and ATi ships complete OpenGL implementations for Windows but because of Microsoft do they not replace opengl32.dll like in linux.
    asd

Similar Threads

  1. Opengl32 Link errors
    By Matt101 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-17-2017, 06:59 AM
  2. Get rid of Win OpenGL32.DLL
    By glfreak in forum OpenGL: General
    Replies: 22
    Last Post: 05-29-2009, 01:41 PM
  3. Link to OpenGL32.dll
    By KRONOS in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 05-26-2001, 08:59 AM
  4. ?? opengl32.dll / opengl32.lib (Win32)
    By Feldi in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 04-02-2001, 11:19 PM
  5. Replies: 1
    Last Post: 06-10-2000, 08:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean