mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Added channel sizes and formatting.
This commit is contained in:
parent
4e9c34952c
commit
56959bd075
@ -3,46 +3,45 @@
|
|||||||
// The program lists all available fullscreen video modes.
|
// The program lists all available fullscreen video modes.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <GL/glfw3.h>
|
#include <GL/glfw3.h>
|
||||||
|
|
||||||
// Maximum number of modes that we want to list
|
#include <stdio.h>
|
||||||
#define MAX_NUM_MODES 400
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
static void print_mode(GLFWvidmode* mode)
|
||||||
//========================================================================
|
|
||||||
// main()
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
int main( void )
|
|
||||||
{
|
{
|
||||||
GLFWvidmode dtmode, modes[ MAX_NUM_MODES ];
|
printf("%i x %i x %i (%i %i %i)\n",
|
||||||
int modecount, i;
|
mode->width, mode->height,
|
||||||
|
mode->redBits + mode->greenBits + mode->blueBits,
|
||||||
|
mode->redBits, mode->greenBits, mode->blueBits);
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize GLFW
|
int main(void)
|
||||||
if( !glfwInit() )
|
{
|
||||||
|
GLFWvidmode dtmode, modes[400];
|
||||||
|
int modecount, i;
|
||||||
|
|
||||||
|
if (!glfwInit())
|
||||||
{
|
{
|
||||||
return 0;
|
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show desktop video mode
|
// Show desktop video mode
|
||||||
glfwGetDesktopMode( &dtmode );
|
glfwGetDesktopMode(&dtmode);
|
||||||
printf( "Desktop mode: %d x %d x %d\n\n",
|
printf("Desktop mode: ");
|
||||||
dtmode.width, dtmode.height, dtmode.redBits +
|
print_mode(&dtmode);
|
||||||
dtmode.greenBits + dtmode.blueBits );
|
|
||||||
|
|
||||||
// List available video modes
|
// List available video modes
|
||||||
modecount = glfwGetVideoModes( modes, MAX_NUM_MODES );
|
modecount = glfwGetVideoModes(modes, sizeof(modes) / sizeof(GLFWvidmode));
|
||||||
printf( "Available modes:\n" );
|
printf("Available modes:\n");
|
||||||
for( i = 0; i < modecount; i ++ )
|
for (i = 0; i < modecount; i++)
|
||||||
{
|
{
|
||||||
printf( "%3d: %d x %d x %d\n", i,
|
printf("%3i: ", i);
|
||||||
modes[i].width, modes[i].height, modes[i].redBits +
|
print_mode(modes + i);
|
||||||
modes[i].greenBits + modes[i].blueBits );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Terminate GLFW
|
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user