PDA

View Full Version : Help!


gnumdk
February 19th, 2007, 02:04 PM
glPushMatrix ();
glTranslatef (-0.5f, -0.5f, -DEFAULT_Z_CAMERA);
glScalef (1.0f / s->width, -1.0f / s->height, 1.0f);
glTranslatef (0.0f, -s->height, 0.0f);


This code come frome resize plugin (imported from beryl).
Can someone explain me what this is doing, i really don't understand!

What glPushMatrix () do in a compiz context?

mikedee
February 19th, 2007, 02:26 PM
I am no expert but basically the push and pop matrix commands are necessary so that plugins do not interfere with each other.

Have a look at the triangle plugin for a basic gl operation. You must start with glPushMatrix and end with glPopMatrix or bad things will happen.

You can see the cleanup code in resize, it makes sure that the gl state is set back correctly.

That particular piece of code looks like it is aligning the opengl coordinates with screen pixels. There is a function in compiz to do that called prepareXCoords - it is marked that it will be removed soon, but I dont know what it will be replaced with.

maniac
February 19th, 2007, 03:52 PM
That particular piece of code looks like it is aligning the opengl coordinates with screen pixels. There is a function in compiz to do that called prepareXCoords - it is marked that it will be removed soon, but I dont know what it will be replaced with.
It will be replaced by transformToScreenSpace.

Just use the latest Beryl resize.c - you'll even get proper usage of the resize increment and aspect ratio hints.
If you like that, please do fe the favour and rant a bit less about Beryl ;)