hi all, im new to openGL.
i want to draw 2 3Dcubes into a window h = 1000, w = 1000.
however i cant find a suitable way to give the Cubes X,Y and Z co-ords window cords.
i beleieve when glut opens a window (0,0) is top left ?
so i want to give Cube1 an X and Y of 100,100
and give Cube 2 900,900.
i also want to be able to input a keyboard command that will swap the 2 cubes positions.
Any ideas or advice about the best way to go about assigning window co-ords to cubes and a suitable way to change their positions would be greatly appreciated.
Thanks for your time.
Do you want to draw cubes or squares instead?
You seems to need a good tutorial about opengl basics. By default, Opengl consider that the origin of screen coordinates is a bottom left of the window.
Now in 3D, you give to opengl your cube coordinates in object space, meaning that its coordinates are defined in cube space which could be for example, from cube center or pivot point.
Then, you can apply some 3D transformations to your object, like translations, rotations,… these ones are set in the so called modelview matrix, which is coupled with the view matrix that transform coordinates in eye space (from the eye view point). It is only after all this, that coordinates are projected on screen and transformed in screen coordinates.
For more information about coordinates transformation, I suggest you to read the gl specification a the paragraph called “coordinates transformation”. Happy reading!
hii i need your help please in solving assignment of four faces unit cube my question is how to scramble the cube??
first, how about opening a new thread? second, your question is so badly formulated, i cant understand anything. write in more detail what you already have, what you want to achieve and what the actual problem is.