mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 05:36:35 +00:00
example update
This commit is contained in:
parent
d59edcfc83
commit
134505685e
@ -1125,12 +1125,19 @@ static void count_fps()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void error_callback(int error, const char* description)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
|
}
|
||||||
|
|
||||||
/* program entry */
|
/* program entry */
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GLFWwindow* window;
|
GLFWwindow* window;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
if( !glfwInit() )
|
if( !glfwInit() )
|
||||||
{
|
{
|
||||||
fprintf( stderr, "Failed to initialize GLFW\n" );
|
fprintf( stderr, "Failed to initialize GLFW\n" );
|
||||||
@ -1142,14 +1149,13 @@ int main(int argc, char *argv[])
|
|||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||||
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
||||||
|
|
||||||
window = glfwCreateWindow( 300, 300, "Gears GLES2", glfwGetPrimaryMonitor(), NULL );
|
window = glfwCreatePositionedWindow( 100, 100, 500, 500, "Gears GLES2", NULL /*glfwGetPrimaryMonitor()*/, NULL );
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
fprintf( stderr, "Failed to open GLFW window\n" );
|
fprintf( stderr, "Failed to open GLFW window\n" );
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
glfwSetWindowPos( window, 100, 100 );
|
|
||||||
|
|
||||||
// Set callback functions
|
// Set callback functions
|
||||||
glfwSetFramebufferSizeCallback(window, reshape);
|
glfwSetFramebufferSizeCallback(window, reshape);
|
||||||
|
Loading…
Reference in New Issue
Block a user