Trying to get Derelict.opengl3.gl3 and derelict.glfw3.glfw3 to work together
kiran kumari via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Sep 23 23:45:45 PDT 2014
On Wednesday, 24 September 2014 at 03:08:55 UTC, csmith wrote:
> Hi everyone,
>
> I've got derelict.opengl3.gl3 and derelict.glfw3.glfw3 setup
> with dub and can get a window to open up and close with glfw3.
> I can also use glClear(GL_COLOR_BUFFER_BIT); however, beyond
> this most OpenGL commands fail and I can't seem to figure out
> how to fix it.
>
> Code:
>
> import std.stdio;
> import derelict.opengl3.gl3, derelict.glfw3.glfw3;
>
> void main(string args[])
> {
> DerelictGL3.load(); // Loads OpenGL v1.0 and v1.1
> DerelictGLFW3.load(); // Loads GLFW3
>
> assert (glfwInit(), "Failed to initialize GLFW3");
> scope (exit) glfwTerminate();
>
> glfwSetErrorCallback(&error_callback);
>
> auto window = glfwCreateWindow(640, 480, "Simple
see more example
http://techgurulab.com/course/java-quiz-online/
> example", null, null);
> assert (window !is null);
>
> glfwMakeContextCurrent(window);
> auto vers = DerelictGL3.reload(); // Created GLFW3
> context, so GL3 needs to be reloaded
>
> while (!glfwWindowShouldClose(window)) {
> if (glfwGetKey(window, GLFW_KEY_ESCAPE) ==
> GLFW_PRESS)
> glfwSetWindowShouldClose(window, GL_TRUE);
>
> glClear(GL_COLOR_BUFFER_BIT);
> glBegin(GL_POINTS);
> glEnd();
>
> glfwSwapBuffers(window);
> glfwPollEvents();
> }
>
> glfwDestroyWindow(window);
> glfwTerminate();
> }
>
> extern (C) void error_callback(int error, const(char)*
> description) nothrow {
> printf("%s %s", error, description);
> }
>
> Compiler Output:
>
> derelict-util: ["derelict-util"]
> derelict-util: ["derelict-util"]
> derelict-glfw3: ["derelict-glfw3", "derelict-util"]
> derelict-util: ["derelict-util"]
> derelict-gl3: ["derelict-gl3", "derelict-util"]
> myproj: ["myproj", "derelict-util", "derelict-glfw3",
> "derelict-util", "derelict-gl3", "derelict-util"]
> Target is up to date. Using existing build in
> /home/csmith/.dub/packages/derelict-util-1.0.2/.dub/build/library-debug-linux.posix-x86_64-dmd-A741715720F146208FFF241F87E468DD/.
> Use --force to force a rebuild.
> Target is up to date. Using existing build in
> /home/csmith/.dub/packages/derelict-glfw3-1.0.2/.dub/build/library-debug-linux.posix-x86_64-dmd-DD1819CE8266F370192AAD3190CA5B06/.
> Use --force to force a rebuild.
> Target is up to date. Using existing build in
> /home/csmith/.dub/packages/derelict-gl3-1.0.6/.dub/build/library-debug-linux.posix-x86_64-dmd-59B635D839F3A8CFC2737986D4B622FD/.
> Use --force to force a rebuild.
> Building myproj configuration "application", build type
> debug.
> Compiling...
> source/app.d(25): Error: undefined identifier glBegin
> source/app.d(26): Error: undefined identifier glEnd
> FAIL
> .dub/build/application-debug-linux.posix-x86_64-dmd-357CCD4CB91CACEC384AF7BAA514E3A7
> myproj executable
> Error executing command run: DMD compile run failed with
> exit code 1
>
> Any ideas?
>
> Thanks,
> Charles
More information about the Digitalmars-d-learn
mailing list