Win32 + OpenGL bindings

Jacob Carlborg doob at me.com
Sun Apr 21 03:08:58 PDT 2013


On 2013-04-20 12:43, Diggory wrote:

> 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.

Derelict is raw OpenGL + automatically loading the dynamic libraries. 
I'm looking at the Dreliect3 source code. I can't see that it publicly 
import any Windows types/functions from the OpenGL files. If file "main" 
imports file A which imports file B, that doesn't mean that "main" will 
have access to file B. As far as I can see, you shouldn't have any 
conflicts.

https://github.com/aldacron/Derelict3

> 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?

Yes, they are just regular C .lib files. But if you're using DMD 32bit 
they need to be in the OMF format but the Microsoft linker and SDK uses 
the COFF format.

> 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.

You need to add the following flag when compiling :

-L/SUBSYSTEM:CONSOLE:4.0

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list