/*
* FreeGLUT Shapes Demo
*
* Written by Nigel Stewart November 2003
*
* This program is test harness for the sphere, cone
* and torus shapes in FreeGLUT.
*
* Spinning wireframe and smooth shaded shapes are
* displayed until the ESC or q key is pressed. The
* number of geometry stacks and slices can be adjusted
* using the + and - keys.
*/
#include<GL/glut.h>
#include<stdlib.h>
void init()
{
glClearColor(1.0, 1.0, 1.0, 0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0.0, 100.0, 0.0, 100.0);
}
void drawLine()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor4f(0.0, 0.5, 0.0, 0.5);
glBegin(GL_TRIANGLES);
glVertex2i(0, 0);
glColor4f(0.5, 0.0, 0.0, 0.5);
glVertex2i(50, 90);
glColor4f(0.0, 0.0, 0.5, 0.5);
glVertex2i(90, 50);
glEnd();
glFlush();
}
void main()
{
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(200, 200);
glutInitWindowSize(150, 500);
glutCreateWindow("an example opengl program");
init();
glutDisplayFunc(drawLine);
glutMainLoop();
}
* FreeGLUT Shapes Demo
*
* Written by Nigel Stewart November 2003
*
* This program is test harness for the sphere, cone
* and torus shapes in FreeGLUT.
*
* Spinning wireframe and smooth shaded shapes are
* displayed until the ESC or q key is pressed. The
* number of geometry stacks and slices can be adjusted
* using the + and - keys.
*/
#include<GL/glut.h>
#include<stdlib.h>
void init()
{
glClearColor(1.0, 1.0, 1.0, 0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0.0, 100.0, 0.0, 100.0);
}
void drawLine()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor4f(0.0, 0.5, 0.0, 0.5);
glBegin(GL_TRIANGLES);
glVertex2i(0, 0);
glColor4f(0.5, 0.0, 0.0, 0.5);
glVertex2i(50, 90);
glColor4f(0.0, 0.0, 0.5, 0.5);
glVertex2i(90, 50);
glEnd();
glFlush();
}
void main()
{
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(200, 200);
glutInitWindowSize(150, 500);
glutCreateWindow("an example opengl program");
init();
glutDisplayFunc(drawLine);
glutMainLoop();
}