Added glfwMakeContextCurrent to quick tutorial.

This commit is contained in:
Camilla Berglund 2013-02-25 15:49:58 +01:00
parent ad4f9f1520
commit dfc48d7170
1 changed files with 14 additions and 0 deletions

View File

@ -100,6 +100,18 @@ Once this function is called, no more events will be delivered for that window
and its handle becomes invalid. and its handle becomes invalid.
@section quick_context_current Making the OpenGL context current
Before you can use the OpenGL API, it must have a current OpenGL context. You
make a window's context current with @ref glfwMakeContextCurrent. It will then
remain as the current context until you make another context current or until
the window owning it is destroyed.
@code
glfwMakeContextCurrent(window);
@endcode
@section quick_window_attribs Retrieving window attributes @section quick_window_attribs Retrieving window attributes
Each window provides a number of attributes that can be queried with @ref Each window provides a number of attributes that can be queried with @ref
@ -180,6 +192,8 @@ int main(void)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
glfwMakeContextCurrent(window);
while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE)) while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE))
{ {
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);