summaryrefslogtreecommitdiffstats
path: root/progs/trivial/tri-scissor-tri.c
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-02-05 13:48:35 +0000
committerJosé Fonseca <[email protected]>2010-02-05 13:48:35 +0000
commita1af8eec66c5f7ec421e8011b41c1a7c36319f9f (patch)
treebc76a431699807cf60cf8ba82ff6b3b1ff34f309 /progs/trivial/tri-scissor-tri.c
parentc036d13d7d2cc905226fe53ebd86a18da808963f (diff)
parentbee9964b29b2428ee75e2d1efc0e1d2c2518a417 (diff)
Merge remote branch 'origin/lp-binning'
Conflicts: src/gallium/auxiliary/util/u_dl.c src/gallium/auxiliary/util/u_time.h src/gallium/drivers/llvmpipe/lp_state_derived.c src/gallium/drivers/llvmpipe/lp_state_surface.c src/gallium/drivers/llvmpipe/lp_tex_cache.c src/gallium/drivers/llvmpipe/lp_tile_cache.c
Diffstat (limited to 'progs/trivial/tri-scissor-tri.c')
-rw-r--r--progs/trivial/tri-scissor-tri.c58
1 files changed, 47 insertions, 11 deletions
diff --git a/progs/trivial/tri-scissor-tri.c b/progs/trivial/tri-scissor-tri.c
index d65502d91b9..1bb15501bbd 100644
--- a/progs/trivial/tri-scissor-tri.c
+++ b/progs/trivial/tri-scissor-tri.c
@@ -31,10 +31,14 @@
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
-GLint Width = 250, Height = 250;
+GLint Width = 300, Height = 300;
GLenum doubleBuffer;
+/* scissor bounds */
+static GLint Left, Right, Bottom, Top;
+
+
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
@@ -47,26 +51,57 @@ static void Init(void)
static void Reshape(int width, int height)
{
-
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
+
+ Width = width;
+ Height = height;
+
+ Left = Width / 4;
+ Right = Width * 3 / 4;
+ Bottom = Height / 4;
+ Top = Height * 3 / 4;
}
static void Key(unsigned char key, int x, int y)
{
+ int step = 2;
+ switch (key) {
+ case 'l':
+ Left -= step;
+ break;
+ case 'L':
+ Left += step;
+ break;
+ case 'r':
+ Right -= step;
+ break;
+ case 'R':
+ Right += step;
+ break;
+ case 'b':
+ Bottom -= step;
+ break;
+ case 'B':
+ Bottom += step;
+ break;
+ case 't':
+ Top -= step;
+ break;
+ case 'T':
+ Top += step;
+ break;
+ case 27:
+ exit(1);
+ default:
+ ;
+ }
- switch (key) {
- case 27:
- exit(1);
- default:
- break;
- }
-
- glutPostRedisplay();
+ glutPostRedisplay();
}
static void Draw(void)
@@ -82,7 +117,8 @@ static void Draw(void)
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
- glScissor(Width / 4, Height / 4, Width / 2, Height / 2);
+ printf("Scissor %d, %d .. %d, %d\n", Left, Bottom, Right, Top);
+ glScissor(Left, Bottom, Right-Left, Top-Bottom);
glEnable(GL_SCISSOR_TEST);
glBegin(GL_TRIANGLES);