PDA

View Full Version : world-to-screen



playmesumch00ns
01-31-2002, 09:47 AM
Hi, I'm writing a painterly renderer along the lines of various papers by others. I'm doing this by placing particles on geometry and then I need to transform those particles co-ordinates to screen space in order to paint strokes.
I've got as far as:
MatrixMultiply(particleposition * GL_MODELVIEW_MATRIX);
MatrixMultiply(particleposition * GL_PROJECTION_MATRIX);

but then I'm stuck. If I've got say a sphere going backwards and forwards across a 500 pixel wide screen, I get values roughly between -10 and 10 in the x part of the resulting vector. Can I assume that scaling this figure to 0 - 499 will give me the right answer in screen co-ordinates? I'm not sure..or is there some other transformation I need to do?

Thanks,

Anders