2 * (C) Copyright IBM Corporation 2006
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22 * USE OR OTHER DEALINGS IN THE SOFTWARE.
28 * Simple regression test for bug #3050. Create a texture and make a few
29 * calls to \c glGetTexLevelParameteriv. If the bug still exists, trying
30 * to get \c GL_TEXTURE_WITDH will cause a protocol error.
32 * This test \b only applies to indirect-rendering. This may mean that the
33 * test needs to be run with the environment variable \c LIBGL_ALWAYS_INDIRECT
34 * set to a non-zero value.
36 * \author Ian Romanick <idr@us.ibm.com>
44 static int Width
= 400;
45 static int Height
= 200;
46 static const GLfloat Near
= 5.0, Far
= 25.0;
49 static void Display( void )
54 static void Reshape( int width
, int height
)
59 static void Key( unsigned char key
, int x
, int y
)
72 static void Init( void )
75 static const GLenum pnames
[] = {
77 GL_TEXTURE_GREEN_SIZE
,
79 GL_TEXTURE_ALPHA_SIZE
,
80 GL_TEXTURE_LUMINANCE_SIZE
,
81 GL_TEXTURE_INTENSITY_SIZE
,
83 GL_TEXTURE_INTERNAL_FORMAT
,
91 printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER
));
92 printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION
));
94 printf("\nThis program should log some data about a texture and exit.\n");
95 printf("This is a regression test for bug #3050. If the bug still\n");
96 printf("exists, a GLX protocol error will be generated.\n");
97 printf("https://bugs.freedesktop.org/show_bug.cgi?id=3050\n\n");
100 if ( ! glutExtensionSupported( "GL_NV_texture_rectangle" )
101 && ! glutExtensionSupported( "GL_EXT_texture_rectangle" )
102 && ! glutExtensionSupported( "GL_ARB_texture_rectangle" ) ) {
103 printf( "This test requires one of GL_ARB_texture_rectangle, GL_EXT_texture_rectangle,\n"
104 "or GL_NV_texture_rectangle be supported\n." );
109 glBindTexture( GL_TEXTURE_RECTANGLE_NV
, 1 );
110 glTexImage2D( GL_PROXY_TEXTURE_RECTANGLE_NV
, 0, GL_RGBA
, 8, 8, 0,
111 GL_RGBA
, GL_UNSIGNED_BYTE
, NULL
);
113 for ( i
= 0 ; pnames
[i
] != ~0 ; i
++ ) {
118 glGetTexLevelParameteriv( GL_PROXY_TEXTURE_RECTANGLE_NV
, 0, pnames
[i
], & param_i
);
122 printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n"
128 printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = 0x%04x\n",
129 pnames
[i
], param_i
);
133 glGetTexLevelParameterfv( GL_PROXY_TEXTURE_RECTANGLE_NV
, 0, pnames
[i
], & param_f
);
137 printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n"
138 "error of 0x%04x!\n",
143 printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = %.1f (0x%04x)\n",
144 pnames
[i
], param_f
, (GLint
) param_f
);
150 int main( int argc
, char *argv
[] )
152 glutInit( &argc
, argv
);
153 glutInitWindowPosition( 0, 0 );
154 glutInitWindowSize( Width
, Height
);
155 glutInitDisplayMode( GLUT_RGB
| GLUT_DOUBLE
);
156 glutCreateWindow( "Bug #3050 Test" );
157 glutReshapeFunc( Reshape
);
158 glutKeyboardFunc( Key
);
159 glutDisplayFunc( Display
);