-
Notifications
You must be signed in to change notification settings - Fork 23
Using Derelict OpenGL with DSFML
Jebbs edited this page Aug 12, 2013
·
2 revisions
It is actually very simple to set up a project that uses both Derelict OpenGL and DSFML. For example...
module main;
import dsfml.graphics;
import derelict.opengl3.gl3;
void main()
{
//load OpenGL
DerelictGL3.load();
//Create your context(In this case, it is part of the window)
ContextSettings settings = ContextSettings(24,8,4,3,0);
auto window = new RenderWindow(VideoMode(800,600), "DSFML Test"c ,Window.Style.DefaultStyle, settings);
//Reload OpenGL in order to use greater than 1.1 functionality
DerelictGL3.reload();
//we can now use OpenGL functions
Event event;
bool running = true;
while (running)
{
while (window.pollEvent(event))
{
if (event.type == Event.Closed)
running = false;
}
window.clear();
//OpenGL Code goes here
window.display();
}
}