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

C++ piglit_draw_rect_tex函数代码示例

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

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



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

示例1: piglit_display

enum piglit_result piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	int i;

	glBindTexture(GL_TEXTURE_2D, tex);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 16, 16, 0, GL_RGBA, GL_FLOAT, tex_data);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
	glViewport(0, 0, 16, 16);

	glUseProgram(prog);
	glUniform1i(texloc, 0);

	for (i = 0; i < PASSES; i++) {
		if (i != 0)
			glTextureBarrierNV();
		piglit_draw_rect_tex(-1, -1, 2, 2, 0, 0, 1, 1);
	}

	pass = piglit_probe_image_rgba(0, 0, 16, 16, res_data);

	glUseProgram(0);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
	glViewport(0, 0, piglit_width, piglit_height);

	piglit_draw_rect_tex(-1, -1, 2, 2, 0, 0, 1, 1);

	piglit_present_results();

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


示例2: piglit_display

enum piglit_result
piglit_display(void)
{
	static const char *fp_source =
		"!!ARBfp1.0\n"
		"TEX result.color, fragment.texcoord[0], texture[1], 2D;\n"
		"END\n";
	bool pass = true;
	GLuint tex;
	GLuint prog;

	texrect_w = piglit_width / 4 / 2;
	texrect_h = piglit_height / 2;

	glGenProgramsARB(1, &prog);
	glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog);
	glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB,
			   GL_PROGRAM_FORMAT_ASCII_ARB,
			   strlen(fp_source),
			   (const GLubyte *) fp_source);

	glEnable(GL_FRAGMENT_PROGRAM_ARB);

	glActiveTexture(GL_TEXTURE1);
	tex = piglit_rgbw_texture(GL_RGBA, 2, 2, false, false,
				  GL_UNSIGNED_NORMALIZED);

	/* Given that the failure mode we had that led to this test
	 * being written was that the sampler state read was
	 * pseudo-random, go through several statechanges on the
	 * sampler to make sure we're reliably getting our sampler
	 * state.
	 */
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	piglit_draw_rect_tex(-1, -1, 0.5, 2,
			     0, 0, 1, 1);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	piglit_draw_rect_tex(-0.5, -1, 0.5, 2,
			     0, 0, 1, 1);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	piglit_draw_rect_tex(0, -1, 0.5, 2,
			     0, 0, 1, 1);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	piglit_draw_rect_tex(0.5, -1, 0.5, 2,
			     0, 0, 1, 1);

	pass = pass && test_nearest(piglit_width * 0 / 4);
	pass = pass && test_linear(piglit_width * 1 / 4);
	pass = pass && test_nearest(piglit_width * 2 / 4);
	pass = pass && test_linear(piglit_width * 3 / 4);

	piglit_present_results();

	glDeleteTextures(1, &tex);
	glDisable(GL_FRAGMENT_PROGRAM_ARB);
	glDeleteProgramsARB(1, &prog);

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


示例3: piglit_display

enum piglit_result
piglit_display(void)
{
	float black[4] = {0.0, 0.0, 0.0, 0.0};
	float white[4] = {1.0, 1.0, 1.0, 0.0};
	float red[4] =   {1.0, 0.0, 0.0, 0.0};
	float green[4] = {0.0, 1.0, 0.0, 0.0};
	float blue[4] =  {0.0, 0.0, 1.0, 0.0};
	GLboolean pass = GL_TRUE;
	GLuint tex;

	tex = piglit_checkerboard_texture(0, /* name */
					  0, /* level */
					  2, 2, /* width/height */
					  1, 1, /* checkerboard size */
					  black, white);

	glEnable(GL_TEXTURE_2D);
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

	glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, red);
	piglit_draw_rect_tex(-1, -1, 1, 1,
			     -2, -2, 0, 0);

	glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, green);
	piglit_draw_rect_tex( 0, -1, 1, 1,
			     -2, -2, 0, 0);

	glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, blue);
	piglit_draw_rect_tex(-1,  0, 1, 1,
			     -2, -2, 0, 0);

	glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, white);
	piglit_draw_rect_tex( 0,  0, 1, 1,
			     -2, -2, 0, 0);

	pass = piglit_probe_pixel_rgb(piglit_width * 1 / 4,
				      piglit_height * 1 / 4, red) && pass;
	pass = piglit_probe_pixel_rgb(piglit_width * 3 / 4,
				      piglit_height * 1 / 4, green) && pass;
	pass = piglit_probe_pixel_rgb(piglit_width * 1 / 4,
				      piglit_height * 3 / 4, blue) && pass;
	pass = piglit_probe_pixel_rgb(piglit_width * 3 / 4,
				      piglit_height * 3 / 4, white) && pass;

	glDeleteTextures(1, &tex);

	glutSwapBuffers();

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


