freebsd 8.0 + gcc (glRotatef() )

Hi i have make a project , this is my code :

#include <GL/glut.h>    // Header File For The GLUT Library 
#include <GL/gl.h>	// Header File For The OpenGL32 Library
#include <GL/glu.h>	// Header File For The GLu32 Library
#include <unistd.h>     // Header file for sleeping.
#include <stdio.h>      // Header file for standard file i/o.
#include <stdlib.h>     // Header file for malloc/free.

GLvoid DrawGLScene(GLvoid);
GLvoid ReSizeGLScene(GLsizei,GLsizei);
GLvoid InitGL(GLsizei,GLsizei);
void f(int,char**);
void f2(void);
void f22(void);
void f3(void);
/* The number of our GLUT window */
int window; 
GLfloat z=-5.0f; // depth into the screen.
/* white ambient light at half intensity (rgba) */
GLfloat LightAmbient[] = { 0.5f, 0.5f, 0.5f, 1.0f };
/* super bright, full intensity diffuse light. */
GLfloat LightDiffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
/* position of light (x, y, z, (position of light)) */
GLfloat LightPosition[] = { 0.0f, 0.0f, 2.0f, 1.0f };

int main(int argc, char **argv) 
{  
    f(argc,argv);

    return 0;
}
/* A general OpenGL initialization function.  Sets all of the initial parameters. */
GLvoid InitGL(GLsizei Width, GLsizei Height)	// We call this right after our OpenGL window is created.
{
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);	// This Will Clear The Background Color To Black
    glClearDepth(1.0);				// Enables Clearing Of The Depth Buffer
    glDepthFunc(GL_LESS);			// The Type Of Depth Test To Do
    glEnable(GL_DEPTH_TEST);			// Enables Depth Testing
    glShadeModel(GL_SMOOTH);			// Enables Smooth Color Shading
    
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();				// Reset The Projection Matrix
    
    gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.1f,100.0f);	// Calculate The Aspect Ratio Of The Window
    
    glEnable(GL_CULL_FACE);
    glEnable(GL_FRONT);
    
    glMatrixMode(GL_MODELVIEW);

    // set up light number 1.
    glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);  // add lighting. (ambient)
    glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);  // add lighting. (diffuse).
    glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // set light position.
    glEnable(GL_LIGHT1);                             // turn light 1 on.
}
/* The function called when our window is resized (which shouldn't happen, because we're fullscreen) */
GLvoid ReSizeGLScene(GLsizei Width, GLsizei Height)
{
    if (Height==0)				// Prevent A Divide By Zero If The Window Is Too Small
	Height=1;

    glViewport(0, 0, Width, Height);		// Reset The Current Viewport And Perspective Transformation

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.1f,100.0f);
    glMatrixMode(GL_MODELVIEW);
}

