OpenGL: C and D same code - different results

Wolfgang Draxinger wdraxinger at darkstargames.de
Thu Feb 8 04:52:07 PST 2007


Wolfgang Draxinger wrote:

> The OpenGL bindings for D, that I've seen so far circumvent the
> normally used linkage to the DLL, which is normally happening
> by specifying the DLL in the Executable header. Instead the D
> bindings use LoadLibrary and GetProcAddress. Maybe this makes
> the D version to actually get the index mode.

Got the explanation for that one, too: Modern drivers intercept
the linkage on executable load to insert some of their own juice
into the code. Mainly to make usage of features like
antialiasing and PBuffers more efficient. Naturally getting the
functions pointers via LoadLibrary and GetProcAddress will
circumvent this and give you only the vanially opengl32.dll
which will happyly serve you a software emulated index colour
mode.

So instead of loader hacks a OpenGL binding for D should just
have a pragma to link against opengl32.lib (on windows) or
opengl32.so on *ix and provide the identifiers.

Extension loading should be done by wglGetProcAddress or
glxGetProcAddress _after_ a valid OpenGL context has been
aquired anyway. Sooner or later I will fork/extend GLEW to
GLEW'D (aka a GLEW that creates D code instead of C).

Wolfgang Draxinger
-- 
E-Mail address works, Jabber: hexarith at jabber.org, ICQ: 134682867




More information about the Digitalmars-d mailing list