PDA

View Full Version : vertex's route from scene to screen (and sorry for my bad english)

reavertm
01-03-2004, 07:46 AM
h!
i have to write simple software 3d renderer and i want to do it in opengl way (without matrix stack so far), so i've go two matrices: projection and modelview, opengl keeps matrices in column-major order. all transformations are done (as i think) this way: M' = M * transform_matrix which is transposed (to be in column-major order)
so, let's imagine some object in local his coordinates. after multiplying by modelview matrix we'll have this object with world coordinates (am i right?)
so there is my first problem: how to do it (multiply) correctly (or how it's done by OpenGL)?
'v = M * v ? or maybe the are any transpositions/inversions needed (to matrix)?
after that, we have to project vertex on the screen (and i'm afraid it's more complicated)
and to be honest i don't understand exactly what to do.
i've got projection matrix (exact like after glFrustum or glOtho) and i have to multiply (yeah, same problem, is it the same situation ?)
after that, i have to (as i think) normalize (but how exactly?) these coordinates to screen coordinates (ok, i can do it like glViewport), but somethere i've found some dividing by w viewpoint' and i don't know what to do with it and where (after which step) to do it

please help

(do i have to add any clipping to triangle fill routine?)

thx for you attention

fuxiulian
01-03-2004, 03:45 PM
Get the opengl 1.5 specifications from the front page of opengl.org. You'll find all those transformations explained there

reavertm
01-03-2004, 06:40 PM
Originally posted by fuxiulian:

Get the opengl 1.5 specifications from the front page of opengl.org. You'll find all those transformations explained there

I think this is it.
I've missed normalization - this one can explain this dot on the center of the screen http://www.opengl.org/discussion_boards/ubb/smile.gif

thx a lot