Hey, i’m converting one of my projects to opengl from a crappy graphics library, adn thought i could take advantage of opengl’s rotation rather than calculating it myself like i had to.
basically i have a few vertices (2000) that i would like to rotate in 3d space (without perspective) (which works) but i’d like to be able to know the ‘2d coordinates i guess’ of where they appear on the screen, so i can find the closest vertex to the cursor and select it
i hope that makes sense without having to explain too much
Have a look at chapter 4.2 of the GLU manual.
Basically, the project function multiplies the projection matrix, the modelview matrix and the 3D vertex (in that order) which return the screen coordinates in the range [-1,1]x[-1,1]. These are then scaled and translated to fit the viewport.
wow, quick answer, and thanks. i was trying to see how far i could go without GLUT, only as far as asteroids and pong i suppose.
Indeed, glut only creates an opengl context/window with event handlers so that you can control what happens on keyboard input, window reshape, mouse movement, idle time,etc.
The limited collection of geometric primitives such as solidSphere are just extras, mainly used in tutorials on how to use glut.
Yes, think of GLUT as sort of the “PDF” of OpenGL. It’s a great way to share ideas, without getting bogged down in gory boilerplate OS/GUI details (eeek!).