1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 12:18:51 -05:00

Added window parameter to glfwSwapBuffers.

This commit is contained in:
Camilla Berglund 2012-08-06 18:13:37 +02:00
parent aff30d0baa
commit 585a840329
29 changed files with 37 additions and 44 deletions

View File

@ -617,7 +617,7 @@ int main( void )
display();
/* Swap buffers */
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwPollEvents();
/* Check if we are still running */

View File

@ -368,7 +368,7 @@ int main(int argc, char *argv[])
animate();
// Swap buffers
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwPollEvents();
}

View File

@ -663,7 +663,7 @@ int main(int argc, char** argv)
glDrawElements(GL_LINES, 2* MAP_NUM_LINES , GL_UNSIGNED_INT, 0);
/* display and process events through callbacks */
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwPollEvents();
/* Check the frame rate and update the heightmap if needed */
dt = glfwGetTime();

View File

@ -500,7 +500,7 @@ int main(void)
drawAllViews();
// Swap buffers
glfwSwapBuffers();
glfwSwapBuffers(window);
do_redraw = 0;
}

View File

@ -89,7 +89,7 @@ int main(void)
glEnd();
// Swap buffers
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwPollEvents();
if (glfwGetKey(window, GLFW_KEY_ESCAPE))

View File

@ -145,7 +145,7 @@ void init_grid(void)
// Draw scene
//========================================================================
void draw_scene(void)
void draw_scene(GLFWwindow window)
{
// Clear the color and depth buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@ -162,7 +162,7 @@ void draw_scene(void)
glDrawElements(GL_QUADS, 4 * QUADNUM, GL_UNSIGNED_INT, quad);
glfwSwapBuffers();
glfwSwapBuffers(window);
}
@ -450,7 +450,7 @@ int main(int argc, char* argv[])
adjust_grid();
// Draw wave grid to OpenGL display
draw_scene();
draw_scene(window);
glfwPollEvents();
}

View File

@ -581,7 +581,7 @@ GLFWAPI void glfwSetTime(double time);
/* OpenGL support */
GLFWAPI void glfwMakeContextCurrent(GLFWwindow window);
GLFWAPI GLFWwindow glfwGetCurrentContext(void);
GLFWAPI void glfwSwapBuffers(void);
GLFWAPI void glfwSwapBuffers(GLFWwindow window);
GLFWAPI void glfwSwapInterval(int interval);
GLFWAPI int glfwExtensionSupported(const char* extension);
GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);

View File

@ -288,6 +288,7 @@ version of GLFW.</p>
<li>Added <code>modes</code> video mode enumeration and setting test program</li>
<li>Added <code>glfw3native.h</code> header and platform-specific functions for explicit access to native display, window and context handles</li>
<li>Added <code>glfwSetGamma</code>, <code>glfwSetGammaRamp</code> and <code>glfwGetGammaRamp</code> functions and <code>GLFWgammaramp</code> type for monitor gamma ramp control</li>
<li>Added window parameter to <code>glfwSwapBuffers</code></li>
<li>Changed buffer bit depth parameters of <code>glfwOpenWindow</code> to window hints</li>
<li>Changed <code>glfwOpenWindow</code> and <code>glfwSetWindowTitle</code> to use UTF-8 encoded strings</li>
<li>Changed <code>glfwGetProcAddress</code> to return a (generic) function pointer</li>

View File

@ -51,10 +51,8 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
// Swap buffers
//========================================================================
void _glfwPlatformSwapBuffers(void)
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
{
_GLFWwindow* window = _glfwLibrary.currentWindow;
// ARP appears to be unnecessary, but this is future-proof
[window->NSGL.context flushBuffer];
}

View File

@ -324,7 +324,7 @@ void _glfwPlatformWaitEvents(void);
// OpenGL context management
void _glfwPlatformMakeContextCurrent(_GLFWwindow* window);
void _glfwPlatformSwapBuffers(void);
void _glfwPlatformSwapBuffers(_GLFWwindow* window);
void _glfwPlatformSwapInterval(int interval);
void _glfwPlatformRefreshWindowParams(_GLFWwindow* window);
int _glfwPlatformExtensionSupported(const char* extension);

View File

@ -541,21 +541,17 @@ GLFWAPI GLFWwindow glfwGetCurrentContext(void)
// Swap buffers (double-buffering)
//========================================================================
GLFWAPI void glfwSwapBuffers(void)
GLFWAPI void glfwSwapBuffers(GLFWwindow handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
return;
}
if (!_glfwLibrary.currentWindow)
{
_glfwSetError(GLFW_NO_CURRENT_CONTEXT, NULL);
return;
}
_glfwPlatformSwapBuffers();
_glfwPlatformSwapBuffers(window);
}

View File

@ -545,10 +545,8 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
// Swap buffers (double-buffering)
//========================================================================
void _glfwPlatformSwapBuffers(void)
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
{
_GLFWwindow* window = _glfwLibrary.currentWindow;
SwapBuffers(window->WGL.DC);
}

View File

@ -344,7 +344,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
// Clearing the front buffer to black to avoid garbage pixels left over
// from previous uses of our bit of VRAM
glClear(GL_COLOR_BUFFER_BIT);
_glfwPlatformSwapBuffers();
_glfwPlatformSwapBuffers(window);
return window;
}

View File

@ -642,10 +642,9 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
// Swap OpenGL buffers
//========================================================================
void _glfwPlatformSwapBuffers(void)
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
{
glXSwapBuffers(_glfwLibrary.X11.display,
_glfwLibrary.currentWindow->X11.handle);
glXSwapBuffers(_glfwLibrary.X11.display, window->X11.handle);
}

View File

@ -113,7 +113,7 @@ int main(void)
glVertex2f((GLfloat) cursor_x, (GLfloat) window_height);
glEnd();
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwPollEvents();
}

View File

@ -143,7 +143,7 @@ int main(int argc, char** argv)
glColor3f(0.8f, 0.2f, 0.4f);
glRectf(-0.5f, -0.5f, 0.5f, 0.5f);
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwWaitEvents();
}

View File

@ -239,7 +239,7 @@ static void window_refresh_callback(GLFWwindow window)
printf("%08x at %0.3f: Window refresh\n", counter++, glfwGetTime());
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers();
glfwSwapBuffers(window);
}
static void window_focus_callback(GLFWwindow window, int activated)

View File

@ -147,7 +147,7 @@ int main(int argc, char** argv)
glEnable(GL_MULTISAMPLE_ARB);
glRectf(-0.15f, -0.15f, 0.15f, 0.15f);
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwPollEvents();
}

View File

@ -101,7 +101,7 @@ int main(void)
while (running)
{
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwWaitEvents();
}

View File

@ -158,7 +158,7 @@ int main(int argc, char** argv)
glColor3f(0.8f, 0.2f, 0.4f);
glRectf(-0.5f, -0.5f, 0.5f, 0.5f);
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwPollEvents();
}

View File

@ -152,7 +152,7 @@ int main(int argc, char** argv)
glClearColor(1, 1, 1, 0);
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwPollEvents();
}

View File

@ -205,7 +205,7 @@ int main(void)
refresh_joysticks();
draw_joysticks();
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwPollEvents();
}

View File

@ -148,7 +148,7 @@ static void test_modes(void)
while (glfwGetTime() < 5.0)
{
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwPollEvents();
if (!window)

View File

@ -131,7 +131,7 @@ int main(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers();
glfwSwapBuffers(window_handle);
glfwWaitEvents();
}

View File

@ -147,7 +147,7 @@ int main(int argc, char** argv)
glRectf(-0.5f, -0.5f, 1.f, 1.f);
glPopMatrix();
glfwSwapBuffers();
glfwSwapBuffers(window_handle);
glfwPollEvents();
if (closed)

View File

@ -172,11 +172,12 @@ int main(int argc, char** argv)
{
glfwMakeContextCurrent(windows[0]);
draw_quad(texture);
glfwSwapBuffers();
glfwMakeContextCurrent(windows[1]);
draw_quad(texture);
glfwSwapBuffers();
glfwSwapBuffers(windows[0]);
glfwSwapBuffers(windows[1]);
glfwWaitEvents();
}

View File

@ -97,7 +97,7 @@ int main(void)
position = cosf(glfwGetTime() * 4.f) * 0.75f;
glRectf(position - 0.25f, -1.f, position + 0.25f, 1.f);
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwPollEvents();
}

View File

@ -61,7 +61,7 @@ int main(void)
while (glfwGetCurrentContext())
{
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers();
glfwSwapBuffers(window);
glfwWaitEvents();
}

View File

@ -87,7 +87,7 @@ int main(void)
{
glfwMakeContextCurrent(windows[i]);
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers();
glfwSwapBuffers(windows[i]);
}
glfwPollEvents();