diff options
Diffstat (limited to 'progs/tests')
-rw-r--r-- | progs/tests/.gitignore | 1 | ||||
-rw-r--r-- | progs/tests/Makefile | 3 | ||||
-rw-r--r-- | progs/tests/SConscript | 1 | ||||
-rw-r--r-- | progs/tests/fbotest1.c | 6 | ||||
-rw-r--r-- | progs/tests/fbotest2.c | 6 | ||||
-rw-r--r-- | progs/tests/fbotest3.c | 6 | ||||
-rw-r--r-- | progs/tests/getprocaddress.py | 4 | ||||
-rw-r--r-- | progs/tests/texwrap.c | 32 | ||||
-rw-r--r-- | progs/tests/zbitmap.c | 127 |
9 files changed, 174 insertions, 12 deletions
diff --git a/progs/tests/.gitignore b/progs/tests/.gitignore index 8b3e9f35583..d905fab6117 100644 --- a/progs/tests/.gitignore +++ b/progs/tests/.gitignore @@ -104,6 +104,7 @@ vptorus vpwarpmesh yuvrect yuvsquare +zbitmap zcomp zdrawpix zreaddraw diff --git a/progs/tests/Makefile b/progs/tests/Makefile index d33415ab052..67efc3b7a9c 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -120,6 +120,7 @@ SOURCES = \ vpwarpmesh.c \ yuvrect.c \ yuvsquare.c \ + zbitmap.c \ zcomp.c \ zdrawpix.c \ zreaddraw.c @@ -157,7 +158,7 @@ clean: # auto code generation getprocaddress: getprocaddress.c getproclist.h -getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py +getproclist.h: $(TOP)/src/mesa/glapi/gen/gl_API.xml getprocaddress.c getprocaddress.py python getprocaddress.py > getproclist.h arraytexture: arraytexture.o readtex.o diff --git a/progs/tests/SConscript b/progs/tests/SConscript index 04e4bdf8c22..3580ba914db 100644 --- a/progs/tests/SConscript +++ b/progs/tests/SConscript @@ -118,6 +118,7 @@ progs = [ 'vpwarpmesh', 'yuvrect', 'yuvsquare', + 'zbitmap', 'zcomp', 'zdrawpix', 'zreaddraw', diff --git a/progs/tests/fbotest1.c b/progs/tests/fbotest1.c index 0cd7f95c355..a95fdff74c3 100644 --- a/progs/tests/fbotest1.c +++ b/progs/tests/fbotest1.c @@ -36,8 +36,8 @@ Display( void ) /* draw to user framebuffer */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); + glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { @@ -161,7 +161,7 @@ Init( void ) assert(i == MyFB); CheckError(__LINE__); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, MyRB); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); diff --git a/progs/tests/fbotest2.c b/progs/tests/fbotest2.c index f9c506193f6..872b46279e6 100644 --- a/progs/tests/fbotest2.c +++ b/progs/tests/fbotest2.c @@ -40,8 +40,8 @@ Display( void ) /* draw to user framebuffer */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); + glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { @@ -163,7 +163,7 @@ Init( void ) glGenRenderbuffersEXT(1, &ColorRb); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb); assert(glIsRenderbufferEXT(ColorRb)); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, ColorRb); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); diff --git a/progs/tests/fbotest3.c b/progs/tests/fbotest3.c index 8e288b38b83..c176f82d2ba 100644 --- a/progs/tests/fbotest3.c +++ b/progs/tests/fbotest3.c @@ -50,8 +50,8 @@ Display( void ) /* draw to user framebuffer */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); + glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { @@ -189,7 +189,7 @@ Init( void ) glGenRenderbuffersEXT(1, &ColorRb); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb); assert(glIsRenderbufferEXT(ColorRb)); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, ColorRb); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); diff --git a/progs/tests/getprocaddress.py b/progs/tests/getprocaddress.py index 699195bd48c..60111cb8010 100644 --- a/progs/tests/getprocaddress.py +++ b/progs/tests/getprocaddress.py @@ -4,7 +4,7 @@ # Helper for the getprocaddress.c test. import sys, getopt, re -sys.path.append("../../src/mesa/glapi/" ) +sys.path.append("../../src/mesa/glapi/gen" ) import gl_XML import license @@ -74,7 +74,7 @@ static struct name_test_pair functions[] = {""" if __name__ == '__main__': - file_name = "../../src/mesa/glapi/gl_API.xml" + file_name = "../../src/mesa/glapi/gen/gl_API.xml" try: (args, trail) = getopt.getopt(sys.argv[1:], "f:") diff --git a/progs/tests/texwrap.c b/progs/tests/texwrap.c index 39c55919dd2..bb26635d670 100644 --- a/progs/tests/texwrap.c +++ b/progs/tests/texwrap.c @@ -31,6 +31,7 @@ #define BORDER_TEXTURE 1 #define NO_BORDER_TEXTURE 2 +#define COLOR_TEX_CORNERS 0 #define SIZE 8 static GLubyte BorderImage[SIZE+2][SIZE+2][4]; @@ -281,6 +282,37 @@ static void Init( void ) for (i = 0; i < SIZE; i++) { for (j = 0; j < SIZE; j++) { +#if COLOR_TEX_CORNERS + if (i == 0 && j == 0) { + /* lower-left texel = RED */ + NoBorderImage[i][j][0] = 255; + NoBorderImage[i][j][1] = 0; + NoBorderImage[i][j][2] = 0; + NoBorderImage[i][j][3] = 255; + } + else if (i == 0 && j == SIZE-1) { + /* lower-right corner = GREEN */ + NoBorderImage[i][j][0] = 0; + NoBorderImage[i][j][1] = 255; + NoBorderImage[i][j][2] = 0; + NoBorderImage[i][j][3] = 255; + } + else if (i == SIZE-1 && j == 0) { + /* upper-left corner = BLUE */ + NoBorderImage[i][j][0] = 0; + NoBorderImage[i][j][1] = 0; + NoBorderImage[i][j][2] = 255; + NoBorderImage[i][j][3] = 255; + } + else if (i == SIZE-1 && j == SIZE-1) { + /* upper-right corner = YELLOW */ + NoBorderImage[i][j][0] = 255; + NoBorderImage[i][j][1] = 255; + NoBorderImage[i][j][2] = 0; + NoBorderImage[i][j][3] = 255; + } + else +#endif if ((i + j) & 1) { /* white */ NoBorderImage[i][j][0] = 255; diff --git a/progs/tests/zbitmap.c b/progs/tests/zbitmap.c new file mode 100644 index 00000000000..45cb7543c2a --- /dev/null +++ b/progs/tests/zbitmap.c @@ -0,0 +1,127 @@ +/* + * Test Z values of glBitmap. + * Brian Paul + * 19 Feb 2010 + */ + + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <GL/glew.h> +#include <GL/glut.h> + + +static GLint Win = 0; + + +static void +PrintString(const char *s) +{ + while (*s) { + glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); + s++; + } +} + + +static void +Display(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-3.0, 3.0, -3.0, 3.0, -2.0, 2.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glColor3f(1, 1, 1); + glRasterPos2f(-2.0, 2.6); + PrintString("Z = -1.0"); + glRasterPos2f(-0.5, 2.6); + PrintString("Z = 0.0"); + glRasterPos2f(1.0, 2.6); + PrintString("Z = 1.0"); + + glColor3f(0, 0.4, 0.6); + glBegin(GL_QUADS); + glVertex3f(-2.0, -2.5, -1); + glVertex3f(-1.0, -2.5, -1); + glVertex3f(-1.0, 2.5, -1); + glVertex3f(-2.0, 2.5, -1); + + glVertex3f(-0.5, -2.5, 0); + glVertex3f(0.5, -2.5, 0); + glVertex3f(0.5, 2.5, 0); + glVertex3f(-0.5, 2.5, 0); + + glVertex3f(1.0, -2.5, 1); + glVertex3f(2.0, -2.5, 1); + glVertex3f(2.0, 2.5, 1); + glVertex3f(1.0, 2.5, 1); + glEnd(); + + glColor3f(1, 1, 1); + + glRasterPos3f(-2.0, -1, -1.0); + PrintString("This is a bitmap string drawn at z = -1.0"); + + glRasterPos3f(-2.0, 0, 0.0); + PrintString("This is a bitmap string drawn at z = 0.0"); + + glRasterPos3f(-2.0, 1, 1.0); + PrintString("This is a bitmap string drawn at z = 1.0"); + + glRasterPos3f(-1.5, -2.8, 0.0); + PrintString("GL_DEPTH_FUNC = GL_LEQUAL"); + + glutSwapBuffers(); +} + + +static void +Reshape(int width, int height) +{ + glViewport(0, 0, width, height); +} + + +static void +Key(unsigned char key, int x, int y) +{ + if (key == 27) { + glutDestroyWindow(Win); + exit(0); + } + glutPostRedisplay(); +} + + +static void +Init(void) +{ + glClearColor(0.25, 0.25, 0.25, 0.0); + glDepthFunc(GL_LEQUAL); + glEnable(GL_DEPTH_TEST); +} + + +int +main(int argc, char *argv[]) +{ + glutInitWindowSize(400, 400); + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); + Win = glutCreateWindow(argv[0]); + glewInit(); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Display); + Init(); + glutMainLoop(); + return 0; +} |