c++ - explanation of glFrustum() compared to gluLookAt() -


i'm debugging code want @ scan of depth image, camera setup doesn't let me see scan. thus, i'm playing around camera setups. create huge point @ (30,120,800) , can see using glulookat. according setup glfrustum(left, right, bottom, top, near, far)? using setup, point should lay in center, cannot see it.

void ondisplay() { glenable(gl_normalize); glenable(gl_depth_test); glmatrixmode(gl_projection); glloadidentity(); glmatrixmode(gl_modelview); glloadidentity(); glclearcolor( 1.0f, 1.0f, 1.0f, 1.0f ); glclear( gl_color_buffer_bit | gl_depth_buffer_bit ); gldisable(gl_cull_face); glpushmatrix(); glpointsize( 1111111116.0 ); glcolor3f( 0.25f, 0.907, 0.731f ); glloadidentity(); // set camera //glulookat(    30.f, 120.0f, 800.f, 30.f, 120.0f, 800.f, 0.0f, 1.f,  0.0f); //works glfrustum( 28, 32,     118,     122,   798,     802); glbegin( gl_points );   glvertex3f( 30, 120, 800 );    //30,120,800  glend();  glpopmatrix(); //glfinish(); //glutswapbuffers(); glutswapbuffers(); glutpostredisplay(); }  int main(int argc, char **argv) { // initialize glut glutinitwindowsize(800, 800);  glutinitdisplaymode(glut_double | glut_rgba | glut_depth);  glutinit(&argc, argv);  glutcreatewindow("headposedemo");   glutkeyboardfunc (processspecialkeys);  glutdisplayfunc(ondisplay); glutmainloop(); return 0; } 

the devil's in details: note how in documentation

nearval, farval

specify distances to near , far depth clipping planes. both distances must positive.

that's different wording use other parameters:

left, right

specify coordinates for left , right vertical clipping planes.

what you're expected know you're looking along negative z-axis. guess you're going see point when change glvertex3f(30.f, 120.f, -800.f);.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -