Converts most of the custom reshape funcs to set the projection
in either piglit_init or piglit_display, depending on whether
it depends on the size.

V2: dont introduce unrelated projection changes
---
 tests/bugs/tri-tex-crash.c            | 21 ++-------------------
 tests/general/linestipple.c           | 13 +------------
 tests/general/occlusion_query.c       | 15 +--------------
 tests/general/point-line-no-cull.c    | 15 ++-------------
 tests/general/sync_api.c              | 14 +-------------
 tests/general/texgen.c                | 17 +----------------
 tests/general/varray-disabled.c       | 16 ++--------------
 tests/shaders/fp-fog.c                | 21 ++-------------------
 tests/shaders/fp-incomplete-tex.c     | 18 +-----------------
 tests/shaders/fp-kil.c                | 20 ++------------------
 tests/shaders/fp-lit-mask.c           | 17 +----------------
 tests/shaders/fp-lit-src-equals-dst.c | 17 +----------------
 tests/shaders/vpfp-generic.cpp        | 17 +----------------
 tests/texturing/crossbar.c            | 21 +--------------------
 tests/texturing/getteximage-formats.c | 22 ++--------------------
 tests/texturing/getteximage-simple.c  | 17 +----------------
 tests/texturing/tex3d-maxsize.c       | 12 ++----------
 tests/texturing/tex3d-npot.c          | 13 ++-----------
 tests/texturing/tex3d.c               | 13 ++-----------
 tests/texturing/texdepth.c            | 25 ++++++-------------------
 tests/texturing/texrect-many.c        | 17 +----------------
 tests/texturing/texredefine.c         | 13 ++-----------
 22 files changed, 37 insertions(+), 337 deletions(-)

diff --git a/tests/bugs/tri-tex-crash.c b/tests/bugs/tri-tex-crash.c
index 0b83541..ee1a3a6 100644
--- a/tests/bugs/tri-tex-crash.c
+++ b/tests/bugs/tri-tex-crash.c
@@ -109,26 +109,9 @@ piglit_display(void)
    return result;
 }
 
-
-static void
-reshape(int width, int height)
-{
-   piglit_width = width;
-   piglit_height = height;
-
-   glViewport(0, 0, width, height);
-   glMatrixMode(GL_PROJECTION);
-   glLoadIdentity();
-   glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 50.0);
-   glMatrixMode(GL_MODELVIEW);
-   glLoadIdentity();
-   glTranslatef(0.0, 0.0, -25.0);
-}
-
-
 void
 piglit_init(int argc, char **argv)
 {
-   glutReshapeFunc(reshape);
-   reshape(piglit_width, piglit_height);
+   piglit_frustum_projection(GL_FALSE, -1.0, 1.0, -1.0, 1.0, 5.0, 50.0);
+   glTranslatef(0.0, 0.0, -25.0);
 }
diff --git a/tests/general/linestipple.c b/tests/general/linestipple.c
index 9a0707b..ec4f6e3 100644
--- a/tests/general/linestipple.c
+++ b/tests/general/linestipple.c
@@ -194,23 +194,12 @@ static void test(void)
 enum piglit_result
 piglit_display(void)
 {
+       piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
        test();
 
        return PIGLIT_PASS;
 }
 
-
-static void Reshape(int width, int height)
-{
-       piglit_width = width;
-       piglit_height = height;
-       glViewport(0, 0, width, height);
-       piglit_ortho_projection(width, height, GL_FALSE);
-}
-
-
 void piglit_init(int argc, char **argv)
 {
-       glutReshapeFunc(Reshape);
-       Reshape(piglit_width, piglit_height);
 }
