Using OpenGL
Mike Parker via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Sep 2 20:05:07 PDT 2016
On Friday, 2 September 2016 at 20:38:15 UTC, Darren wrote:
> I'm trying to teach myself OpenGL but I'm not sure how to set
> it up exactly.
> I used "dub init" to create a project, I downloaded glew32.dll
> and glfw.dll and put them in this folder. I added
> "derelict-gl3": "~>1.0.19" and "derelict-glfw3": "~>3.1.0" to
> dependencies, and imported them in the app.d file. I add the
> load() and reload() functions where appropriate (I assume).
You don't need GLEW. It's a library for C and C++ that loads all
of the OpenGL functions and extensions available in the context
you create. DerelictGL3 does that for you in D. DerelictGl3.load
loads the OpenGL DLL and the functions up to OGL 1.1, and
DerelictGL3.reload loads all the functions and extensions
available in the current context.
>
> I can run a simple window program and it seems to work fine,
> but I notice that's when all the functions begin with "glfw".
Yes, GLFW is a simple windowing toolkit for creating windows &
OpenGL contexts and managing window & input events in a
cross-platform manner. Without it, you would need to use the
system APIs yourself (such as Win32 on Windows) or another
cross-platform library like SDL or SFML.
> If I try to follow a tutorial for loading a triangle, I get
> errors when trying to build.
>
> Do I need to link an opengl.dll file, too?
No, you do not need to link to OpenGL. By default, Derelict loads
shared libraries at runtime so you will never have a link-time
dependency on the C libraries Derelict binds to.
Please post the errors you are seeing.
More information about the Digitalmars-d-learn
mailing list