当前位置: 首页>>代码示例>>C++>>正文


C++ piglit_ortho_projection函数代码示例

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


在下文中一共展示了piglit_ortho_projection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: create_fbo

static int
create_fbo(void)
{
	GLuint tex, fb;
	GLenum status;
	int i, dim;

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_2D, tex);

	for (i = 0, dim = TEX_WIDTH; dim >0; i++, dim /= 2) {
		glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA,
			     dim, dim,
			     0,
			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	}
	assert(glGetError() == 0);

	glGenFramebuffersEXT(1, &fb);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
				  GL_COLOR_ATTACHMENT0_EXT,
				  GL_TEXTURE_2D,
				  tex,
				  0);
	assert(glGetError() == 0);

	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
		fprintf(stderr, "FBO incomplete\n");
		goto done;
	}

	glViewport(0, 0, TEX_WIDTH, TEX_HEIGHT);
	piglit_ortho_projection(TEX_WIDTH, TEX_HEIGHT, GL_FALSE);

	glColor4fv(red);
	piglit_draw_rect(0, 0, TEX_WIDTH / 2, TEX_HEIGHT / 2);
	glColor4fv(green);
	piglit_draw_rect(TEX_WIDTH / 2, 0, TEX_WIDTH, TEX_HEIGHT / 2);
	glColor4fv(blue);
	piglit_draw_rect(0, TEX_HEIGHT / 2, TEX_WIDTH/2, TEX_HEIGHT);
	glColor4fv(white);
	piglit_draw_rect(TEX_WIDTH / 2, TEX_HEIGHT / 2, TEX_WIDTH, TEX_HEIGHT);

	glScissor(10, 10, 10, 10);
	glEnable(GL_SCISSOR_TEST);
	glGenerateMipmapEXT(GL_TEXTURE_2D);
	glDisable(GL_SCISSOR_TEST);
done:
	glDeleteFramebuffersEXT(1, &fb);

	return tex;
}
开发者ID:nobled,项目名称:piglit,代码行数:54,代码来源:fbo-generatemipmap-scissor.c

示例2: piglit_init

void
piglit_init(int argc, char **argv)
{

	printf("The test's expectation is that the implementation samples\n"
	       "at pixel centers to produce fragments, so the fourth\n"
	       "(subpixel offset = 0.6) rectangle in each axis will\n"
	       "be offset compared to the previous.\n\n");

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:11,代码来源:fragment-center.c

示例3: create_array_fbo_2d

static GLuint
create_array_fbo_2d(void)
{
	GLuint tex, fb;
	GLenum status;
	int i, dim;
	int layer;

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, tex);
	assert(glGetError() == 0);

	for (i = 0, dim = TEX_WIDTH; dim >0; i++, dim /= 2) {
		glTexImage3D(GL_TEXTURE_2D_ARRAY_EXT, i, format,
			     dim, dim, num_layers, 0,
			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	}
	assert(glGetError() == 0);

	glGenFramebuffersEXT(1, &fb);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);

	for (layer = 0; layer < num_layers; layer++) {
		glFramebufferTextureLayer(GL_FRAMEBUFFER_EXT,
					  GL_COLOR_ATTACHMENT0_EXT,
					  tex,
					  0,
					  layer);
		assert(glGetError() == 0);

		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
			load_texture_2d_array();
			goto done;
		}

		glViewport(0, 0, TEX_WIDTH, TEX_HEIGHT);
		piglit_ortho_projection(TEX_WIDTH, TEX_HEIGHT, GL_FALSE);

		glColor4fv(layer_color[layer]);
		piglit_draw_rect(0, 0, TEX_WIDTH / 2, TEX_HEIGHT / 2);
		glColor4fv(green);
		piglit_draw_rect(TEX_WIDTH / 2, 0, TEX_WIDTH, TEX_HEIGHT / 2);
		glColor4fv(blue);
		piglit_draw_rect(0, TEX_HEIGHT / 2, TEX_WIDTH/2, TEX_HEIGHT);
		glColor4fv(white);
		piglit_draw_rect(TEX_WIDTH / 2, TEX_HEIGHT / 2, TEX_WIDTH, TEX_HEIGHT);
	}