diff --git a/tests/general/occlusion_query.c b/tests/general/occlusion_query.c
index 8f715b7..00bb834 100644
--- a/tests/general/occlusion_query.c
+++ b/tests/general/occlusion_query.c
@@ -139,6 +139,7 @@ piglit_display(void)
 {
        int test_pass;
 
+       piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
        test_pass = do_test(0.0f, 0);
@@ -149,25 +150,11 @@ piglit_display(void)
        return test_pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void Reshape(int width, int height)
-{
-       piglit_width = width;
-       piglit_height = height;
-       glViewport(0, 0, width, height);
-       piglit_ortho_projection(width, height, GL_FALSE);
-}
-
-
 void
 piglit_init(int argc, char **argv)
 {
        GLint query_bits;
 
-       glutReshapeFunc(Reshape);
-
-       Reshape(piglit_width, piglit_height);
-
        glClearColor(0.0, 0.2, 0.3, 0.0);
        glClearDepth(1.0);
 
diff --git a/tests/general/point-line-no-cull.c 
b/tests/general/point-line-no-cull.c
index a2ef634..e6ed739 100644
--- a/tests/general/point-line-no-cull.c
+++ b/tests/general/point-line-no-cull.c
@@ -417,6 +417,8 @@ piglit_display(void)
 {
    GLboolean pass = GL_TRUE;
 
+   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
    glClear(GL_COLOR_BUFFER_BIT);
 
    pass = test_lines_no_culling() && pass;
@@ -431,20 +433,7 @@ piglit_display(void)
    return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void
-reshape(int width, int height)
-{
-   piglit_width = width;
-   piglit_height = height;
-   glViewport(0, 0, width, height);
-   piglit_ortho_projection(width, height, GL_FALSE);
-}
-
-
 void
 piglit_init(int argc, char **argv)
 {
-   glutReshapeFunc(reshape);
-   reshape(piglit_width, piglit_height);
 }
diff --git a/tests/general/sync_api.c b/tests/general/sync_api.c
index 43a190b..49f6d5e 100644
--- a/tests/general/sync_api.c
+++ b/tests/general/sync_api.c
@@ -47,25 +47,13 @@ PIGLIT_GL_TEST_MAIN(
                }                                                       \
        } while (0)
 
-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);
-}
-
 void
 piglit_init(int argc, char **argv)
 {
-       glutReshapeFunc(reshape);
-
        piglit_require_extension("GL_ARB_sync");
 
        glClearColor(0.1, 0.1, 0.3, 0.0);
+       piglit_gen_ortho_projection(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0, 
GL_FALSE);
 }
 
 GLboolean
diff --git a/tests/general/texgen.c b/tests/general/texgen.c
index 48eee52..5543833 100644
--- a/tests/general/texgen.c
+++ b/tests/general/texgen.c
@@ -189,20 +189,6 @@ piglit_display(void)
        }
 }
 
-
-static void Reshape(int width, int height)
-{
-       piglit_width = width;
-       piglit_height = height;
-
-       glViewport(0, 0, width, height);
-       glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
-       glMatrixMode(GL_MODELVIEW);
-       glLoadIdentity();
-}
-
 static void Key(unsigned char key, int x, int y)
 {
        (void) x;
@@ -251,7 +237,6 @@ void piglit_init(int argc, char *argv[])
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 0, GL_RGB, GL_FLOAT, 
TextureData);
        glEnable(GL_TEXTURE_2D);
 
-       glutReshapeFunc(Reshape);
-       Reshape(piglit_width, piglit_height);
+       piglit_ortho_projection(1.0, 1.0, GL_FALSE);
 }
 
diff --git a/tests/general/varray-disabled.c b/tests/general/varray-disabled.c
index 02e1625..af8e195 100644
--- a/tests/general/varray-disabled.c
+++ b/tests/general/varray-disabled.c
@@ -65,6 +65,8 @@ piglit_display(void)
        GLfloat blue[3]   = {0.0, 0.0, 1.0};
        GLfloat black[3]  = {0.0, 0.0, 0.0};
 
+       piglit_ortho_projection(1.0, 1.0, GL_FALSE);
+
        glClearColor(0.0, 0.0, 0.0, 0.0);
        glClear(GL_COLOR_BUFFER_BIT);
 
@@ -130,21 +132,7 @@ piglit_display(void)
        return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void Reshape(int width, int height)
