|
#include <windows.h> // Standard windows include
#include <gl\gl.h> // OpenGL library
#include <gl\glut.h> // glut library
#define GL_PI 3.1415f
#include <math.h>
#include "stdio.h"
void SetupRC( void )
{
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glColor3f( 0.0f, 1.0f, 0.0f );
}
void RenderScene(void)
{
// Set background clearing color to blue
// Clear the window with current clearing color
GLfloat x,y,z,angle,xRot,yRot;
xRot =0.0f;
yRot =0.0f;
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glRotatef( xRot, 1.0f, 0.0f, 0.0f );
glRotatef( yRot, 0.0f, 1.0f, 0.0f );
glBegin( GL_POINTS);
z = -50.0f;
for(angle = 0.0f; angle <= (2.0f*GL_PI)*3.0f; angle += 0.1f)
{
x = 50.0f*sin(angle);
y = 50.0f*cos(angle);
// Specify the point and move the Z value up a little
glVertex3f(x, y, z);
z += 0.5f;
}
// Done drawing points
glEnd();
// Restore transformations
glPopMatrix();
// Flush drawing commands
glFlush();
}
// Main body of program
void main(void)
{
// AUX window setup and initialization
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("points example ");
glutDisplayFunc( RenderScene );
// Set function to call when window is resized
SetupRC();
// Start main loop
glutMainLoop();
} |
|