done:
	glGenerateMipmapEXT(GL_TEXTURE_2D_ARRAY_EXT);
	glDeleteFramebuffersEXT(1, &fb);
	return tex;
}
开发者ID:aphogat,项目名称:piglit,代码行数:54,代码来源:fbo-generatemipmap-array.c

示例4: piglit_init

void
piglit_init(int argc, char **argv)
{
	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
		exit(1);
	}

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:11,代码来源:glsl-dlist-getattriblocation.c

示例5: create_3d_fbo

static int
create_3d_fbo(void)
{
	GLuint tex, fb;
	GLenum status;
	int depth;
	pot_depth = piglit_is_extension_supported("GL_ARB_texture_non_power_of_two") ?
		NUM_DEPTHS: POT_DEPTHS;

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_3D, tex);

	/* allocate empty 3D texture */
	glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA,
		     BUF_WIDTH, BUF_HEIGHT, pot_depth,
		     0,
		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	assert(glGetError() == 0);

	glGenFramebuffersEXT(1, &fb);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);

	/* draw something into each slice of the 3D texture */
	for (depth = 0; depth < NUM_DEPTHS; depth++) {
		glFramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT,
					  GL_COLOR_ATTACHMENT0_EXT,
					  GL_TEXTURE_3D,
					  tex,
					  0,
					  depth);

		assert(glGetError() == 0);

		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
			fprintf(stderr, "FBO incomplete\n");
			goto done;
		}

		glViewport(0, 0, BUF_WIDTH, BUF_HEIGHT);
		piglit_ortho_projection(BUF_WIDTH, BUF_HEIGHT, GL_FALSE);

		/* solid color quad */
		glColor4fv(depth_color[depth]);
		piglit_draw_rect(-2, -2, BUF_WIDTH + 2, BUF_HEIGHT + 2);
	}


done:
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
	glDeleteFramebuffersEXT(1, &fb);

	return tex;
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:54,代码来源:fbo-3d.c

示例6: create_fbo

static int
create_fbo(void)
{
	GLuint tex, copied_tex, fb;
	GLenum status;

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_2D, tex);

	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
		     TEX_WIDTH, TEX_HEIGHT,
		     0,
		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);

	assert(glGetError() == 0);

	glGenFramebuffersEXT(1, &fb);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
				  GL_COLOR_ATTACHMENT0_EXT,
				  GL_TEXTURE_2D,
				  tex,
				  0);
	assert(glGetError() == 0);

	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
		fprintf(stderr, "FBO incomplete\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	glViewport(0, 0, TEX_WIDTH, TEX_HEIGHT);
	piglit_ortho_projection(TEX_WIDTH, TEX_HEIGHT, GL_FALSE);

	glColor4fv(red);
	piglit_draw_rect(0, 0, TEX_WIDTH / 2, TEX_HEIGHT / 2);
	glColor4fv(green);
	piglit_draw_rect(TEX_WIDTH / 2, 0, TEX_WIDTH, TEX_HEIGHT / 2);
	glColor4fv(blue);
	piglit_draw_rect(0, TEX_HEIGHT / 2, TEX_WIDTH/2, TEX_HEIGHT);
	glColor4fv(white);
	piglit_draw_rect(TEX_WIDTH / 2, TEX_HEIGHT / 2, TEX_WIDTH, TEX_HEIGHT);

	glGenTextures(1, &copied_tex);
	glBindTexture(GL_TEXTURE_2D, copied_tex);
	glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, TEX_WIDTH, TEX_HEIGHT, 0);

	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
	glDeleteFramebuffersEXT(1, &fb);
	glDeleteTextures(1, &tex);

	return copied_tex;
}
开发者ID:aphogat,项目名称:piglit,代码行数:53,代码来源:fbo-copyteximage-simple.c