-{
-       piglit_width = width;
-       piglit_height = height;
-       glViewport(0, 0, width, height);
-       glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
-       glMatrixMode(GL_MODELVIEW);
-       glLoadIdentity();
-}
-
 void
 piglit_init(int argc, char *argv[])
 {
-       glutReshapeFunc(Reshape);
 }
diff --git a/tests/shaders/fp-fog.c b/tests/shaders/fp-fog.c
index 2351544..e977a74 100644
--- a/tests/shaders/fp-fog.c
+++ b/tests/shaders/fp-fog.c
@@ -60,6 +60,8 @@ piglit_display(void)
        int pass = 1;
        unsigned i;
 
+       piglit_ortho_projection(2.0, 2.0, GL_FALSE);
+
        glClear(GL_COLOR_BUFFER_BIT);
 
        pglFogCoordf(0.3);
@@ -112,28 +114,11 @@ piglit_display(void)
        return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void Reshape(int width, int height)
-{
-       piglit_width = width;
-       piglit_height = height;
-
-       glViewport(0, 0, width, height);
-       glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       glOrtho(0.0, 2.0, 0.0, 2.0, -2.0, 6.0);
-       glScalef(1.0, 1.0, -1.0); // flip z-axis
-       glMatrixMode(GL_MODELVIEW);
-       glLoadIdentity();
-}
-
 void
 piglit_init(int argc, char **argv)
 {
        printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
 
-       glutReshapeFunc(Reshape);
-
        glClearColor(0.3, 0.3, 0.3, 0.3);
 
        if (piglit_get_gl_version() >= 14) {
@@ -151,6 +136,4 @@ piglit_init(int argc, char **argv)
        glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog);
 
        glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
-
-       Reshape(piglit_width, piglit_height);
 }
diff --git a/tests/shaders/fp-incomplete-tex.c 
b/tests/shaders/fp-incomplete-tex.c
index 3605d23..66375c1 100644
--- a/tests/shaders/fp-incomplete-tex.c
+++ b/tests/shaders/fp-incomplete-tex.c
@@ -184,20 +184,6 @@ piglit_display(void)
        return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void Reshape(int width, int height)
-{
-       piglit_width = width;
-       piglit_height = height;
-       glViewport(0, 0, width, height);
-       glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       glOrtho(0.0, 3.0, 0.0, 2.0, -2.0, 6.0);
-       glScalef(1.0, 1.0, -1.0); // flip z-axis
-       glMatrixMode(GL_MODELVIEW);
-       glLoadIdentity();
-}
-
 void
 piglit_init(int argc, char **argv)
 {
@@ -205,13 +191,11 @@ piglit_init(int argc, char **argv)
 
        printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
 
-       glutReshapeFunc(Reshape);
-
        piglit_require_fragment_program();
 
        for(i = 0; i < NUM_PROGRAMS; ++i)
                FragProg[i] = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, 
ProgramText[i]);
 
-       Reshape(piglit_width, piglit_height);
+       piglit_gen_ortho_projection(0.0, 3.0, 0.0, 2.0, -2.0, 6.0, GL_FALSE);
 }
 
