I'm a beginner of OpenGL. After configuring the develop environment on Windows 7 64-bit, use vs2012, There's no effect when I run the demo program from gflw website.
here the code
void runRenderLoop(GLFWwindow *window){
glfwMakeContextCurrent(window);
glfwSwapInterval(1);
glfwSetKeyCallback(window,keyCallback);
while (!glfwWindowShouldClose(window)) {
int width;
int height;
glfwGetFramebufferSize(window,&width,&height);
glViewport(0,0,width,height);
glClear(GL_COLOR_BUFFER_BIT);
GLfloat ratio = static_cast<GLfloat>(width)/static_cast<GLfloat>(height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef((float) glfwGetTime() * 50.f, 0.f, 0.f, 1.f);
glBegin(GL_TRIANGLES);
glColor3f(1.f, 0.f, 0.f);
glVertex3f(-0.6f, -0.4f, 0.f);
glColor3f(0.f, 1.f, 0.f);
glVertex3f(0.6f, -0.4f, 0.f);
glColor3f(0.f, 0.f, 1.f);
glVertex3f(0.f, 0.6f, 0.f);
glEnd();
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwMakeContextCurrent(NULL);
glfwDestroyWindow(window);
glfwTerminate();
}
What weird is, i can see the window is created properly, also when i attach a break point between glBegin() and glEnd(), it triggers correctly. Also, glfw handles my keyCallback perfectly. However, the window is totally dark, nothing there. It really confused me
My current opengl version is 3.2