mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 06:14:35 +00:00
Added glfwGetCurrentWindow.
This commit is contained in:
parent
f73f01b68c
commit
419f9f17a1
@ -417,6 +417,7 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height, int mode, const char* t
|
|||||||
GLFWAPI void glfwOpenWindowHint(int target, int hint);
|
GLFWAPI void glfwOpenWindowHint(int target, int hint);
|
||||||
GLFWAPI void glfwMakeWindowCurrent(GLFWwindow window);
|
GLFWAPI void glfwMakeWindowCurrent(GLFWwindow window);
|
||||||
GLFWAPI int glfwIsWindow(GLFWwindow window);
|
GLFWAPI int glfwIsWindow(GLFWwindow window);
|
||||||
|
GLFWAPI GLFWwindow glfwGetCurrentWindow(void);
|
||||||
GLFWAPI void glfwCloseWindow(GLFWwindow window);
|
GLFWAPI void glfwCloseWindow(GLFWwindow window);
|
||||||
GLFWAPI void glfwSetWindowTitle(GLFWwindow, const char* title);
|
GLFWAPI void glfwSetWindowTitle(GLFWwindow, const char* title);
|
||||||
GLFWAPI void glfwGetWindowSize(GLFWwindow, int* width, int* height);
|
GLFWAPI void glfwGetWindowSize(GLFWwindow, int* width, int* height);
|
||||||
|
@ -270,6 +270,7 @@ version of GLFW.</p>
|
|||||||
<li>Added <code>glfwGetWindowPos</code> function for querying the position of the specified window</li>
|
<li>Added <code>glfwGetWindowPos</code> function for querying the position of the specified window</li>
|
||||||
<li>Added <code>glfwSetWindowFocusCallback</code> function and <code>GLFWwindowfocusfun</code> type for receiving window focus events</li>
|
<li>Added <code>glfwSetWindowFocusCallback</code> function and <code>GLFWwindowfocusfun</code> type for receiving window focus events</li>
|
||||||
<li>Added <code>glfwSetWindowIconifyCallback</code> function and <code>GLFWwindowiconifyfun</code> type for receiving window iconification events</li>
|
<li>Added <code>glfwSetWindowIconifyCallback</code> function and <code>GLFWwindowiconifyfun</code> type for receiving window iconification events</li>
|
||||||
|
<li>Added <code>glfwGetCurrentWindow</code> function for retrieving the window whose OpenGL context is current</li>
|
||||||
<li>Added <code>windows</code> simple multi-window test program</li>
|
<li>Added <code>windows</code> simple multi-window test program</li>
|
||||||
<li>Added <code>sharing</code> simple OpenGL object sharing test program</li>
|
<li>Added <code>sharing</code> simple OpenGL object sharing test program</li>
|
||||||
<li>Added a parameter to <code>glfwOpenWindow</code> for specifying a context the new window's context will share objects with</li>
|
<li>Added a parameter to <code>glfwOpenWindow</code> for specifying a context the new window's context will share objects with</li>
|
||||||
|
16
src/window.c
16
src/window.c
@ -639,6 +639,22 @@ GLFWAPI int glfwIsWindow(GLFWwindow window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
// Returns GL_TRUE if the specified window handle is an actual window
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
GLFWAPI GLFWwindow glfwGetCurrentWindow(void)
|
||||||
|
{
|
||||||
|
if (!_glfwInitialized)
|
||||||
|
{
|
||||||
|
_glfwSetError(GLFW_NOT_INITIALIZED);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _glfwLibrary.currentWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Set hints for opening the window
|
// Set hints for opening the window
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
@ -72,6 +72,11 @@ static GLuint create_texture(void)
|
|||||||
|
|
||||||
static void draw_quad(GLuint texture)
|
static void draw_quad(GLuint texture)
|
||||||
{
|
{
|
||||||
|
int width, height;
|
||||||
|
glfwGetWindowSize(glfwGetCurrentWindow(), &width, &height);
|
||||||
|
|
||||||
|
glViewport(0, 0, width, height);
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
gluOrtho2D(0.f, 1.f, 0.f, 1.f);
|
gluOrtho2D(0.f, 1.f, 0.f, 1.f);
|
||||||
|
Loading…
Reference in New Issue
Block a user