diff --git a/tests/shaders/fp-kil.c b/tests/shaders/fp-kil.c
index 06e93f3..e154cb1 100644
--- a/tests/shaders/fp-kil.c
+++ b/tests/shaders/fp-kil.c
@@ -251,6 +251,8 @@ piglit_display(void)
 {
        int pass;
 
+       piglit_gen_ortho_projection(0.0, 2.0, 0.0, 2.0, -2.0, 6.0, GL_FALSE);
+
        DoFrame();
        pass = DoTest();
        piglit_present_results();
@@ -258,28 +260,12 @@ piglit_display(void)
        return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void Reshape(int width, int height)
-{
-       piglit_width = width;
-       piglit_height = height;
-       glViewport(0, 0, width, height);
-       glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       glOrtho(0.0, 2.0, 0.0, 2.0, -2.0, 6.0);
-       glScalef(1.0, 1.0, -1.0); // flip z-axis
-       glMatrixMode(GL_MODELVIEW);
-       glLoadIdentity();
-}
-
 void
 piglit_init(int argc, char **argv)
 {
        int i, x, y;
        GLubyte tex[4][4][4];
 
-       glutReshapeFunc(Reshape);
-
        if (piglit_get_gl_version() < 13) {
                printf("Requires OpenGL 1.3\n");
                piglit_report_result(PIGLIT_SKIP);
@@ -315,6 +301,4 @@ piglit_init(int argc, char **argv)
 
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-
-       Reshape(piglit_width, piglit_height);
 }
diff --git a/tests/shaders/fp-lit-mask.c b/tests/shaders/fp-lit-mask.c
index 4cc5022..b28b633 100644
--- a/tests/shaders/fp-lit-mask.c
+++ b/tests/shaders/fp-lit-mask.c
@@ -119,25 +119,10 @@ piglit_display(void)
        return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void Reshape(int width, int height)
-{
-       piglit_width = width;
-       piglit_height = height;
-       glViewport(0, 0, width, height);
-       glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       glOrtho(0.0, 4.0, 0.0, 4.0, -1.0, 1.0);
-       glMatrixMode(GL_MODELVIEW);
-       glLoadIdentity();
-}
-
 void piglit_init(int argc, char **argv)
 {
        int mask;
 
-       glutReshapeFunc(Reshape);
-
        printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
 
        piglit_require_fragment_program();
@@ -159,5 +144,5 @@ void piglit_init(int argc, char **argv)
                FragProg[mask-1] = 
piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, programText);
        }
 
-       Reshape(piglit_width, piglit_height);
+       piglit_ortho_projection(4.0, 4.0, GL_FALSE);
 }
diff --git a/tests/shaders/fp-lit-src-equals-dst.c 
b/tests/shaders/fp-lit-src-equals-dst.c
index 49ffcaa..2bb66c4 100644
--- a/tests/shaders/fp-lit-src-equals-dst.c
+++ b/tests/shaders/fp-lit-src-equals-dst.c
@@ -113,25 +113,10 @@ piglit_display(void)
        return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void Reshape(int width, int height)
-{
-       piglit_width = width;
-       piglit_height = height;
-       glViewport(0, 0, width, height);
-       glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       glOrtho(0.0, 4.0, 0.0, 4.0, -1.0, 1.0);
-       glMatrixMode(GL_MODELVIEW);
-       glLoadIdentity();
-}
-
 void piglit_init(int argc, char **argv)
 {
        int mask;
 
-       glutReshapeFunc(Reshape);
-
        printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
 
        piglit_require_fragment_program();
@@ -153,5 +138,5 @@ void piglit_init(int argc, char **argv)
                FragProg[mask-1] = 
piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, programText);
        }
 
-       Reshape(piglit_width, piglit_height);
+       piglit_ortho_projection(4.0, 4.0, GL_FALSE);
 }
diff --git a/tests/shaders/vpfp-generic.cpp b/tests/shaders/vpfp-generic.cpp
index a0175b2..239b820 100644
--- a/tests/shaders/vpfp-generic.cpp
+++ b/tests/shaders/vpfp-generic.cpp
@@ -374,20 +374,6 @@ extern "C" piglit_result piglit_display(void)
        return tests.run() ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void Reshape(int width, int height)
-{
-       piglit_width = width;
-       piglit_height = height;
-       glViewport(0, 0, width, height);
-       glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
-       glMatrixMode(GL_MODELVIEW);
-       glLoadIdentity();
-}
-
-
 extern "C" void piglit_init(int argc, char **argv)
 {
        int i;
@@ -421,6 +407,5 @@ extern "C" void piglit_init(int argc, char **argv)
        if (tests.nv_vertex_program)
                piglit_require_extension("GL_NV_vertex_program");
 
-       glutReshapeFunc(Reshape);
-       Reshape(piglit_width, piglit_height);
+       piglit_ortho_projection(1.0, 1.0, GL_FALSE);
 }
diff --git a/tests/texturing/crossbar.c b/tests/texturing/crossbar.c
index 4bec7aa..497ff31 100644
--- a/tests/texturing/crossbar.c
+++ b/tests/texturing/crossbar.c
@@ -159,11 +159,6 @@ piglit_display(void)
       piglit_present_results();
 
       printf("\nSecond frame\n------------\n");
