bool MainWindow::Reshape( long width, long height )
{
m_Width = width;
m_Height = height;
std::ostringstream temp;
temp << "{ width=" << width;
temp << ", height=" << height << " }";
m_Console.AddLine( temp.str() );
if( height < 1 ) // Prevent A Divide By Zero By
height=1;
::glViewport( 0, 0, (GLsizei)(width), (GLsizei)(height) );
::glMatrixMode( GL_PROJECTION );
::glLoadIdentity(); // Reset The Projection Matrix
::gluPerspective( m_FieldOfView, (GLfloat)(width)/(GLfloat)(height), // Calculate The Aspect Ratio Of The Window
0.010f, 1000.0f );
::glMatrixMode( GL_MODELVIEW ); // Select The Modelview Matrix
::glLoadIdentity();
return false;
}
Dimensions of the opengl world space.
I think u need frustum culling:
http://www.gametutorials.com/Tutorials/opengl/OpenGL_Pg5.htm
http://www.gametutorials.com/Tutorials/opengl/OpenGL_Pg5.htm
I need to do a calculation that will allow me to stick some numbers in a function and then find out where would the top left coordinate be in open gl coordinates.
If I give it the values I sent to gluperspective and a value for z then I should beable to calculate the dimensions and coordinates of the slice of the pyramid.
Look at the tutorial that the AP gave you a link to. It will tell you how to determine if a sphere or cube is in the frustum, and it's easy enough to make it work for polys.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement