hi all,
i’m newbie in openGL. I try to make a 3D office planner. I use Visual C++ 2008 Express Edition and latest version of openGL. I still don’t understand exactly how things work although I can draw/rotate/etc… objects. the thing that I want is to be able to select an object however I can’t successfully embed the codes I found on the net… Could you please help me about this situation? my main() and gfxinit() are above:
…
void main(int argc, char **argv)
{
glutInit(&argc,argv);
gfxInit();
glutDisplayFunc(drawScene);
glutKeyboardFunc(processKeyboard);
glutMotionFunc(processMouseMotion);
glutMouseFunc(processMouse);
glutMainLoop();
}
…
void gfxInit()
{
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowPosition(0,0);
glutInitWindowSize(winWidth,winHeight);
glutCreateWindow(“MyViewer”);
glShadeModel(GL_FLAT);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
glMatrixMode(GL_PROJECTION); // Set the current openGL matrix to GL_PROJECTION ie projection matrix.
glLoadIdentity(); // Load identity values in the above.
gluPerspective(70.0, (GLfloat)winWidth/(GLfloat)winHeight, 1.0, 500.0);
glMatrixMode(GL_MODELVIEW); // Change the current matrix mode to Model-View matrix.
glLoadIdentity();
glClearColor (0.0, 0.0, 0.0, 0.0); // Set the background color to black.
glEnable(GL_DEPTH_TEST);
glEnableClientState(GL_VERTEX_ARRAY);
}
…