Win32 + OpenGL bindings

Diggory diggsey at googlemail.com
Sat Apr 20 03:43:14 PDT 2013


On Saturday, 20 April 2013 at 10:09:37 UTC, Jacob Carlborg wrote:
> On 2013-04-20 05:26, Diggory wrote:
>
>> - derelict.opengl.gl:
>> Has all of opengl plus wgl* functions needed for windows, but 
>> has more
>> dependencies than an ideal opengl binding would have.
>
> Dependencies, like what?
Well the opengl module depends on the util module. The util 
module declares a load of stuff duplicated by the windows module 
so importing them both without aliasing is impossible. All I want 
is to import the raw opengl and win32 functions.


I've got my program partially working using the old win32.windows 
module with an opengl module I got from elsewhere which included 
"opengl32.lib", but doesn't define glViewport...

I would like to use the opengl module from deimos if possible - 
it doesn't need to be particularly up to date - but I don't know 
how to get/generate the .lib file for it.

Are the .lib files used with D just C/C++ .lib files? If so what 
are the requirements of them - .lib files from the windows SDK 
don't seem to be compatible? Do I need to generate them instead 
from the .d files?

Also the program I'm compiling is bringing up a console window 
when it runs, even though I'm setting the subsystem to "Windows" 
and using "WinMain" exactly as the documentation describes.

Finally I seem to have discovered a bug with "final switch":
This correctly does nothing when passed "36" (neither WM_SIZE and 
WM_DESTROY equal 36):
switch (message) {
	case WM_SIZE:
		glViewport(0, 0, LOWORD(lParam), HIWORD(lParam));
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		break;
}

While this runs the "WM_DESTROY" case statement when passed 36.
final switch (message) {
	case WM_SIZE:
		glViewport(0, 0, LOWORD(lParam), HIWORD(lParam));
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
}


More information about the Digitalmars-d-learn mailing list