diff options
author | Eric Anholt <eric@anholt.net> | 2009-09-29 14:43:41 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-09-29 17:26:48 -0700 |
commit | 4cfbe82bc3278321a90d30cc768f09525bd68328 (patch) | |
tree | 7880c49576216d853fd1f5124fba0b22fd32cf8b /tests/texturing/tex3d.c | |
parent | e144c21b764068baddc639657f965decd7102993 (diff) |
Move most piglit tests to using the framework.
This saves a giant pile of code, and should encourage cleaner testcases
from people writing tests in the future.
Diffstat (limited to 'tests/texturing/tex3d.c')
-rw-r--r-- | tests/texturing/tex3d.c | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/tests/texturing/tex3d.c b/tests/texturing/tex3d.c index 22f09e2df..9878b5028 100644 --- a/tests/texturing/tex3d.c +++ b/tests/texturing/tex3d.c @@ -28,7 +28,9 @@ #include "piglit-util.h" -static int Width = 128, Height = 128; +int piglit_width = 128, piglit_height = 128; +int piglit_window_mode = GLUT_RGB | GLUT_ALPHA; + static GLuint Texture; static int nrcomponents(GLenum format) @@ -102,7 +104,7 @@ static int render_and_check(int w, int h, int d, GLenum format, float q, unsigne glVertex2f(x, y+h); glEnd(); x += w; - if (x >= Width) { + if (x >= piglit_width) { y += h; x = 0; } @@ -114,7 +116,7 @@ static int render_and_check(int w, int h, int d, GLenum format, float q, unsigne for(layer = 0; layer < d; ++layer) { glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, readback+layer*w*h*4); x += w; - if (x >= Width) { + if (x >= piglit_width) { y += h; x = 0; } @@ -190,7 +192,8 @@ static void test_simple(int w, int h, int d, GLenum format) } } -static void Redisplay(void) +enum piglit_result +piglit_display(void) { GLenum formats[] = { GL_RGBA, GL_RGB, GL_ALPHA }; int w, h, d, fmt; @@ -205,40 +208,25 @@ static void Redisplay(void) } } - piglit_report_result(PIGLIT_SUCCESS); + return PIGLIT_SUCCESS; } static void Reshape(int width, int height) { - glViewport(0, 0, Width, Height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0.0, Width, 0.0, Height, -1.0, 1.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + glViewport(0, 0, piglit_width, piglit_height); + piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); } -static void Init(void) +void +piglit_init(int argc, char **argv) { - glGenTextures(1, &Texture); - glBindTexture(GL_TEXTURE_3D, Texture); - Reshape(Width,Height); -} + piglit_automatic = GL_TRUE; -int main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(Width, Height); - glutInitDisplayMode(GLUT_RGB | GLUT_ALPHA); - glutCreateWindow(argv[0]); glutReshapeFunc(Reshape); - glutDisplayFunc(Redisplay); - glewInit(); - Init(); - glutMainLoop(); - return 0; -} + glGenTextures(1, &Texture); + glBindTexture(GL_TEXTURE_3D, Texture); + Reshape(piglit_width, piglit_height); +} |