Using OpenGL
Darren via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Sep 3 04:30:41 PDT 2016
On Saturday, 3 September 2016 at 11:27:09 UTC, Mike Parker wrote:
> On Saturday, 3 September 2016 at 11:13:30 UTC, Lodovico
> Giaretta wrote:
>>
>> Ah! Well, providing error messages is always useful. Now I see
>> your issue: your callback has D linkage, but OpenGL expects a
>> function with C linkage. So you have to put `extern(C)` on
>> your callback declaration.
>
> Well, it's GLFW, not OpenGL, but yes they do need to be extern
> (C) and also nothrow, as that is how the callback types are
> declared in Derrlict:
>
> ```
> extern(C) nothrow
> void key_callback(GLFWwindow* window, int key, int scancode,
> int action, int mode) {
> if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
> glfwSetWindowShouldClose(window, GL_TRUE);
> }
> ```
Hey, it worked! Thanks a lot, I know what to do in the future
now. Just need to figure out why this triangle isn't showing up
and I should be well on my way.
More information about the Digitalmars-d-learn
mailing list