2 * Copyright © 2009 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
27 * draws using a vertex program that ignores inputs and instead just
28 * writes a constant to gl_Position.
31 #include "piglit-util-gl.h"
33 PIGLIT_GL_TEST_CONFIG_BEGIN
35 config
.supports_gl_compat_version
= 10;
37 config
.window_width
= 400;
38 config
.window_height
= 300;
39 config
.window_visual
= PIGLIT_GL_VISUAL_RGB
| PIGLIT_GL_VISUAL_DOUBLE
;
41 PIGLIT_GL_TEST_CONFIG_END
48 static GLfloat vertices
[12] = {150.0, 125.0, 0.0,
53 static const char *vertShaderText
=
56 " gl_Position = vec4(100, 50, 0, 0);\n"
59 static const char *fragShaderText
=
62 " gl_FragColor = vec4(0.0, 1.0, 1.0, 1.0);\n"
65 static void compileLinkProg(void);
68 piglit_init(int argc
, char **argv
)
70 glMatrixMode(GL_PROJECTION
);
73 glOrtho(0, 400, 0, 300, -1, 1);
75 glMatrixMode(GL_MODELVIEW
);
79 glClearColor(0.2, 0.2, 0.2, 1.0);
81 piglit_require_gl_version(20);
91 vs
= glCreateShader(GL_VERTEX_SHADER
);
92 fs
= glCreateShader(GL_FRAGMENT_SHADER
);
93 glShaderSource(vs
, 1, (const GLchar
**) &vertShaderText
, NULL
);
94 glShaderSource(fs
, 1, (const GLchar
**) &fragShaderText
, NULL
);
96 glGetShaderiv(vs
, GL_COMPILE_STATUS
, &stat
);
98 printf("error compiling vertex shader!\n");
102 glGetShaderiv(fs
, GL_COMPILE_STATUS
, &stat
);
104 printf("error compiling fragment shader!\n");
108 prog
= glCreateProgram();
109 glAttachShader(prog
, vs
);
110 glAttachShader(prog
, fs
);
114 glVertexAttribPointer(0, 3, GL_FLOAT
, GL_FALSE
, 3*sizeof(GLfloat
),
117 glEnableVertexAttribArray(0);
124 glClear(GL_COLOR_BUFFER_BIT
);
126 glDrawArrays(GL_POINTS
, 0, 4);
129 glTranslatef(75.0, 0.0, 0.0);
131 glDrawArrays(GL_POINTS
, 0, 4);
136 piglit_present_results();