C++ OpenGL Cube not showing up on screen -


hey first post on stackflow bare me. have been attempting use opengl c++ lately , have come cross problem when trying render cube lighting...but doesn't appear believe due kinda of clipping error have no clue :( appreciated.

here code...

the initialization function...

glmatrixmode(gl_modelview); glloadidentity(); glenable(gl_depth_test); glenable(gl_color_material); glenable(gl_lighting); //enable lighting glenable(gl_light0); //enable light #0 glenable(gl_light1); //enable light #1 glenable(gl_normalize); //automatically normalize normals 

and here draw code

 glclear(gl_color_buffer_bit | gl_depth_buffer_bit);  gltranslatef(0.0f, 0.0f, -8.0f);  //add ambient light glfloat ambientcolor[] = {0.2f, 0.2f, 0.2f, 1.0f}; //color (0.2, 0.2, 0.2) gllightmodelfv(gl_light_model_ambient, ambientcolor);  //add positioned light glfloat lightcolor0[] = {0.5f, 0.5f, 0.5f, 1.0f}; //color (0.5, 0.5, 0.5) glfloat lightpos0[] = {4.0f, 0.0f, 8.0f, 1.0f}; //positioned @ (4, 0, 8) gllightfv(gl_light0, gl_diffuse, lightcolor0); gllightfv(gl_light0, gl_position, lightpos0);  //add directed light glfloat lightcolor1[] = {0.5f, 0.2f, 0.2f, 1.0f}; //color (0.5, 0.2, 0.2) //coming direction (-1, 0.5, 0.5) glfloat lightpos1[] = {-1.0f, 0.5f, 0.5f, 0.0f}; gllightfv(gl_light1, gl_diffuse, lightcolor1); gllightfv(gl_light1, gl_position, lightpos1);  glrotatef(rotation, 0.0f, 1.0f, 0.0f); glcolor3f(1.0f, 1.0f, 0.0f); glbegin(gl_quads);  //front glnormal3f(0.0f, 0.0f, 1.0f); //glnormal3f(-1.0f, 0.0f, 1.0f); glvertex3f(-1.5f, -1.0f, 1.5f); //glnormal3f(1.0f, 0.0f, 1.0f); glvertex3f(1.5f, -1.0f, 1.5f); //glnormal3f(1.0f, 0.0f, 1.0f); glvertex3f(1.5f, 1.0f, 1.5f); //glnormal3f(-1.0f, 0.0f, 1.0f); glvertex3f(-1.5f, 1.0f, 1.5f);  //right glnormal3f(1.0f, 0.0f, 0.0f); //glnormal3f(1.0f, 0.0f, -1.0f); glvertex3f(1.5f, -1.0f, -1.5f); //glnormal3f(1.0f, 0.0f, -1.0f); glvertex3f(1.5f, 1.0f, -1.5f); //glnormal3f(1.0f, 0.0f, 1.0f); glvertex3f(1.5f, 1.0f, 1.5f); //glnormal3f(1.0f, 0.0f, 1.0f); glvertex3f(1.5f, -1.0f, 1.5f);  //back glnormal3f(0.0f, 0.0f, -1.0f); //glnormal3f(-1.0f, 0.0f, -1.0f); glvertex3f(-1.5f, -1.0f, -1.5f); //glnormal3f(-1.0f, 0.0f, -1.0f); glvertex3f(-1.5f, 1.0f, -1.5f); //glnormal3f(1.0f, 0.0f, -1.0f); glvertex3f(1.5f, 1.0f, -1.5f); //glnormal3f(1.0f, 0.0f, -1.0f); glvertex3f(1.5f, -1.0f, -1.5f);  //left glnormal3f(-1.0f, 0.0f, 0.0f); //glnormal3f(-1.0f, 0.0f, -1.0f); glvertex3f(-1.5f, -1.0f, -1.5f); //glnormal3f(-1.0f, 0.0f, 1.0f); glvertex3f(-1.5f, -1.0f, 1.5f); //glnormal3f(-1.0f, 0.0f, 1.0f); glvertex3f(-1.5f, 1.0f, 1.5f); //glnormal3f(-1.0f, 0.0f, -1.0f); glvertex3f(-1.5f, 1.0f, -1.5f);  glend();          swapbuffers(hdc);          sleep (1); 

any appreciated

edit one
after following advice of keith attempted use glulookat this...

void glulookat  (   10.0 , 10.0 , 10.0 , 1.5, -1.0, 1.5, 0.0, 0.0, 1.0 ); 

but error

|74|error: variable or field `glulookat' declared void|

final edit
everyone...it turned out fail :( hadn't declared translation...or perceptive..along other crucial components...but got working :d , keith no how control camera

after edit: glulookat function glvertex3f , such. therefore invoke calling:

glulookat(10.0 , 10.0 , 10.0 , 1.5, -1.0, 1.5, 0.0, 0.0, 1.0 ); 

note there no void involved in line of code!

what compiler sees if there void in front of line variable declaration named glulookat of type void initialized (constructed) bunch of doubles.


Comments