2 * (C) Copyright IBM Corporation 2004
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 test of GL_EXT_blend_minmax functionality. Four squares are drawn
29 * with different blending modes, but all should be rendered with the same
32 * \author Ian Romanick <idr@us.ibm.com>
39 static int Width
= 400;
40 static int Height
= 200;
41 static const GLfloat Near
= 5.0, Far
= 25.0;
44 static void Display( void )
46 glClearColor(0.2, 0.2, 0.8, 0);
47 glClear( GL_COLOR_BUFFER_BIT
);
51 /* This is the "reference" square.
54 glTranslatef(-4.5, 0, 0);
55 glBlendEquation( GL_FUNC_ADD
);
56 glBlendFunc( GL_ONE
, GL_ZERO
);
58 glColor3f( 0.5, 0.5, 0.5 );
70 static void Reshape( int width
, int height
)
72 GLfloat ar
= (float) width
/ (float) height
;
75 glViewport( 0, 0, width
, height
);
76 glMatrixMode( GL_PROJECTION
);
78 glFrustum( -ar
, ar
, -1.0, 1.0, Near
, Far
);
79 glMatrixMode( GL_MODELVIEW
);
81 glTranslatef( 0.0, 0.0, -15.0 );
85 static void Key( unsigned char key
, int x
, int y
)
98 static void Init( void )
100 const char * const ver_string
= (const char * const)
101 glGetString( GL_VERSION
);
103 printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER
));
104 printf("GL_VERSION = %s\n", ver_string
);
106 printf("\nThis program should draw a single square, but not crash.\n");
107 printf("This is a regression test for bug #3101.\n");
108 printf("https://bugs.freedesktop.org/show_bug.cgi?id=3101\n");
109 glEnable( GL_BLEND
);
113 int main( int argc
, char *argv
[] )
115 glutInit( &argc
, argv
);
116 glutInitWindowPosition( 0, 0 );
117 glutInitWindowSize( Width
, Height
);
118 glutInitDisplayMode( GLUT_RGB
| GLUT_DOUBLE
);
119 glutCreateWindow( "Bug #3101 Test" );
120 glutReshapeFunc( Reshape
);
121 glutKeyboardFunc( Key
);
122 glutDisplayFunc( Display
);