/* The main drawing function. */
GLvoid DrawGLScene(GLvoid)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);		// Clear The Screen And The Depth Buffer
    glLoadIdentity();				// Reset The View
    glPushMatrix();
         f3(); 
      glPopMatrix();  
    
    // since this is double buffered, swap the buffers to display what just got drawn.
    glutSwapBuffers();
}
void f(int argc, char **argv){
   /* Initialize GLUT state - glut will take any command line arguments that pertain to it or 
       X Windows - look at its documentation at http://reality.sgi.com/mjk/spec3/spec3.html */  
    glutInit(&argc, argv);  

    /* Select type of Display mode:   
     Double buffer 
     RGBA color
     Alpha components supported 
     Depth buffer */  
    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);  

    /* get a 640 x 480 window */
    glutInitWindowSize(640, 480);  

    /* the window starts at the upper left corner of the screen */
    glutInitWindowPosition(0, 0);  

    /* Open a window */  
    window = glutCreateWindow("--------------------------------------------------------");  

    /* Register the function to do all our OpenGL drawing. */
    glutDisplayFunc(&DrawGLScene);  

    /* Even if there are no events, redraw our gl scene. */
    glutIdleFunc(&DrawGLScene);

    /* Register the function called when our window is resized. */
    glutReshapeFunc(&ReSizeGLScene);

    /* Initialize our window. */
    InitGL(640, 480);
  
    /* Start Event Processing Engine */  
    glutMainLoop(); 

}
void f2(void){
 
  glBegin(GL_QUADS);				
  glColor3f(0.0f,1.0f,0.0f);			// Set The Color To Blue
  glVertex3f( 1.0f, 1.0f,-1.0f);		// Top Right Of The Quad (Top)
  glVertex3f(-1.0f, 1.0f,-1.0f);		// Top Left Of The Quad (Top)
  glVertex3f(-1.0f, 1.0f, 1.0f);		// Bottom Left Of The Quad (Top)
  glVertex3f( 1.0f, 1.0f, 1.0f);		// Bottom Right Of The Quad (Top)

  // bottom of cube
  glColor3f(1.0f,0.5f,0.0f);			// Set The Color To Orange
  glVertex3f( 2.0f,-1.0f, 1.0f);		// Top Right Of The Quad (Bottom)
  glVertex3f(-2.0f,-1.0f, 1.0f);		// Top Left Of The Quad (Bottom)
  glVertex3f(-2.0f,-1.0f,-1.0f);		// Bottom Left Of The Quad (Bottom)
  glVertex3f( 2.0f,-1.0f,-1.0f);		// Bottom Right Of The Quad (Bottom)

  // front of cube
  glColor3f(1.0f,0.0f,0.0f);			// Set The Color To Red
  glVertex3f( 1.0f, 1.0f, 1.0f);		// Top Right Of The Quad (Front)
  glVertex3f(-1.0f, 1.0f, 1.0f);		// Top Left Of The Quad (Front)
  glVertex3f(-2.0f,-1.0f, 1.0f);		// Bottom Left Of The Quad (Front)
  glVertex3f( 2.0f,-1.0f, 1.0f);		// Bottom Right Of The Quad (Front)

  // back of cube.
  glColor3f(1.0f,1.0f,0.0f);			// Set The Color To Yellow
  glVertex3f( 2.0f,-1.0f,-1.0f);		// Top Right Of The Quad (Back)
  glVertex3f(-2.0f,-1.0f,-1.0f);		// Top Left Of The Quad (Back)
  glVertex3f(-1.0f, 1.0f,-1.0f);		// Bottom Left Of The Quad (Back)
  glVertex3f( 1.0f, 1.0f,-1.0f);		// Bottom Right Of The Quad (Back)

  // left of cube
  glColor3f(0.0f,0.0f,1.0f);			// Blue
  glVertex3f(-1.0f, 1.0f, 1.0f);		// Top Right Of The Quad (Left)
  glVertex3f(-1.0f, 1.0f,-1.0f);		// Top Left Of The Quad (Left)
  glVertex3f(-2.0f,-1.0f,-1.0f);		// Bottom Left Of The Quad (Left)
  glVertex3f(-2.0f,-1.0f, 1.0f);		// Bottom Right Of The Quad (Left)

  // Right of cube
  glColor3f(1.0f,0.0f,1.0f);			// Set The Color To Violet
  glVertex3f( 1.0f, 1.0f,-1.0f);	        // Top Right Of The Quad (Right)
  glVertex3f( 1.0f, 1.0f, 1.0f);		// Top Left Of The Quad (Right)
  glVertex3f( 2.0f,-1.0f, 1.0f);		// Bottom Left Of The Quad (Right)
  glVertex3f( 2.0f,-1.0f,-1.0f);		// Bottom Right Of The Quad (Right)
  glEnd();					// Done Drawing The Cube
     
}
 void f22(void){
     glPushMatrix(); 
	   glTranslatef(0,0,-35);  
	         f2();
    glPopMatrix();
    glPushMatrix();
        glTranslatef(2.3,1.2,-35);
	glRotatef(55,0,0,1);
	         f2();
    glPopMatrix();
    glPushMatrix();
        glTranslatef(-2.3,1.2,-35);
	glRotatef(-55,0,0,1);
	         f2();
    glPopMatrix();}
  
 void f3(void){
   
   f22();
      glRotatef(180,0,0,1);
      glTranslatef(0,-4.6,0);
          f22();}
  

evriting is fine but how i can rotate that figure whit 90 grade at the y axis ? if i try

 GLvoid DrawGLScene(GLvoid)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);		// Clear The Screen And The Depth Buffer
    glLoadIdentity();				// Reset The View
glPushMatrix();
       [b]glRotatef(90,0,1,0);[/b]
        f3(); 
      glPopMatrix();  
    
    // since this is double buffered, swap the buffers to display what just got drawn.
    glutSwapBuffers();
}

the figure disappear , what i do wrong?

Read up on eye space in the OpenGL Programming Guide (search for the section titled “The Viewing Transformation”). You didn’t put a viewing transform (e.g. gluLookAt) on the bottom of the MODELVIEW matrix, so by default your viewing transform is the identity. That means your eyepoint is at the world-space origin (0,0,0) looking down the negative Z axis with X right and Y up.

If something is displaying now and it’s right in front of you, it has an X,Y of ~0,0, and a Z value that is < -near_val, where near_val is your near clip plane value (0.1f). So it’s center is somewhere around (0,0,-zval). Rotate that around the Y axis by 90 degrees, and guess where it goes? :wink:

Off topic, but why are you using FreeBSD? When I was using it, I spent more time maintaining (updating, etc…) than coding.