I am a newbie in using opengl, i do not know why my code do not show any of the drawings, I appreciate if anyone can help,thanks~
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Specification:
//
//
//
////////////////////////////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <GL/glut.h>
//////////////////////////////////////////////////////////////////
//
// Include the header file of our rotation user-interface.
//
#include “gsrc.h”
//
//////////////////////////////////////////////////////////////////
#define PI 3.141592654
void cube(){
GLint viewport[4];
glGetIntegerv( GL_VIEWPORT, viewport );
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective( 45, double(viewport[2])/viewport[3], 0.1, 10 );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt( 0,0,3, 0,0,0, 0,1,0 );
//glMultMatrixf( gsrc_getmo() ); // get the rotation matrix from the rotation user-interface
//
//////////////////////////////////////////////////////////////////
glClearColor(1,1,1,1);
glClear(GL_COLOR_BUFFER_BIT); // Clear display window.
glColor3f(1,0,0); // Set line segment color to red.
glPushMatrix();
glutSolidCube(2.0);
glPopMatrix();
}
void main (int argc, char** argv)
{
//cube();
glutInit(&argc, argv);
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB ); // Set display mode.
glutInitWindowPosition( 50, 100 ); // Set top-left display-window position.
glutInitWindowSize( 400, 300 ); // Set display-window width and height.
glutCreateWindow( “OpenGL Program for tutorial 2” ); // Create display window.
glutDisplayFunc(cube);
glutMainLoop(); // Display everything and wait.
}