im finding opengl difficult, i have to make a 3d program in it, its like a set of rooms with objects in,
well i need to get everything set up, but im having problems setting everything up, it needs to be double buffered. i cant figure out how to get the screen to show a view where i can get a room drawn
then i need to make some controls to manipulate around various axes (rotating) and i want to translate as well, with the keyboard but i cant figure this out, ive tried the keyboard function but i just dont know what codes to type in
the red book isnt much help its all really cryptic, and ive tried various sites but a lot of it is in really hard to understand terms, and much more advanced stuff that ive covered yet
could anyone provide any advice on this? i really need some pointers on this, such as what i should basically be doing to get something up and running, its very confusing im really confused here guys
have you tried http://nehe.gamedev.net[\URL]? they have some pretty good examples. I haven’t seen the redbook myself, so I don’t know how well it works.
also has some good tutorials.
for double buffering, you can use:
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); at the begining of your program. the most important part of that line was the GLUT_DOUBLE. using GLUT_SINGLE would enable single buffering.
to actually use the double-buffer, use glutSwapBuffers(); at the end of your main drawing routing.
to navigate and rotate, you’ll have to have a persistent data object to store the camera’s position and orientation. for position, an array of 3 floats should more than suffice. 2 or 3 variables (type float, probably) should be fine to remember the rotations (unless you want space-sim like motion, then you should look into quaternions). In your keyboard function, just increase or decrease the camera’s position vector. Then, glTranslate to the camera’s position in your main drawing routine.