Opengl extensions loading

Hi,
Can somebody tell me the correct order of preparing an SDL app to load
opengl extensions?

Is this order correct?

  • SDL_Init(SDL_EVERYTHING)
  • SDL_SetAttribute(…)
  • SDL_SetVideo…
  • Load opengl extensions using SDL_GL_GetProcAddress
  • SDL_SetAudio…

If I do not use SDL_GL_LoadLibrary() but I have linked my app with
libGL.so/opengl32.dll, the extensions are loaded from the opengl lib that
is linked with my app or the extensions are resolved externally by SDL by
dynamically loading the default libs: libGL.so.1/opengl32.dll ???

I am asking these questions because my 3d engine crashed while loading the
extensions on windows and there are also crash reports on linux using
Mesa. On my Geforce Xfree4.0 system there is no crash. Note that I use SDL
1.1.5

Thanks in advance

hi`

make sure to query for the existance of the extension before you use it.On Fri, Oct 20, 2000 at 03:22:46PM +0300, Vasileiou Nikolaos wrote:

Hi,
Can somebody tell me the correct order of preparing an SDL app to load
opengl extensions?

Is this order correct?

  • SDL_Init(SDL_EVERYTHING)
  • SDL_SetAttribute(…)
  • SDL_SetVideo…
  • Load opengl extensions using SDL_GL_GetProcAddress
  • SDL_SetAudio…

If I do not use SDL_GL_LoadLibrary() but I have linked my app with
libGL.so/opengl32.dll, the extensions are loaded from the opengl lib that
is linked with my app or the extensions are resolved externally by SDL by
dynamically loading the default libs: libGL.so.1/opengl32.dll ???

I am asking these questions because my 3d engine crashed while loading the
extensions on windows and there are also crash reports on linux using
Mesa. On my Geforce Xfree4.0 system there is no crash. Note that I use SDL
1.1.5

Thanks in advance


Daniel Vogel vogel at lokigames.com
Programmer 714-505-8915 x17
Loki Software www.lokigames.com

Yes I do check the extensions before loading.

I’m afraid that there might be a conflict between the already linked
opengl lib and my app trying to load extensions externally.

Should I load ALL gl functions using SDL_GL_GetProcAdress and not link
with libGL???On Wed, 1 Nov 2000, Daniel Vogel wrote:

hi`

make sure to query for the existance of the extension before you use it.

On Fri, Oct 20, 2000 at 03:22:46PM +0300, Vasileiou Nikolaos wrote:

Hi,
Can somebody tell me the correct order of preparing an SDL app to load
opengl extensions?

Is this order correct?

  • SDL_Init(SDL_EVERYTHING)
  • SDL_SetAttribute(…)
  • SDL_SetVideo…
  • Load opengl extensions using SDL_GL_GetProcAddress
  • SDL_SetAudio…

If I do not use SDL_GL_LoadLibrary() but I have linked my app with
libGL.so/opengl32.dll, the extensions are loaded from the opengl lib that
is linked with my app or the extensions are resolved externally by SDL by
dynamically loading the default libs: libGL.so.1/opengl32.dll ???

I am asking these questions because my 3d engine crashed while loading the
extensions on windows and there are also crash reports on linux using
Mesa. On my Geforce Xfree4.0 system there is no crash. Note that I use SDL
1.1.5

Thanks in advance


Daniel Vogel vogel at lokigames.com
Programmer 714-505-8915 x17
Loki Software www.lokigames.com

Hi,
Can somebody tell me the correct order of preparing an SDL app to load
opengl extensions?

Is this order correct?

  • SDL_Init(SDL_EVERYTHING)
  • SDL_SetAttribute(…)
  • SDL_SetVideo…
  • Load opengl extensions using SDL_GL_GetProcAddress
  • SDL_SetAudio…

If I do not use SDL_GL_LoadLibrary() but I have linked my app with
libGL.so/opengl32.dll, the extensions are loaded from the opengl lib that
is linked with my app or the extensions are resolved externally by SDL by
dynamically loading the default libs: libGL.so.1/opengl32.dll ???

The extensions are loaded from the opengl library that is linked with your
app, under Linux. I believe that under Windows a handle to opengl32.dll is
opened and the GL functions are loaded from that, which should be fine if
you are linking with opengl32.dll, as Windows just increments the already
loaded DLL’s refcount and returns a handle to the DLL address space.

I am asking these questions because my 3d engine crashed while loading the
extensions on windows and there are also crash reports on linux using
Mesa. On my Geforce Xfree4.0 system there is no crash. Note that I use SDL
1.1.5

Try using SDL 1.1.6, although you really should get access to the system and
check to make sure the extension you are requesting is supported by the GL
implementatation before getting a pointer to the functions for it.

-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Yes I do check the extensions before loading.

I’m afraid that there might be a conflict between the already linked
opengl lib and my app trying to load extensions externally.

Should I load ALL gl functions using SDL_GL_GetProcAdress and not link
with libGL???

That’s the safest way to do it, although on Windows it is my understanding
that you can link with opengl32.lib, and SDL can open opengl32.dll, and both
SDL and your application are using the same functions.

Please let me know what you find out.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

At 21:31 7/11/00 -0800, Sam Lantinga wrote:

I believe that under Windows a handle to opengl32.dll is opened and the GL
functions are loaded from that, which should be fine if you are linking with
opengl32.dll

I always assumed that opengl32.dll was Microsoft’s software implementation, and
that installing video drivers would overwrite this file with a manufacturer
specific
hardware accelerated library. But when I install my nVidia drivers, they leave
opengl32.dll untouched and install a new library (I think it was
nvopengl.dll), and
also add a registry key that points to this new dll.

GlTron correctly identifies the nVidia drivers, but other games (like prBoom /
glBoom) do not seem to be taking advantage of the acceleration.

[I guess this may also relate to the “Savage4 OpenGL not accelerated on Win32” thread.]

Is it wrong for games to always assume the library to link with is called
opengl32.dll, or is nvopengl.dll just a ‘helper’ library?