-      glMatrixMode( GL_PROJECTION );
-      glLoadIdentity();
-      glOrtho( 0, 3*(NUM_TESTS+1), -1.5, 1.5, -1, 1 );
-      glMatrixMode( GL_MODELVIEW );
-      glLoadIdentity();
 
       DoFrame();
       retry = DoTest();
@@ -176,20 +171,6 @@ piglit_display(void)
    }
 }
 
-
-static void Reshape( int width, int height )
-{
-   piglit_width = width;
-   piglit_height = height;
-
-   glViewport( 0, 0, width, height );
-   glMatrixMode( GL_PROJECTION );
-   glLoadIdentity();
-   glOrtho( 0, 3*(NUM_TESTS+1), -1.5, 1.5, -1, 1 );
-   glMatrixMode( GL_MODELVIEW );
-   glLoadIdentity();
-}
-
 void piglit_init(int argc, char **argv)
 {
    const char * const ver_string = (const char * const)
@@ -198,7 +179,7 @@ void piglit_init(int argc, char **argv)
    GLint tex_units;
    GLint temp[ 256 ];
 
-   glutReshapeFunc(Reshape);
+   piglit_gen_ortho_projection( 0, 3*(NUM_TESTS+1), -1.5, 1.5, -1, 1, GL_FALSE 
);
 
    if ( (!piglit_is_extension_supported("GL_ARB_multitexture")
         && (ver < 1.3))
diff --git a/tests/texturing/getteximage-formats.c 
b/tests/texturing/getteximage-formats.c
index 1fe74dc..e3f4d71 100644
--- a/tests/texturing/getteximage-formats.c
+++ b/tests/texturing/getteximage-formats.c
@@ -501,6 +501,8 @@ piglit_display(void)
 {
        GLboolean pass;
 
+       piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
        if (piglit_automatic) {
                pass = test_all_formats();
        }
@@ -520,21 +522,6 @@ piglit_display(void)
        return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void
-reshape(int width, int height)
-{
-       piglit_width = width;
-       piglit_height = height;
-       glViewport(0, 0, width, height);
-       glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       glOrtho(0, piglit_width, 0, piglit_height, -1.0, 1.0);
-       glMatrixMode(GL_MODELVIEW);
-       glLoadIdentity();
-}
-
-
 void
 piglit_init(int argc, char **argv)
 {
@@ -548,11 +535,6 @@ piglit_init(int argc, char **argv)
        fbo_formats_init(argc, argv, 0);
        (void) fbo_formats_display;
 
-       glutReshapeFunc(reshape);
-       /*glutKeyboardFunc(key);*/
-
-       reshape(piglit_width, piglit_height);
-
        glGenTextures(1, &t);
        glBindTexture(GL_TEXTURE_2D, t);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
diff --git a/tests/texturing/getteximage-simple.c 
b/tests/texturing/getteximage-simple.c
index 46afde5..cbb15d4 100644
--- a/tests/texturing/getteximage-simple.c
+++ b/tests/texturing/getteximage-simple.c
@@ -66,25 +66,10 @@ piglit_display(void)
        return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-static void Reshape(int width, int height)
-{
-       piglit_width = width;
-       piglit_height = height;
-       glViewport(0, 0, width, height);
-       glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       glOrtho(0.0, 1.0, 0.0, 1.0, -2.0, 6.0);
-       glScalef(1.0, 1.0, -1.0); // flip z-axis
-       glMatrixMode(GL_MODELVIEW);
-       glLoadIdentity();
-}
-
 void piglit_init(int argc, char **argv)
 {
        int i;
 
-       glutReshapeFunc(Reshape);
-
        for(i = 0; i < 4096; ++i)
                data[i] = rand() & 0xff;
 
@@ -92,5 +77,5 @@ void piglit_init(int argc, char **argv)
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 16, 0, GL_RGBA, 
GL_UNSIGNED_BYTE, data);
 
-       Reshape(piglit_width, piglit_height);
+       piglit_gen_ortho_projection(0.0, 1.0, 0.0, 1.0, -2.0, 6.0, GL_FALSE);
 }
diff --git a/tests/texturing/tex3d-maxsize.c b/tests/texturing/tex3d-maxsize.c
index 626a46d..465fffc 100644
--- a/tests/texturing/tex3d-maxsize.c
+++ b/tests/texturing/tex3d-maxsize.c
@@ -93,6 +93,8 @@ piglit_display(void)
        float c1[4] = {0.25, 0.25, 0.25, 1.0};
        float c2[4] = {0.75, 0.75, 0.75, 1.0};
 
+       piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
        glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &maxsize);
 
        /* Create the texture. */
@@ -184,14 +186,6 @@ piglit_display(void)
        return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void Reshape(int width, int height)
-{
-       glViewport(0, 0, piglit_width, piglit_height);
-       piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
-}
-
-
 void piglit_init(int argc, char **argv)
 {
        if (piglit_get_gl_version() < 12) {
@@ -199,8 +193,6 @@ void piglit_init(int argc, char **argv)
                piglit_report_result(PIGLIT_SKIP);
        }
 
-       glutReshapeFunc(Reshape);
        glDisable(GL_DITHER);
-       Reshape(piglit_width, piglit_height);
 }
 
diff --git a/tests/texturing/tex3d-npot.c b/tests/texturing/tex3d-npot.c
index 8591955..9dd6fa5 100644
--- a/tests/texturing/tex3d-npot.c
+++ b/tests/texturing/tex3d-npot.c
@@ -200,6 +200,8 @@ piglit_display(void)
     GLenum formats[] = { GL_RGBA, GL_RGB, GL_ALPHA };
     int w, h, d, fmt;
 
+    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
     for(fmt = 0; fmt < sizeof(formats)/sizeof(formats[0]); ++fmt) {
         for(w = 3; w <= 15; w++) {
             if (w != 4 && w != 8) {
@@ -219,25 +221,14 @@ piglit_display(void)
     return PIGLIT_PASS;
 }
 
-
-static void Reshape(int width, int height)
-{
-    glViewport(0, 0, piglit_width, piglit_height);
-    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
-}
-
-
 void
 piglit_init(int argc, char **argv)
 {
     piglit_automatic = GL_TRUE;
     piglit_require_extension("GL_ARB_texture_non_power_of_two");
 
-    glutReshapeFunc(Reshape);
-
     glDisable(GL_DITHER);
 
     glGenTextures(1, &Texture);
     glBindTexture(GL_TEXTURE_3D, Texture);
-    Reshape(piglit_width, piglit_height);
 }
diff --git a/tests/texturing/tex3d.c b/tests/texturing/tex3d.c
index e990057..9e05da9 100644
--- a/tests/texturing/tex3d.c
+++ b/tests/texturing/tex3d.c
@@ -201,6 +201,8 @@ piglit_display(void)
        GLenum formats[] = { GL_RGBA, GL_RGB, GL_ALPHA };
        int w, h, d, fmt;
 
+       piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
        for(fmt = 0; fmt < sizeof(formats)/sizeof(formats[0]); ++fmt) {
                for(w = 1; w <= 16; w *= 2) {
                        for(h = 1; h <= 16; h *= 2) {
@@ -214,14 +216,6 @@ piglit_display(void)
        return PIGLIT_PASS;
 }
 
-
-static void Reshape(int width, int height)
-{
-       glViewport(0, 0, piglit_width, piglit_height);
-       piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
-}
-
-
 void
 piglit_init(int argc, char **argv)
 {
@@ -232,11 +226,8 @@ piglit_init(int argc, char **argv)
 
        piglit_automatic = GL_TRUE;
 
-       glutReshapeFunc(Reshape);
-
        glDisable(GL_DITHER);
 
        glGenTextures(1, &Texture);
        glBindTexture(GL_TEXTURE_3D, Texture);
-       Reshape(piglit_width, piglit_height);
 }
diff --git a/tests/texturing/texdepth.c b/tests/texturing/texdepth.c
index 20ca56e..a655ef0 100644
--- a/tests/texturing/texdepth.c
+++ b/tests/texturing/texdepth.c
@@ -312,6 +312,12 @@ static struct test_step Tests[] = {
 enum piglit_result
 piglit_display(void)
 {
+       CellWidth = piglit_width / COLS;
+       CellHeight = piglit_height / ROWS;
+       Width = CellWidth*COLS;
+       Height = CellHeight*ROWS;
+       piglit_gen_ortho_projection(0.0, COLS, 0.0, ROWS, 0.0, -1.0, GL_FALSE);
+
        glReadBuffer(GL_BACK);
        CreateRenderedTexture();
        glViewport(0, 0, Width, Height);
@@ -344,21 +350,6 @@ piglit_display(void)
        return PIGLIT_PASS;
 }
 
-static void Reshape(int width, int height)
-{
-       CellWidth = width / COLS;
-       CellHeight = height / ROWS;
-       Width = CellWidth*COLS;
-       Height = CellHeight*ROWS;
-       glViewport(0, 0, Width, Height);
-       glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       glOrtho(0.0, COLS, 0.0, ROWS, 0.0, -1.0);
-       glMatrixMode(GL_MODELVIEW);
-       glLoadIdentity();
-}
-
-
 static void Key(unsigned char key, int x, int y)
 {
        (void) x;
@@ -382,8 +373,6 @@ piglit_init(int argc, char **argv)
 {
        GLfloat texbuf[4];
 
-       glutReshapeFunc(Reshape);
-
        if (!piglit_automatic) {
                glutKeyboardFunc(Key);
                printf("Press 't' to cycle through test images\n");
@@ -419,6 +408,4 @@ piglit_init(int argc, char **argv)
                     GL_DEPTH_COMPONENT, GL_FLOAT, 0);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-
-       Reshape(Width,Height);
 }
diff --git a/tests/texturing/texrect-many.c b/tests/texturing/texrect-many.c
index 11e75d0..aaff6fb 100644
--- a/tests/texturing/texrect-many.c
+++ b/tests/texturing/texrect-many.c
@@ -98,19 +98,6 @@ piglit_display(void)
        return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-static void Reshape(int width, int height)
-{
-       piglit_width = width;
-       piglit_height = height;
-       glViewport(0, 0, width, height);
-       glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
-       glScalef(1.0, 1.0, -1.0); // flip z-axis
-       glMatrixMode(GL_MODELVIEW);
-       glLoadIdentity();
-}
-
 void piglit_init(int argc, char **argv)
 {
        int i;
@@ -121,8 +108,6 @@ void piglit_init(int argc, char **argv)
                piglit_report_result(PIGLIT_SKIP);
        }
 
-       glutReshapeFunc(Reshape);
-
        piglit_require_extension("GL_ARB_texture_rectangle");
 
        glGetIntegerv(GL_MAX_TEXTURE_UNITS, &maxtextures);
@@ -160,5 +145,5 @@ void piglit_init(int argc, char **argv)
                glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, 
GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        }
 
-       Reshape(piglit_width, piglit_height);
+       piglit_ortho_projection(1.0, 1.0, GL_FALSE);
 }
diff --git a/tests/texturing/texredefine.c b/tests/texturing/texredefine.c
index 9c69b27..5f470b3 100644
--- a/tests/texturing/texredefine.c
+++ b/tests/texturing/texredefine.c
@@ -184,6 +184,8 @@ piglit_display(void)
 
        testnr = 0;
 
+       piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
        glClearColor(0.5, 0.5, 0.5, 1.0);
        glClear(GL_COLOR_BUFFER_BIT);
 
@@ -201,17 +203,6 @@ piglit_display(void)
        return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void Reshape(int width, int height)
-{
-       glViewport(0, 0, width, height);
-       piglit_ortho_projection(width, height, GL_FALSE);
-}
-
-
 void piglit_init(int argc, char **argv)
 {
-       glutReshapeFunc(Reshape);
-
-       Reshape(piglit_width, piglit_height);
 }
-- 
1.7.12

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to