示例4: piglit_display

enum piglit_result
piglit_display(void)
{
	bool pass = true;

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

	/* Clear the whole first texture with green */
	glClearTexImage(texture[0], 0, GL_RGB, GL_FLOAT, green);
	pass &= piglit_check_gl_error(GL_NO_ERROR);

	/* Clear the left half of the second texture with blue */
	glClearTexSubImage(texture[1], 0,
			   0, 0, 0,
			   32, 64, 1,
			   GL_RGB, GL_FLOAT, blue);
	pass &= piglit_check_gl_error(GL_NO_ERROR);
	/* And the right half with yellow */
	glClearTexSubImage(texture[1], 0,
			   32, 0, 0,
			   32, 64, 1,
			   GL_RGB, GL_FLOAT, yellow);
	pass &= piglit_check_gl_error(GL_NO_ERROR);

	/* Render both textures to the screen */
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
	glEnable(GL_TEXTURE_2D);
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

	glBindTexture(GL_TEXTURE_2D, texture[0]);
	piglit_draw_rect_tex(0, 0, 64, 64, 0, 0, 1, 1);

	glBindTexture(GL_TEXTURE_2D, texture[1]);
	piglit_draw_rect_tex(64, 0, 64, 64, 0, 0, 1, 1);

	glDisable(GL_TEXTURE_2D);
	glDeleteTextures(2, texture);

	/* Check for the 3 separate regions */
	pass &= piglit_probe_rect_rgb(0, 0, 64, 64, green);
	pass &= piglit_probe_rect_rgb(64, 0, 32, 64, blue);
	pass &= piglit_probe_rect_rgb(96, 0, 32, 64, yellow);

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:aphogat,项目名称:piglit,代码行数:50,代码来源:simple.c


示例5: piglit_display

enum piglit_result
piglit_display(void)
{
	glBindFramebuffer(GL_FRAMEBUFFER, fbo);
	glClearColor(0,0,1,0);
	glClear(GL_COLOR_BUFFER_BIT);

	glAlphaFunc(GL_GEQUAL, 0.5f);
	glEnable(GL_ALPHA_TEST);

	glUseProgram(prog);
	glViewport(0, 0, 64, 64);
	piglit_draw_rect(-1, -1, 2, 2);

	glDisable(GL_ALPHA_TEST);

	/* visualize it */
	glUseProgram(0);
	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
	glViewport(0, 0, 128, 64);
	glClearColor(0,0,0.5,0);
	glClear(GL_COLOR_BUFFER_BIT);

	glEnable(GL_TEXTURE_2D);

	glBindTexture(GL_TEXTURE_2D, color0);
	piglit_draw_rect_tex(-1, -1, 1, 2,
			0, 0, 1, 1);
	glBindTexture(GL_TEXTURE_2D, color1);
	piglit_draw_rect_tex(0, -1, 1, 2,
			0, 0, 1, 1);

	glDisable(GL_TEXTURE_2D);

	{
		bool pass = true;
		float red[] = {1,0,0};
		float green[] = {0,1,0};
		float blue[] = {0,0,1};
		pass = piglit_probe_pixel_rgb(4, 4, blue) && pass;
		pass = piglit_probe_pixel_rgb(12, 4, red) && pass;
		pass = piglit_probe_pixel_rgb(64 + 4, 4, blue) && pass;
		pass = piglit_probe_pixel_rgb(64 + 12, 4, green) && pass;

		piglit_present_results();

		return pass ? PIGLIT_PASS : PIGLIT_FAIL;
	}
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:49,代码来源:fbo-mrt-alphatest.c


示例6: piglit_display

enum piglit_result
piglit_display(void)
{
	static const GLfloat color[4] = { 0.0, 1.0, 0.0, 1.0 };
	enum piglit_result result = PIGLIT_PASS;
	unsigned i;

	glClear(GL_COLOR_BUFFER_BIT);

	for (i = 0; i < ARRAY_SIZE(progs); i++) {
		const int x = 1 + (i * (BOX_SIZE + 1));

		glBindProgramARB(GL_VERTEX_PROGRAM_ARB, progs[i]);
		glEnable(GL_CLIP_PLANE0 + i);
		piglit_draw_rect_tex(x, 1, BOX_SIZE, BOX_SIZE,
				     1.0, 1.0, -2.0, 0.0);
		glDisable(GL_CLIP_PLANE0 + i);

		if (!piglit_probe_pixel_rgb(x + (BOX_SIZE / 2),
					    1 + (BOX_SIZE / 2),
					    color)) {
			result = PIGLIT_FAIL;
		}
	}

	piglit_present_results();
	return result;
}
开发者ID:RAOF,项目名称:piglit,代码行数:28,代码来源:vp-clipdistance-03.c


示例7: piglit_display

enum piglit_result
piglit_display(void)
{
	const int tile_size = BOX_SIZE / 4;
	GLboolean pass = GL_TRUE;
	unsigned i;

	glClear(GL_COLOR_BUFFER_BIT);

	for (i = 0; i < TEST_COLS; i++) { 
		const int x = 1 + ((BOX_SIZE + 2) * i);

		glUniform1f(bias_loc, (float) i);

		/* Draw the rectangle the same size as the texture.  This
		 * guarantees that the unbiased LOD will be 0.0.
		 */
		piglit_draw_rect_tex((float) x, 1.0,
				     BOX_SIZE, BOX_SIZE,
				     0.0, 0.0, 1.0, 1.0);

		/* The middle of the lower left tile should be green, and the
		 * middle of the tile next to it should be the clear color.
		 */
		if (!piglit_probe_pixel_rgb(x + (3 * tile_size / 2), 2, clear_color)
		    || !piglit_probe_pixel_rgb(x + (tile_size / 2), 2, green)) {
			pass = GL_FALSE;
		}
	}

	glutSwapBuffers();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:blaztinn,项目名称:piglit,代码行数:34,代码来源:glsl-lod-bias.c


示例8: draw_and_test

static GLboolean
draw_and_test(int x_offset, int y_offset, float min_lod, float max_lod)
{
	GLfloat y;
	int dim;
	int level;
	GLboolean pass = GL_TRUE;

	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, max_lod);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, min_lod);

	y = y_offset;
	for (level = 0, dim = MAX_SIZE; dim > 0; level++, dim /= 2) {
		piglit_draw_rect_tex(x_offset, y, dim, dim,
				     0.0, 0.0, 1.0, 1.0);

		y += dim + PAD;
	}

	y = y_offset;
	for (level = 0, dim = MAX_SIZE; dim > 0; level++, dim /= 2) {
		pass = pass && test_results(x_offset, y,
					    dim, level,
					    min_lod, max_lod) && pass;

		y += dim + PAD;
	}

	return pass;
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:30,代码来源:lodclamp.c


示例9: draw

static enum piglit_result
draw(struct egl_state *state)
{
	EGLSurface *pixmap;
	EGLint inv;
	float red[] = { 0.4, 0.0, 0.0, 1.0 };
	float purple[] = { 0.5, 0.0, 0.5, 1.0 };
	enum piglit_result result = PIGLIT_PASS;

	if (!eglGetConfigAttrib(state->egl_dpy, state->cfg,
				EGL_Y_INVERTED_NOK, &inv)) {
		fprintf(stderr,
			"eglGetConfigAttrib(EGL_Y_INVERTED_NOK) failed\n");
		return PIGLIT_FAIL;
	}
	
	printf("EGL_Y_INVERTED_NOK: %s\n", inv ? "TRUE" : "FALSE");

	pixmap = egl_util_create_pixmap(state, 100, 100, pixmap_attribs);
	if (!eglMakeCurrent(state->egl_dpy, pixmap, pixmap, state->ctx)) {
		fprintf(stderr, "eglMakeCurrent() failed\n");
		piglit_report_result(PIGLIT_FAIL);
	}
	
	/* Clear pixmap to purple */
	glClearColor(0.5, 0.0, 0.5, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);

	if (!eglMakeCurrent(state->egl_dpy,
			    state->surf, state->surf, state->ctx)) {
		fprintf(stderr, "eglMakeCurrent() failed\n");
		piglit_report_result(PIGLIT_FAIL);
	}

	glViewport(0, 0, state->width, state->height);
	piglit_ortho_projection(state->width, state->height, GL_FALSE);

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

	glEnable(GL_TEXTURE_2D);
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

	eglBindTexImage(state->egl_dpy, pixmap, EGL_BACK_BUFFER);
	piglit_draw_rect_tex(20, 20, 100, 100,  0, 0, 1, 1);

	if (!piglit_probe_pixel_rgba(10, 10, red) ||
	    !piglit_probe_pixel_rgba(50, 10, red) ||
	    !piglit_probe_pixel_rgba(10, 50, red) ||
	    !piglit_probe_pixel_rgba(50, 50, purple) ||
	    !piglit_probe_pixel_rgba(110, 110, purple) ||
	    !piglit_probe_pixel_rgba(130, 130, red))
		result = PIGLIT_FAIL;

	eglSwapBuffers(state->egl_dpy, state->surf);

	return result;
}
开发者ID:chadversary,项目名称:piglit,代码行数:60,代码来源:egl-nok-texture-from-pixmap.c


示例10: test_etc1_rgb8_texture_8x8

static int
test_etc1_rgb8_texture_8x8(const struct etc1_rgb8_texture_8x8 *tex)
{
    const GLenum format = GL_ETC1_RGB8_OES;
    const GLsizei width = 8, height = 8;
    unsigned x, y;
    int pass = GL_TRUE;

    glCompressedTexImage2D(GL_TEXTURE_2D, 0,
            format, width, height, 0, sizeof(tex->data), tex->data);
    pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

    glEnable(GL_TEXTURE_2D);

    piglit_draw_rect_tex(0, 0, width, height, 0.0f, 0.0f, 1.0f, 1.0f);

    glDisable(GL_TEXTURE_2D);

    for (y = 0; y < height; y++) {
        for (x = 0; x < width; x++) {
            const GLubyte *rgb = tex->rgb[y * width + x];
            float expected[3] = {
                rgb[0] / 255.0f,
                rgb[1] / 255.0f,
                rgb[2] / 255.0f
            };

            pass = piglit_probe_pixel_rgb(x, y, expected) && pass;
        }
    }

    return pass;
}
开发者ID:blaztinn,项目名称:piglit,代码行数:33,代码来源:oes_compressed_etc1_rgb8_texture-basic.c


示例11: draw_rect

static void
draw_rect(int pos)
{
	int x, y, w, h;
	get_rect_bounds(pos, &x, &y, &w, &h);
	piglit_draw_rect_tex(x, y, w, h, 0, 0, 1, 1);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:7,代码来源:incomplete-texture.c


示例12: draw_quad_with_depth_texture

/** Draw quad textured with depth image on right side of window */
static void
draw_quad_with_depth_texture(void)
{
   GLfloat s1, t1;

   if (TexTarget == GL_TEXTURE_2D) {
      s1 = t1 = 1.0;
   }
   else {
      s1 = SIZE;
      t1 = SIZE;
   }

   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);

   glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

   glViewport(2 * SIZE, 0, SIZE, SIZE);

   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   glOrtho(-1.0, 1.0, -1.0, 1.0, -1, 1.0);

   glBindTexture(TexTarget, DepthTex);
   glEnable(TexTarget);

   piglit_draw_rect_tex(-1, -1, 2, 2, 0, 0, s1, t1);

   glDisable(TexTarget);
}
开发者ID:chadversary,项目名称:piglit,代码行数:33,代码来源:fbo-depth-sample-compare.c


示例13: piglit_display

enum piglit_result
piglit_display(void)
{
	glEnable(GL_TEXTURE_2D);

	glBindTexture(GL_TEXTURE_2D, rgba_tex);
	piglit_draw_rect_tex(-1.0, -1.0, 1.0, 2.0,
			     0.0, 0.0, 1.0, 1.0);

	glBindTexture(GL_TEXTURE_2D, other_tex);
	piglit_draw_rect_tex(0.0, -1.0, 1.0, 2.0,
			     0.0, 0.0, 1.0, 1.0);

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:chadversary,项目名称:piglit,代码行数:17,代码来源:fbo-rg.c


示例14: piglit_display

enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	int x, y;
	GLuint fb, tex;

	/* Draw the shader to the fbo. */
	fb = create_fbo(WIDTH, HEIGHT, &tex);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
	glViewport(0, 0, WIDTH, HEIGHT);

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

	glUseProgram(prog);
	piglit_draw_rect(-1, -1, 2, 2);

	/* Draw the FBO to the screen. */
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
	glViewport(0, 0, piglit_width, piglit_height);

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

	glBindTexture(GL_TEXTURE_2D, tex);
	glEnable(GL_TEXTURE_2D);
	glUseProgram(0);
	piglit_draw_rect_tex(-1, -1, 2, 2,
			     0, 0, 1, 1);

	glDisable(GL_TEXTURE_2D);
	glDeleteTextures(1, &tex);
	glDeleteFramebuffersEXT(1, &fb);

	assert(glGetError() == 0);

	for (y = 0; y < piglit_height; y++) {
		for (x = 0; x < piglit_width; x++) {
			float color[3];

			color[0] = x / 256.0;
			color[1] = y / 256.0;
			color[2] = 0;

			pass &= piglit_probe_pixel_rgb(x, y, color);
			if (!pass)
				break;
		}
	}

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:aphogat,项目名称:piglit,代码行数:55,代码来源:fbo-fragcoord.c


示例15: piglit_display

enum piglit_result
piglit_display(void)
{
	bool pass = true;
	float red[4] = {1.0, 0.0, 0.0, 0.0};
	float green[4] = {0.0, 1.0, 0.0, 0.0};
	GLuint q, texture;
	int tex_size = 64;
	int i;

	glClearColor(0.5, 0.5, 0.5, 0.5);
	glClear(GL_COLOR_BUFFER_BIT);

	/* Set up a texture object with green at level 0, red elsewhere */
	glGenTextures(1, &texture);
	glBindTexture(GL_TEXTURE_2D, texture);

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
			GL_LINEAR_MIPMAP_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);

	for (i = 0; tex_size / (1 << i) > 0; i++)
		fill_level(i, tex_size / (1 << i), i == 0 ? green : red);

	glGenQueries(1, &q);

	/* Generate query fail. */
	glBeginQuery(GL_SAMPLES_PASSED, q);
	glEndQuery(GL_SAMPLES_PASSED);

	/* Mipmap generation should not be affected by conditional rendering. */
	glBeginConditionalRenderNV(q, GL_QUERY_WAIT_NV);
	glGenerateMipmapEXT(GL_TEXTURE_2D);
	glEndConditionalRenderNV();

	/* This should draw level 1, since starting window size is 32
	 * and texture is 64.
	 */
	glEnable(GL_TEXTURE_2D);
	piglit_draw_rect_tex(-1, -1, 2, 2,
			     0, 0, 1, 1);
	glDisable(GL_TEXTURE_2D);

	pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
				      green);

	glutSwapBuffers();

	glDeleteQueries(1, &q);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:blaztinn,项目名称:piglit,代码行数:55,代码来源:generatemipmap.c


示例16: piglit_display

PIGLIT_GL_TEST_CONFIG_END

enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	GLuint tex, fb;
	GLenum status;
	float green[] = {0, 1, 0, 0};

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_2D, tex);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
		     piglit_width, piglit_height, 0,
		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

	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 (status = 0x%04x)\n", status);
		piglit_report_result(PIGLIT_SKIP);
	}

	glClearColor(1.0, 0.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT);
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_NEVER);
	glColor4fv(green);
	piglit_draw_rect(0, 0, piglit_width, piglit_height);

	pass = pass && piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, green);

	glDisable(GL_DEPTH_TEST);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
	glEnable(GL_TEXTURE_2D);
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
	piglit_draw_rect_tex(0, 0, piglit_width, piglit_height,
			     0, 0, 1, 1);
	glDisable(GL_TEXTURE_2D);

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:Zoxc,项目名称:piglit,代码行数:55,代码来源:fbo-nodepth-test.c


