Advertisement Jump to content

Archived

This topic is now archived and is closed to further replies.

JClayton

Rendering Pipeline Error

This topic is 5339 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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...

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!