Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
hello-gl/hello-gl-dummy.c
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
56 lines (47 sloc)
932 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <GL/glew.h> | |
#ifdef __APPLE__ | |
# include <GLUT/glut.h> | |
#else | |
# include <GL/glut.h> | |
#endif | |
#include <stdio.h> | |
static int make_resources(void) | |
{ | |
return 1; | |
} | |
/* | |
* GLUT callbacks: | |
*/ | |
static void update_fade_factor(void) | |
{ | |
} | |
static void render(void) | |
{ | |
glClearColor(1.0f, 1.0f, 1.0f, 1.0f); | |
glClear(GL_COLOR_BUFFER_BIT); | |
glutSwapBuffers(); | |
} | |
/* | |
* Entry point | |
*/ | |
int main(int argc, char** argv) | |
{ | |
glutInit(&argc, argv); | |
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); | |
glutInitWindowSize(400, 300); | |
glutCreateWindow("Hello World"); | |
glutIdleFunc(&update_fade_factor); | |
glutDisplayFunc(&render); | |
glewInit(); | |
if (!GLEW_VERSION_2_0) { | |
fprintf(stderr, "OpenGL 2.0 not available\n"); | |
return 1; | |
} | |
if (!make_resources()) { | |
fprintf(stderr, "Failed to load resources\n"); | |
return 1; | |
} | |
glutMainLoop(); | |
return 0; | |
} | |