View Full Version : 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?
08-01-2003, 12:01 PM
Why waste time making your own function declarations? Just link it.
08-01-2003, 12:04 PM
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.
08-01-2003, 12:21 PM
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.?
08-02-2003, 06:41 AM
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.
08-02-2003, 11:39 AM
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.
08-03-2003, 07:33 AM
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.
08-04-2003, 04:48 PM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.