All pastes #342870 Raw Edit

Something

public text v1 · immutable
·published 2007-02-06 16:34 UTC
rendered paste body
Apply screen Transform:
fullx = num_viewports_w;
fully = num_viewports_h;

calculate a screen transformation where the whole area [-0.5..fullx- 0.5][-0.5..fully - 0.5] can be displayed
apply the transformation
save the matrix
gltranslate(s->x / s->width,s->y / s->height);


PAINTING:


for all viewports
{
moveScreenViewport 
paint viewport;
-moveScreenViewport 
}

MOUSETRANSFORMATION:

mx/my = mouse position

unproject p1(mx,my,0) and p2(mx,my,-1)
calulate the vector v = p2' - p1'
find the pint pm there the line l = p1' + alpha v hits the plane at z = 0;
pm.x + 0.5;
pm.y + 0.5;
pm.x * screen->width
pm.y * screen->height

pm = mouse position