示例17: piglit_display

enum piglit_result
piglit_display(void)
{
	bool pass = true;
	float red[4] = {1.0, 0.0, 0.0, 0.0};
	float green[4] = {0.0, 1.0, 0.0, 0.0};
	GLuint q, texture;

	glClearColor(0.5, 0.5, 0.5, 0.5);
	glClear(GL_COLOR_BUFFER_BIT);

	/* Draw bottom half of window to green. */
	glColor4fv(green);
	piglit_draw_rect(-1, -1, 2, 1);
	glColor4f(1, 1, 1, 1);

	/* Set up a red texture. */
	glGenTextures(1, &texture);
	glBindTexture(GL_TEXTURE_2D, texture);

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
			GL_LINEAR_MIPMAP_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);

	fill_tex(0, piglit_width*2, piglit_height / 2, red);

	glGenQueries(1, &q);

	/* Generate query fail. */
	glBeginQuery(GL_SAMPLES_PASSED, q);
	glEndQuery(GL_SAMPLES_PASSED);

	/* This should not be affected by conditional rendering. */
	glBeginConditionalRenderNV(q, GL_QUERY_WAIT_NV);
	glCopyTexSubImage2D(GL_TEXTURE_2D, 0, piglit_width, 0, 0, 0, piglit_width, piglit_height / 2);
	glEndConditionalRenderNV();

	/* Draw the right half of the texture. */
	glEnable(GL_TEXTURE_2D);
	piglit_draw_rect_tex(-1, 0, 2, 1,
			     0.5, 0, 1, 1);
	glDisable(GL_TEXTURE_2D);

	pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
				      green);

	glutSwapBuffers();

	glDeleteQueries(1, &q);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:blaztinn,项目名称:piglit,代码行数:55,代码来源:copytexsubimage.c


