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>
43 #include "glut_wrap.h"
45 static int Width
= 400;
46 static int Height
= 200;
47 static const GLfloat Near
= 5.0, Far
= 25.0;
50 static void Display( void )
55 static void Reshape( int width
, int height
)
60 static void Key( unsigned char key
, int x
, int y
)
73 static void Init( void )
76 static const GLenum pnames
[] = {
78 GL_TEXTURE_GREEN_SIZE
,
80 GL_TEXTURE_ALPHA_SIZE
,
81 GL_TEXTURE_LUMINANCE_SIZE
,
82 GL_TEXTURE_INTENSITY_SIZE
,
84 GL_TEXTURE_INTERNAL_FORMAT
,
92 printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER
));
93 printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION
));
95 printf("\nThis program should log some data about a texture and exit.\n");
96 printf("This is a regression test for bug #3050. If the bug still\n");
97 printf("exists, a GLX protocol error will be generated.\n");
98 printf("https://bugs.freedesktop.org/show_bug.cgi?id=3050\n\n");
101 if ( ! glutExtensionSupported( "GL_NV_texture_rectangle" )
102 && ! glutExtensionSupported( "GL_EXT_texture_rectangle" )
103 && ! glutExtensionSupported( "GL_ARB_texture_rectangle" ) ) {
104 printf( "This test requires one of GL_ARB_texture_rectangle, GL_EXT_texture_rectangle,\n"
105 "or GL_NV_texture_rectangle be supported\n." );
110 glBindTexture( GL_TEXTURE_RECTANGLE_NV
, 1 );
111 glTexImage2D( GL_PROXY_TEXTURE_RECTANGLE_NV
, 0, GL_RGBA
, 8, 8, 0,
112 GL_RGBA
, GL_UNSIGNED_BYTE
, NULL
);
114 for ( i
= 0 ; pnames
[i
] != ~0 ; i
++ ) {
119 glGetTexLevelParameteriv( GL_PROXY_TEXTURE_RECTANGLE_NV
, 0, pnames
[i
], & param_i
);
123 printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n"
129 printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = 0x%04x\n",
130 pnames
[i
], param_i
);
134 glGetTexLevelParameterfv( GL_PROXY_TEXTURE_RECTANGLE_NV
, 0, pnames
[i
], & param_f
);
138 printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n"
139 "error of 0x%04x!\n",
144 printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = %.1f (0x%04x)\n",
145 pnames
[i
], param_f
, (GLint
) param_f
);
151 int main( int argc
, char *argv
[] )
153 glutInit( &argc
, argv
);
154 glutInitWindowPosition( 0, 0 );
155 glutInitWindowSize( Width
, Height
);
156 glutInitDisplayMode( GLUT_RGB
| GLUT_DOUBLE
);
157 glutCreateWindow( "Bug #3050 Test" );
159 glutReshapeFunc( Reshape
);
160 glutKeyboardFunc( Key
);
161 glutDisplayFunc( Display
);