Skip to main content
gamedev.net
🔒 Locked

Rendering Pipeline Error

Started by JClayton Jun 7, 2004 at 12:59 AM 0 replies 250+ views
Original Post
JClayton
JClayton
I am working on the rendering code for our engine and I am having problems with rastering non-geometric objects such as bitmpas and fonts. The pipeline code is as follows:
glLoadIdentity();	
  
  glPushMatrix();
    
    // position the camera

    gluLookAt(wnd->GetCamera()->m_position.x, wnd->GetCamera()->m_position.y,  
        wnd->GetCamera()->m_position.z,	wnd->GetCamera()->m_view.x,	  
        wnd->GetCamera()->m_view.y, wnd->GetCamera()->m_view.z,	wnd->GetCamera()->m_up.x, 
        wnd->GetCamera()->m_up.y, wnd->GetCamera()->m_up.z);
  	
  	wnd->DrawGrid();
  	
  	glPushMatrix();
  	 // move to the center of the camera view 

     glTranslatef(wnd->GetCamera()->m_view.x, 0, wnd->GetCamera()->m_view.z);
     auxSolidSphere(0.5);
    glPopMatrix();
  	
  glPopMatrix();
  
  // Prepare to draw 2D

  RECT window;
  GetClientRect(wnd->GetHWND(), &window);
  glMatrixMode(GL_PROJECTION);
  
  glPushMatrix();
    glLoadIdentity();
    
    glOrtho(0, window.right, window.bottom, 0, 0.1f, 2);
    glMatrixMode(GL_MODELVIEW);	
    
    wnd->GetParentGUI()->Draw(); 
    
    glMatrixMode(GL_PROJECTION);
  glPopMatrix();
  
  glMatrixMode(GL_MODELVIEW);	
  
  glFlush();
	
	float secs = wnd->GetTimer().GetElapsedSeconds();
  
  // bring back buffer to the foreground

  SwapBuffers(wnd->GetHDC());
When I attempt to add a segment of code that, for example, draws a cursor within the ortho portion of the pipeline... it fails to draw to the screen.
glPushMatrix();
    glLoadIdentity();
    
    glOrtho(0, window.right, window.bottom, 0, 0.1f, 2);
    glMatrixMode(GL_MODELVIEW);	
    
    wnd->GetParentGUI()->Draw(); 
    
    glRasterPos2f(100, 100);
    glDrawPixels(g_cursor.width, g_cursor.height, GL_RGB, GL_UNSIGNED_BYTE, g_cursor.data);
    
    glMatrixMode(GL_PROJECTION);
  glPopMatrix();
I have tested various z-depths (all of which are within the fustrum), as well as multiple x , y positions and also rastering with glRasterPos3f() but none seem to work...
GameCat
GameCat
The rasterpos is transformed by the current modelview matrix, so you should set modelview to identity if you want the rasterpos to be given in eye space.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.