DerelictGL program draw nothing
Zhenya
zheny at list.ru
Mon Sep 3 08:22:22 PDT 2012
Why this simple program don't show white square?
import std.stdio;
import derelict.opengl3.gl;
import derelict.glfw3.glfw3;
const uint width = 200;
const uint height = 200;
void init()
{
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-width,width,-height,height,-1,1);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2d(0,0);
glVertex2d(0,height);
glVertex2d(width,height);
glVertex2d(height,0);
glEnd();
}
void main()
{
DerelictGL.load();
DerelictGLFW3.load();
glfwInit();
GLFWwindow window;
window = glfwCreateWindow(width,height,GLFW_WINDOWED,"Hello
DerelictGLFW3",null);
init();
bool opened = true;
while(opened)
{
opened = !glfwGetWindowParam(window,GLFW_CLOSE_REQUESTED) &&
!glfwGetKey(window,GLFW_KEY_ESC);
display();
glfwSwapBuffers(window);
glfwWaitEvents();
}
glfwTerminate();
}
More information about the Digitalmars-d-learn
mailing list