title: gluProject() setup in OpenGL VC++ beginner
body: <p>I'm trying to convert 3D to 2D coordinates. and I understand I need to use <code>gluProject()</code>. But I'm facing troubles setting it up. I need to use Pixel coordinates</p>
  
  <p>I need help in <code>InitGL()</code> how can I properly initialize it. also in <code>DrawGLScene()</code> how can use it? I need to keep the <code>z</code> variable for making layers so I don't want to disable it. </p>
  
  <p>This is my code:</p>
  
  <pre><code>#ifdef WIN32
  #define WIN32_LEAN_AND_MEAN
  #include &lt;windows.h&gt;
  #endif
  #if defined(__APPLE__) &amp;&amp; defined(__MACH__)
  #include &lt;OpenGL/gl.h&gt;  // Header File For The OpenGL32 Library
  #include &lt;OpenGL/glu.h&gt; // Header File For The GLu32 Library
  #else
  #include &lt;GL/gl.h&gt;  // Header File For The OpenGL32 Library
  #include &lt;GL/glu.h&gt; // Header File For The GLu32 Library
  #endif
  
  #include "SDL.h"   // SDL library for managing input and window management (multipltform)
  #include "SOIL.h"  // SOIL library for loading textures (multiplatform)
  
  const int WINDOW_WIDTH = 640;
  const int WINDOW_HEIGHT = 480;
  const char* WINDOW_TITLE = "RB Game Engine";
  
  float position=0;
  GLuint  texture[1];  // number of texture = 1
  
  
  /* A general OpenGL initialization function.  Sets all of the initial parameters. */
  void InitGL(int Width, int Height)          // We call this right after our OpenGL window is created.
  {
    LoadGLTextures();                                 // Jump To Texture Loading Routine ( NEW )
    glEnable(GL_TEXTURE_2D);                          // Enable Texture Mapping ( NEW )
    glViewport(0, 0, Width, Height);
    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
  
    glMatrixMode(GL_MODELVIEW);
  }
  
  /* The main drawing function. */
  void DrawGLScene()
  {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);       // Clear The Screen And The Depth Buffer
    glLoadIdentity();             // Reset The View
  
  
    glTranslatef(0.0f,0.0f,-6.0f);                // Move Right 3 Units
    glBindTexture(GL_TEXTURE_2D, texture[0]); 
    // draw a square (quadrilateral)
    glBegin(GL_QUADS);                // start drawing a polygon (4 sided)
          glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f+position, -1.0f,  1.0f);
          glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f+position, -1.0f,  1.0f);
          glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f+position,  1.0f,  1.0f);
          glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f+position,  1.0f,  1.0f);
    glEnd();                  // done with the polygon
  
  
  
    // swap buffers to display, since we're double buffered.
    SDL_GL_SwapBuffers();
  }
  </code></pre>