• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ piglit_link_simple_program函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中piglit_link_simple_program函数的典型用法代码示例。如果您正苦于以下问题:C++ piglit_link_simple_program函数的具体用法?C++ piglit_link_simple_program怎么用?C++ piglit_link_simple_program使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了piglit_link_simple_program函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:RAOF,项目名称:piglit,代码行数:33,代码来源:sso-user-varying-01.c


示例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();
}
开发者ID:nobled,项目名称:piglit,代码行数:27,代码来源:glsl-useprogram-displaylist.c


示例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);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:27,代码来源:sso-simple.c


示例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);
}
开发者ID:RAOF,项目名称:piglit,代码行数:25,代码来源:fbo-integer.c


示例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);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:31,代码来源:useprogram-flushverts-1.c


示例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);
}
开发者ID:RAOF,项目名称:piglit,代码行数:31,代码来源:glsl-link-initializer-03.c


示例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);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:25,代码来源:fs-texelFetchOffset-2D.c


示例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;
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:43,代码来源:incomplete-texture.c


示例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");
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:35,代码来源:primitive-restart-draw-mode.c


示例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);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:31,代码来源:glsl-vs-point-size.c


示例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);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:34,代码来源:texture-float-formats.c


示例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);
}
开发者ID:nobled,项目名称:piglit,代码行数:28,代码来源:instanced_arrays.c


示例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");
}
开发者ID:nobled,项目名称:piglit,代码行数:25,代码来源:glsl-fs-mix.c


示例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);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:27,代码来源:arb_es2_compatibility-releaseshadercompiler.c


示例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);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:27,代码来源:glsl-vs-user-varying-ff.c


示例16: piglit_init

void
piglit_init(int argc, char **argv)
{
	GLuint vs, fs;

	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	vs = piglit_compile_shader(GL_VERTEX_SHADER,
				   "shaders/glsl-color-mvp.vert");
	fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
				   "shaders/glsl-color.frag");

	prog = piglit_link_simple_program(vs, fs);

	glDeleteShader(vs);
	glDeleteShader(fs);

	/* 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);
}
开发者ID:nobled,项目名称:piglit,代码行数:28,代码来源:glsl-fs-flat-color.c


示例17: piglit_init

void piglit_init(int argc, char **argv)
{
	GLuint fs, vs;

	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	piglit_require_extension("GL_EXT_framebuffer_object");

	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
	fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
	prog = piglit_link_simple_program(vs, fs);

	if (!prog) {
		piglit_report_result(PIGLIT_SKIP);
	}

	color_location = glGetUniformLocation(prog, "color");
	if (color_location == -1) {
		fprintf(stderr, "Failed to get uniform location");
		piglit_report_result(PIGLIT_FAIL);
	}
}
开发者ID:blaztinn,项目名称:piglit,代码行数:25,代码来源:fbo-alphatest-nocolor.c


示例18: piglit_init

void
piglit_init(int argc, char **argv)
{
	GLint vs, fs;

	/* Set up projection matrix so we can just draw using window
	 * coordinates.
	 */
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	vs = piglit_compile_shader(GL_VERTEX_SHADER,
				   "shaders/glsl-mvp.vert");
	fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
				   "shaders/glsl-fs-loop-nested.frag");

	prog = piglit_link_simple_program(vs, fs);

	glUseProgram(prog);

	color_location = glGetUniformLocation(prog, "color");
}
开发者ID:nobled,项目名称:piglit,代码行数:26,代码来源:glsl-fs-loop-nested.c


示例19: piglit_init

void
piglit_init(int argc, char **argv)
{
	GLboolean pass = GL_TRUE;
	GLint vs, fs, num;
	GLint expect;

	if (argc < 3) {
		printf("Usage: %s <vertex shader file> "
		       "<expected uniform count>\n", argv[0]);
		piglit_report_result(PIGLIT_FAIL);
	}

	expect = (int) strtol(argv[2], NULL, 0);

	piglit_require_GLSL();
	vs = piglit_compile_shader(GL_VERTEX_SHADER, argv[1]);
	fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
				   "shaders/glsl-color.frag");

	prog = piglit_link_simple_program(vs, fs);

	glGetProgramiv(prog, GL_ACTIVE_UNIFORMS, &num);
	if (num != expect) {
		printf("Unexpected active uniform count "
		       "(saw %d, expected %d)\n", num, expect);
		pass = GL_FALSE;
	}

	if (pass)
		piglit_report_result(PIGLIT_PASS);
	else
		piglit_report_result(PIGLIT_FAIL);
}
开发者ID:RAOF,项目名称:piglit,代码行数:34,代码来源:glsl-getactiveuniform-count.c


示例20: shaderSetup

static void
shaderSetup(void)
{
	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vertShaderText);
	fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fragShaderText);
	prog = piglit_link_simple_program(vs, fs);
	glUseProgram(prog);
}
开发者ID:nobled,项目名称:piglit,代码行数:8,代码来源:sampler-cube-shadow.c



注:本文中的piglit_link_simple_program函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ piglit_ortho_projection函数代码示例发布时间:2022-05-30
下一篇:
C++ piglit_link_check_status函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap