本文整理汇总了C++中piglit_link_simple_program函数的典型用法代码示例。如果您正苦于以下问题:C++ piglit_link_simple_program函数的具体用法?C++ piglit_link_simple_program怎么用?C++ piglit_link_simple_program使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了piglit_link_simple_program函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: piglit_init
void
piglit_init(int argc, char **argv)
{
GLboolean try_to_render;
GLuint vs;
GLuint fs;
piglit_require_gl_version(20);
piglit_require_extension("GL_EXT_separate_shader_objects");
glClearColor(0.3, 0.3, 0.3, 0.0);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
prog[0] = piglit_link_simple_program(vs, 0);
prog[1] = piglit_link_simple_program(0, fs);
glDeleteShader(vs);
glDeleteShader(fs);
/* Don't try to render if either program failed to link, and linking
* had better succeed!
*/
try_to_render = piglit_link_check_status(prog[0]);
try_to_render = piglit_link_check_status(prog[1])
&& try_to_render;
if (!try_to_render)
piglit_report_result(PIGLIT_FAIL);
}
示例2: piglit_init
void
piglit_init(int argc, char **argv)
{
GLint fsr;
GLint fsg;
GLint vs;
if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP);
}
glClearColor(0.2, 0.2, 0.2, 1.0);
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vertShaderText);
fsr = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fragShaderTextRed);
fsg =
piglit_compile_shader_text(GL_FRAGMENT_SHADER, fragShaderTextGreen);
progr = piglit_link_simple_program(vs, fsr);
progg = piglit_link_simple_program(vs, fsg);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glUseProgram(progg);
glEndList();
}
示例3: piglit_init
void
piglit_init(int argc, char **argv)
{
GLuint vs;
GLuint fs;
if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP);
}
piglit_require_extension("GL_EXT_separate_shader_objects");
glClearColor(0.3, 0.3, 0.3, 0.0);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, bad_fs_text);
prog[0] = piglit_link_simple_program(vs, 0);
prog[1] = glCreateShaderProgramEXT(GL_FRAGMENT_SHADER, good_fs_text);
prog[2] = piglit_link_simple_program(vs, fs);
glDeleteShader(vs);
glDeleteShader(fs);
}
示例4: piglit_init
void
piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_ARB_framebuffer_object");
piglit_require_extension("GL_EXT_texture_integer");
piglit_require_extension("GL_EXT_gpu_shader4");
piglit_require_GLSL_version(130);
PassthroughFragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER,
PassthroughFragShaderText);
assert(PassthroughFragShader);
PassthroughProgram = piglit_link_simple_program(0, PassthroughFragShader);
SimpleFragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER,
SimpleFragShaderText);
assert(SimpleFragShader);
SimpleProgram = piglit_link_simple_program(0, SimpleFragShader);
(void) check_error(__FILE__, __LINE__);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
示例5: piglit_init
void
piglit_init(int argc, char **argv)
{
GLint vs, fs1, fs2;
const char *vs_source =
"void main()\n"
"{\n"
" gl_Position = gl_Vertex;\n"
"}\n";
const char *fs1_source =
"void main()\n"
"{\n"
" gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);\n"
"}\n";
const char *fs2_source =
"void main()\n"
"{\n"
" gl_FragColor = vec4(0.0, 0.0, 1.0, 0.0);\n"
"}\n";
if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP);
}
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
fs1 = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs1_source);
fs2 = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs2_source);
prog1 = piglit_link_simple_program(vs, fs1);
prog2 = piglit_link_simple_program(vs, fs2);
}
示例6: piglit_init
void piglit_init(int argc, char **argv)
{
GLint vert[3];
GLint prog_a;
GLint prog_b;
GLint prog_c;
GLint prog_d;
piglit_require_gl_version(20);
vert[0] =
piglit_compile_shader(GL_VERTEX_SHADER,
"shaders/glsl-link-initializer-01a.vert");
vert[1] =
piglit_compile_shader(GL_VERTEX_SHADER,
"shaders/glsl-link-initializer-01b.vert");
vert[2] =
piglit_compile_shader(GL_VERTEX_SHADER,
"shaders/glsl-link-initializer-01c.vert");
prog_a = piglit_link_simple_program(vert[0], vert[1]);
prog_b = piglit_link_simple_program(vert[1], vert[0]);
prog_c = piglit_link_simple_program(vert[0], vert[2]);
prog_d = piglit_link_simple_program(vert[2], vert[0]);
/* piglit_link_simple_program() returns 0 on link failure. So
* verify that there was no link failure by simply checking
* that two programs were returned.
*/
piglit_report_result((prog_a && prog_b && prog_c && prog_d)
? PIGLIT_PASS : PIGLIT_FAIL);
}
示例7: piglit_init
void
piglit_init(int argc, char **argv)
{
int vs, fs, prog;
int tex_location;
piglit_require_GLSL_version(130);
glActiveTexture(GL_TEXTURE0);
piglit_rgbw_texture(GL_RGBA, tex_size, tex_size / 2, true, false,
GL_UNSIGNED_NORMALIZED);
piglit_ortho_projection(piglit_width, piglit_height, false);
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);
prog = piglit_link_simple_program(vs, fs);
tex_location = piglit_GetUniformLocation(prog, "tex");
lod_location = piglit_GetUniformLocation(prog, "lod");
pos_location = piglit_GetUniformLocation(prog, "pos");
piglit_UseProgram(prog);
piglit_Uniform1i(tex_location, 0);
}
示例8: test_glsl
/**
* Section 3.11.2 of the GL 2.1 spec says:
* If a fragment shader uses a sampler whose associated texture object is
* not complete, as defined in section 3.8.10, the texture image unit will
* return (R, G, B, A) = (0, 0, 0, 1).
*
* In this test we swizzle RGBA->ABGR so we don't need to worry if the
* framebuffer has an alpha channel.
*/
GLboolean
test_glsl(void)
{
static const char *fragShaderText =
"uniform sampler2D tex;\n"
"void main()\n"
"{\n"
" gl_FragColor = texture2D(tex, gl_TexCoord[0].xy).abgr;\n"
"}\n";
static const GLfloat expected[4] = { 1.0, 0.0, 0.0, 0.0 };
int pos = 2;
GLboolean p;
GLuint frag, prog;
GLint tex;
frag = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fragShaderText);
prog = piglit_link_simple_program(0, frag);
glUseProgram(prog);
tex = glGetUniformLocation(prog, "tex");
glUniform1i(tex, 0);
glColor3f(0, 1, 0);
draw_rect(2);
glUseProgram(0);
glDeleteShader(frag);
glDeleteProgram(prog);
p = probe_pos(pos, expected);
if (!p)
printf(" Testing GLSL\n");
return p;
}
示例9: piglit_init
void
piglit_init(int argc, char **argv)
{
int i;
GLuint vs;
/* Parse params */
if (argc != 2)
print_usage_and_exit(argv[0]);
for (i = 0; i < ARRAY_SIZE(tests); i++) {
if (strcmp(argv[1], tests[i].name) == 0) {
test = &tests[i];
break;
}
}
if (test == NULL)
print_usage_and_exit(argv[0]);
piglit_require_GLSL_version(110);
if (!piglit_is_extension_supported("GL_NV_primitive_restart") &&
piglit_get_gl_version() < 31) {
printf("GL_NV_primitive_restart or GL 3.1 required\n");
piglit_report_result(PIGLIT_SKIP);
}
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
prog = piglit_link_simple_program(vs, 0);
if (!prog)
piglit_report_result(PIGLIT_FAIL);
glDeleteShader(vs);
vertex_attr = glGetAttribLocation(prog, "vertex");
window_size_loc = glGetUniformLocation(prog, "window_size");
offset_loc = glGetUniformLocation(prog, "offset");
color_loc = glGetUniformLocation(prog, "color");
}
示例10: piglit_init
void
piglit_init(int argc, char **argv)
{
GLint vs;
GLint point_size_range[2];
if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP);
}
/* If the driver doesn't claim to support the point size the
shader is going to set then we should skip the test */
glGetIntegerv(GL_ALIASED_POINT_SIZE_RANGE, point_size_range);
if (POINT_SIZE < point_size_range[0] ||
POINT_SIZE > point_size_range[1]) {
printf("Point size %i not supported\n", POINT_SIZE);
piglit_report_result(PIGLIT_SKIP);
}
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glClearColor(0.0, 0.0, 0.0, 1.0);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
"shaders/glsl-vs-point-size.vert");
prog = piglit_link_simple_program(vs, 0);
glUseProgram(prog);
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
}
示例11: piglit_init
void
piglit_init(int argc, char **argv)
{
GLuint Texture;
piglit_require_extension("GL_ARB_texture_float");
piglit_require_extension("GL_ARB_fragment_shader");
HaveRG = piglit_is_extension_supported("GL_ARB_texture_rg");
FragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER, FragShaderText);
assert(FragShader);
Program = piglit_link_simple_program(0, FragShader);
glUseProgram(Program);
BiasUniform = glGetUniformLocation(Program, "bias");
ScaleUniform = glGetUniformLocation(Program, "scale");
TexUniform = glGetUniformLocation(Program, "tex");
glUniform1f(BiasUniform, Bias);
glUniform1f(ScaleUniform, Scale);
glUniform1i(TexUniform, 0); /* tex unit zero */
(void) check_error(__FILE__, __LINE__);
glGenTextures(1, &Texture);
glBindTexture(GL_TEXTURE_2D, Texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
示例12: piglit_init
void
piglit_init(int argc, char **argv)
{
piglit_require_GLSL();
piglit_require_extension("GL_ARB_instanced_arrays");
VertShader = piglit_compile_shader_text(GL_VERTEX_SHADER, VertShaderText);
assert(VertShader);
FragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER, FragShaderText);
assert(FragShader);
Program = piglit_link_simple_program(VertShader, FragShader);
glUseProgram(Program);
PosAttrib = glGetAttribLocation(Program, "Pos");
ColorAttrib = glGetAttribLocation(Program, "Color");
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-5, 5, -5, 5, 10, 20);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -11.0);
glScalef(0.5, 0.5, 1.0);
}
示例13: piglit_init
void
piglit_init(int argc, char **argv)
{
GLint vs, fs;
if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP);
}
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
"shaders/glsl-mvp.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
"shaders/glsl-fs-mix.frag");
prog = piglit_link_simple_program(vs, fs);
glUseProgram(prog);
args1_location = glGetUniformLocation(prog, "args1");
args2_location = glGetUniformLocation(prog, "args2");
args3_location = glGetUniformLocation(prog, "args3");
}
示例14: draw
void
draw(const float *color, float x_offset)
{
GLuint vs, fs, prog;
GLint color_location;
GLint offset_location;
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
prog = piglit_link_simple_program(vs, fs);
glBindAttribLocation(prog, 0, "vertex");
glLinkProgram(prog);
piglit_link_check_status(prog);
glDeleteShader(vs);
glDeleteShader(fs);
glUseProgram(prog);
color_location = glGetUniformLocation(prog, "color");
offset_location = glGetUniformLocation(prog, "offset");
glUniform4fv(color_location, 1, color);
glUniform4f(offset_location, x_offset, 0.0f, 0.0f, 0.0f);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDeleteProgram(prog);
}
示例15: piglit_init
void
piglit_init(int argc, char **argv)
{
GLuint vs;
if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP);
}
glClearColor(0.3, 0.3, 0.3, 0.0);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
prog = piglit_link_simple_program(vs, 0);
glDeleteShader(vs);
/* Don't try to render if the program failed to link, and linking
* had better succeed!
*/
if (!piglit_link_check_status(prog))
piglit_report_result(PIGLIT_FAIL);
glUseProgram(prog);
}