示例18: piglit_display

enum piglit_result
piglit_display(void)
{
	bool pass = true;

	pass &= run_all_factor_sets();
	
	if (!piglit_automatic) {
		/* 
		 * Draw our three images, separated by some space. 
		 * This will show only the results of the last test.
		 */

		/* Draw dst */
		glEnable(GL_TEXTURE_2D);
		glBindTexture(GL_TEXTURE_2D, dst_img.name);
		piglit_draw_rect_tex(0, 0, img_width, img_height, 0, 0, 1, 1);

		/* Draw src */
		glBindTexture(GL_TEXTURE_2D, src_img.name);
		piglit_draw_rect_tex(img_width + 2, 0, 
			img_width, img_height, 0, 0, 1, 1);

		/* Draw exp */
		glBindTexture(GL_TEXTURE_2D, exp_img.name);
		/* Have to resend the texture to GL to update GL's copy */
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
			     img_width, img_height, 0, 
			     GL_RGBA, GL_FLOAT, exp_img.data);
		piglit_draw_rect_tex(2*(img_width + 2), 0, 
			img_width, img_height, 0, 0, 1, 1);
		glDisable(GL_TEXTURE_2D);
		
		piglit_present_results();
	}


	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
} /* piglit_display */
开发者ID:kalyankondapally,项目名称:piglit,代码行数:39,代码来源:blend.c