示例7: piglit_init

void piglit_init(int argc, char **argv)
{
    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

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

    glShadeModel(GL_FLAT);
    glClearColor(0.2, 0.2, 0.2, 1.0);
}
开发者ID:nobled,项目名称:piglit,代码行数:12,代码来源:draw-vbo-bounds.c

示例8: piglit_display

PIGLIT_GL_TEST_CONFIG_END

enum piglit_result
piglit_display(void)
{
	bool pass = true;
	float green[] = {0, 1, 0, 0};
	float clear[] = {0, 0, 0, 0};

	piglit_ortho_projection(piglit_width, piglit_height, false);

	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

	glClearColor(0.0, 0.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT);

	glColor4f(0, 1, 0, 0);

	/* Draw a rectangle, but set the flag to false for the verticals. */
	glBegin(GL_QUADS);
	glEdgeFlag(GL_TRUE);
	glVertex2f(1.5, 1.5);
	glEdgeFlag(GL_FALSE);
	glVertex2f(5.5, 1.5);
	glEdgeFlag(GL_TRUE);
	glVertex2f(5.5, 5.5);
	glEdgeFlag(GL_FALSE);
	glVertex2f(1.5, 5.5);

	glEdgeFlag(GL_TRUE);
	glVertex2f(11.5, 1.5);
	glEdgeFlag(GL_FALSE);
	glVertex2f(15.5, 1.5);
	glEdgeFlag(GL_TRUE);
	glVertex2f(15.5, 5.5);
	glEdgeFlag(GL_FALSE);
	glVertex2f(11.5, 5.5);
	glEnd();

	pass = piglit_probe_pixel_rgba(3, 1, green) && pass;
	pass = piglit_probe_pixel_rgba(3, 5, green) && pass;
	pass = piglit_probe_pixel_rgba(1, 3, clear) && pass;
	pass = piglit_probe_pixel_rgba(5, 3, clear) && pass;

	pass = piglit_probe_pixel_rgba(13, 1, green) && pass;
	pass = piglit_probe_pixel_rgba(13, 5, green) && pass;
	pass = piglit_probe_pixel_rgba(11, 3, clear) && pass;
	pass = piglit_probe_pixel_rgba(15, 3, clear) && pass;

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:53,代码来源:edgeflag-quads.c

示例9: piglit_init

void
piglit_init(int argc, char**argv)
{
   piglit_require_extension("GL_EXT_framebuffer_object");

   HaveExtension[0] = GL_TRUE;
   HaveExtension[EXT_packed_depth_stencil] = glutExtensionSupported("GL_EXT_packed_depth_stencil");
   HaveExtension[ARB_framebuffer_object] = glutExtensionSupported("GL_ARB_framebuffer_object");
   HaveExtension[ARB_texture_rg] = glutExtensionSupported("GL_ARB_texture_rg");

   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
开发者ID:nobled,项目名称:piglit,代码行数:12,代码来源:fbo-storage-formats.c

示例10: piglit_init

void
piglit_init(int argc, char **argv)
{
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	piglit_require_extension("GL_ARB_vertex_buffer_object");

	glGenBuffersARB(1, &vbo);
	glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo);
	glBufferDataARB(GL_ARRAY_BUFFER_ARB, 12 * sizeof(GLfloat),
			NULL, GL_DYNAMIC_DRAW);
}
开发者ID:RAOF,项目名称:piglit,代码行数:12,代码来源:vbo-bufferdata.c

示例11: framebuffer_srgb_non_fbo

static GLboolean
framebuffer_srgb_non_fbo(void)
{
	GLboolean pass;

	glViewport(0, 0, piglit_width, piglit_height);
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	pass = test_srgb();
	piglit_present_results();
	return pass;
}
开发者ID:RAOF,项目名称:piglit,代码行数:12,代码来源:framebuffer-srgb.c

示例12: create_array_fbo

static int
create_array_fbo(void)
{
	GLuint tex, fb;
	GLenum status;
	int layer;

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, tex);
	if (!piglit_check_gl_error(GL_NO_ERROR))
		piglit_report_result(PIGLIT_FAIL);

	/* allocate empty array texture */
	glTexImage3D(GL_TEXTURE_2D_ARRAY_EXT, 0, GL_RGBA,
		     BUF_WIDTH, BUF_HEIGHT, num_layers,
		     0,
		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	if (!piglit_check_gl_error(GL_NO_ERROR))
		piglit_report_result(PIGLIT_FAIL);

	glGenFramebuffersEXT(1, &fb);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);

	/* draw something into each layer of the array texture */
	for (layer = 0; layer < NUM_LAYERS; layer++) {
		glFramebufferTextureLayer(GL_FRAMEBUFFER_EXT,
					     GL_COLOR_ATTACHMENT0_EXT,
					     tex,
					     0,
					     layer);

		if (!piglit_check_gl_error(GL_NO_ERROR))
			piglit_report_result(PIGLIT_FAIL);

		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
			fprintf(stderr, "FBO incomplete\n");
			goto done;
		}

		glViewport(0, 0, BUF_WIDTH, BUF_HEIGHT);
		piglit_ortho_projection(BUF_WIDTH, BUF_HEIGHT, GL_FALSE);

		/* solid color quad */
		glColor4fv(layer_color[layer]);
		piglit_draw_rect(-2, -2, BUF_WIDTH + 2, BUF_HEIGHT + 2);
	}


done:
	glDeleteFramebuffersEXT(1, &fb);
	return tex;
}
开发者ID:chemecse,项目名称:piglit,代码行数:53,代码来源:fbo-array.c

示例13: piglit_init

void
piglit_init(int argc, char**argv)
{
	enum piglit_result result;
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	piglit_require_extension("GL_ARB_blend_func_extended");

	glGetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, &max_ds_buffers);

	result = test();
	piglit_report_result(result);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:13,代码来源:fbo-extended-blend.c

示例14: piglit_init

void
piglit_init(int argc, char **argv)
{
	glClearColor(0.0, 0.2, 0.3, 0.0);
	glClearDepth(1.0);

	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LESS);

	piglit_require_extension("GL_ARB_occlusion_query");
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:13,代码来源:occlusion_query_conform.c

示例15: piglit_display

enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	int x, y;
	static float red[]   = {1.0, 0.0, 0.0, 0.0};
	static float green[] = {0.0, 1.0, 0.0, 0.0};

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	glEnable(GL_DEPTH_TEST);

	glClearColor(0.0, 1.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT);

	glColor4fv(red);

	glClearDepth(0.5);
	glClear(GL_DEPTH_BUFFER_BIT);
	draw_rect_set(10);

	glDepthRange(0.5, 1.0);
	glClearDepth(0.5);
	glClear(GL_DEPTH_BUFFER_BIT);
	glDepthRange(0.0, 1.0);
	draw_rect_set(30);

	glDepthRange(0.0, 0.5);
	glClearDepth(0.5);
	glClear(GL_DEPTH_BUFFER_BIT);
	glDepthRange(0.0, 1.0);
	draw_rect_set(50);

	for (y = 0; y < 3; y++) {
		for (x = 0; x < 4; x++) {
			float *expected;

			if (x < 2)
				expected = green;
			else
				expected = red;

			pass &= piglit_probe_pixel_rgb(15 + x * 20, 15 + y * 20,
						       expected);
		}
	}

	glutSwapBuffers();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:nobled,项目名称:piglit,代码行数:51,代码来源:depthrange-clear.c


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