summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--3d.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/3d.c b/3d.c
index c684e2e..ae9058f 100644
--- a/3d.c
+++ b/3d.c
@@ -640,18 +640,52 @@ tdPaintTransformedOutput(CompScreen * s,
{
tds->currentScale = tds->basicScale + (tdw->depth * ((1.0 - tds->basicScale) / tds->maxDepth));
(*s->applyScreenTransform) (s, sAttrib, output, &mTransform);
- s->enableOutputClipping (s, &mTransform, region, output);
+
+ //s->enableOutputClipping (s, &mTransform, region, output);
+
+ GLdouble h = s->height;
+
+ GLdouble p1[2] = { region->extents.x1, h - region->extents.y2 };
+ GLdouble p2[2] = { region->extents.x2, h - region->extents.y1 };
+
+ GLdouble halfW = output->width / 2.0;
+ GLdouble halfH = output->height / 2.0;
+
+ GLdouble cx = output->region.extents.x1 + halfW;
+ GLdouble cy = (h - output->region.extents.y2) + halfH;
+
+ GLdouble top[4] = { 0.0, halfH / (cy - p1[1]), 0.0, 0.5 };
+ GLdouble bottom[4] = { 0.0, halfH / (cy - p2[1]), 0.0, 0.5 };
+ GLdouble left[4] = { halfW / (cx - p1[0]), 0.0, 0.0, 0.5 };
+ GLdouble right[4] = { halfW / (cx - p2[0]), 0.0, 0.0, 0.5 };
+
+ glPushMatrix ();
+ glLoadMatrixf (mTransform.m);
+
+ glClipPlane (GL_CLIP_PLANE0, top);
+ glClipPlane (GL_CLIP_PLANE1, bottom);
+ glClipPlane (GL_CLIP_PLANE2, left);
+ glClipPlane (GL_CLIP_PLANE3, right);
+
+ glEnable (GL_CLIP_PLANE0);
+ glEnable (GL_CLIP_PLANE1);
+ glEnable (GL_CLIP_PLANE2);
+ glEnable (GL_CLIP_PLANE3);
transformToScreenSpace (s, output, -sAttrib->zTranslate,
&mTransform);
- glPushMatrix ();
glLoadMatrixf (mTransform.m);
+
(*s->paintWindow) (w, &w->paint, &mTransform, &infiniteRegion, PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK);
glPopMatrix ();
- s->disableOutputClipping (s);
+ glDisable (GL_CLIP_PLANE0);
+ glDisable (GL_CLIP_PLANE1);
+ glDisable (GL_CLIP_PLANE2);
+ glDisable (GL_CLIP_PLANE3);
+ //s->disableOutputClipping (s);
}
}