示例19: draw_mipmap

static void
draw_mipmap(int x, int y, int dim)
{
	glEnable(GL_TEXTURE_2D);
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

	piglit_draw_rect_tex(x, y, dim, dim,
			     0, 0, 1, 1);

	glDisable(GL_TEXTURE_2D);
}
开发者ID:chrisforbes,项目名称:piglit,代码行数:13,代码来源:fbo-clear-formats.c


示例20: piglit_display

enum piglit_result
piglit_display(void)
{
	glBindFramebuffer(GL_FRAMEBUFFER, fbo);
	glClearColor(0,0,1,0);
	glClear(GL_COLOR_BUFFER_BIT);

	glAlphaFunc(GL_GEQUAL, 0.5f);
	glEnable(GL_ALPHA_TEST);

	glUseProgram(prog);
	glViewport(0, 0, 64, 64);
	piglit_draw_rect(-1, -1, 2, 2);

	glDisable(GL_ALPHA_TEST);

	/* Visualize it */
	glUseProgram(0);
	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
	glViewport(0, 0, 128, 64);
	glClearColor(0,0,0.5,0);
	glClear(GL_COLOR_BUFFER_BIT);

	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, color1);
	piglit_draw_rect_tex(-1, -1, 1, 2,
			0, 0, 1, 1);
	glBindTexture(GL_TEXTURE_2D, color2);
	piglit_draw_rect_tex(0, -1, 1, 2,
			0, 0, 1, 1);
	glDisable(GL_TEXTURE_2D);
	piglit_present_results();

	/* The fragment colors are undefined in this test. So, we can't probe the
	 * pixels. If test executes to completion, return PIGLIT_PASS.
	 */
	return PIGLIT_PASS;
}
开发者ID:chemecse,项目名称:piglit,代码行数:38,代码来源:fbo-mrt-alphatest-no-buffer-zero-write.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ piglit_get_gl_enum_name函数代码示例发布时间:2022-05-30
下一篇:
C++ piglit_draw_rect函数代码示例发布时间: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