Skip to content

Instantly share code, notes, and snippets.

@fegemo
Last active July 30, 2023 22:06
Show Gist options
  • Save fegemo/ddfa33441281e564eefe to your computer and use it in GitHub Desktop.
Save fegemo/ddfa33441281e564eefe to your computer and use it in GitHub Desktop.
Um Hello World em OpenGL usando C e GLUT.
#include <GL/freeglut.h>
void desenhaMinhaCena(void)
{
glClearColor(1, 1, 1, 1);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLE_FAN);
glVertex3f(-0.5, -0.5, 0.0);
glVertex3f( 0.5, -0.5, 0.0);
glVertex3f( 0.5, 0.5, 0.0);
glVertex3f(-0.5, 0.5, 0.0);
glEnd();
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(500, 500);
glutCreateWindow("Hello World");
glutDisplayFunc(desenhaMinhaCena);
glutMainLoop();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment