mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 19:42:00 +00:00
Added window parameter to glfwSwapBuffers.
This commit is contained in:
parent
aff30d0baa
commit
585a840329
@ -617,7 +617,7 @@ int main( void )
|
||||
display();
|
||||
|
||||
/* Swap buffers */
|
||||
glfwSwapBuffers();
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
|
||||
/* Check if we are still running */
|
||||
|
@ -368,7 +368,7 @@ int main(int argc, char *argv[])
|
||||
animate();
|
||||
|
||||
// Swap buffers
|
||||
glfwSwapBuffers();
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -500,7 +500,7 @@ int main(void)
|
||||
drawAllViews();
|
||||
|
||||
// Swap buffers
|
||||
glfwSwapBuffers();
|
||||
glfwSwapBuffers(window);
|
||||
|
||||
do_redraw = 0;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ int main(void)
|
||||
glEnd();
|
||||
|
||||
// Swap buffers
|
||||
glfwSwapBuffers();
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
|
||||
if (glfwGetKey(window, GLFW_KEY_ESCAPE))
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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>
|
||||
|
@ -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];
|
||||
}
|
||||
|
@ -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);
|
||||
|
12
src/opengl.c
12
src/opengl.c
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -113,7 +113,7 @@ int main(void)
|
||||
glVertex2f((GLfloat) cursor_x, (GLfloat) window_height);
|
||||
glEnd();
|
||||
|
||||
glfwSwapBuffers();
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ int main(void)
|
||||
while (running)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glfwSwapBuffers();
|
||||
glfwSwapBuffers(window);
|
||||
glfwWaitEvents();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ int main(int argc, char** argv)
|
||||
glClearColor(1, 1, 1, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glfwSwapBuffers();
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ int main(void)
|
||||
refresh_joysticks();
|
||||
draw_joysticks();
|
||||
|
||||
glfwSwapBuffers();
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ static void test_modes(void)
|
||||
while (glfwGetTime() < 5.0)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glfwSwapBuffers();
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
|
||||
if (!window)
|
||||
|
@ -131,7 +131,7 @@ int main(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glfwSwapBuffers();
|
||||
glfwSwapBuffers(window_handle);
|
||||
glfwWaitEvents();
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ int main(void)
|
||||
while (glfwGetCurrentContext())
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glfwSwapBuffers();
|
||||
glfwSwapBuffers(window);
|
||||
glfwWaitEvents();
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ int main(void)
|
||||
{
|
||||
glfwMakeContextCurrent(windows[i]);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glfwSwapBuffers();
|
||||
glfwSwapBuffers(windows[i]);
|
||||
}
|
||||
|
||||
glfwPollEvents();
|
||||
|
Loading…
Reference in New Issue
Block a user