PDA

View Full Version : distorted screen



sust86
08-24-2009, 11:29 AM
Hi guys,
i am working on a compiz plugin which should remove a distorted view on my screen. Therefore the idea is to rotate the screenimage depending in which direction the user is moving. Thus, if the user is moving to the right side of the monitor, the desktopsurface is rotating in positiv direction to the Y-axis. In order to obtain a correct view of the image, the anchor of the rotation should be in the middle on the left side of the monitor. (eg. x = 0, y = 620 )
The problem is now: Everytime the user is changing its position, i have to set a new rotation anchor (so i have to translate the image until the new anchor is in the middle of the screen, and then set a new viewport to see the whole desktop. For example, if the user is moving left, the anchor should be the right side of the screen. If the user is going down the anchor should be on the top, and the rotation axis should be the x axis.
Thats not really a nice solution...
Another idea is to solve the problem with gluLookAt().
I know the parameter of the function but i don't really now how to use them in the right way, to get the desired rotation and view.
Here are a few code snippets of the (imho) important parts of my code. The whole code would be a little bit too confusing ^^



glMatrixMode(GL_PROJECTION);
glLoadIdentity();

// Anchor should be left side of the screen
glFrustum(0, 1680, 600, -600, 999.9, 2000);


glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, -1200.0, -1000.0); // move image to the center of the y axis
gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz);

glBegin(GL_POLYGON);
{
glVertex2f(pixel->x, pixel->y);
}
glEnd()

//Points:
//x: 0.00000 - y: 1250.000000
//x: 1680.0000 - y: 1250.00000
//x: 1680.0000 - y: 0.000000
//x: 0.000000 - y: 0.000000


Sorry for my bad english. Hope anybody can help me!
best regards.

ZbuffeR
08-24-2009, 01:11 PM
I hardly understand what you want to do.
If if is difficult in english, try to post images to visually explain your goal.

DO you want to do something like this ?
http://www.cs.washington.edu/homes/peter/fishbowl/index.html