本文整理汇总了C++中piglit_draw_rect函数的典型用法代码示例。如果您正苦于以下问题:C++ piglit_draw_rect函数的具体用法?C++ piglit_draw_rect怎么用?C++ piglit_draw_rect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了piglit_draw_rect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: piglit_display
enum piglit_result
piglit_display(void)
{
bool pass = true;
glClear(GL_COLOR_BUFFER_BIT);
for (int i = 0; true; ++i) {
glUniform1i(render_pass_loc, i);
if (i%2)
piglit_draw_rect(0, -1, 1, 2);
else
piglit_draw_rect(-1, -1, 1, 2);
if (i >= 5)
break;
glTextureBarrier();
}
unsigned color = 1;
color *= 2;
color += 2;
color ^= 1023;
color <<= 2;
const unsigned expected_left[] = { color, 0, 0, 1 };
color %= 32;
const unsigned expected_right[] = { color, 0, 0, 1 };
pass = piglit_probe_rect_rgba_uint(0, 0, width / 2, height,
expected_left) && pass;
pass = piglit_probe_rect_rgba_uint(width / 2, 0, width / 2, height,
expected_right) && pass;
pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:chemecse,项目名称:piglit,代码行数:35,代码来源:texture-halves-ping-pong-operation-chain.c
示例2: piglit_display
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result
piglit_display(void)
{
bool pass = true;
float green[4] = {0.0, 1.0, 0.0, 0.0};
float vertex_data[] = {
-0.5, -0.5,
0.5, -0.5,
0.0, 0.5,
0.0, 0.0
};
glDisable(GL_RASTERIZER_DISCARD);
glColor4f(0.0, 1.0, 0.0, 0.0);
piglit_draw_rect(-1, -1, 2, 2);
glEnable(GL_RASTERIZER_DISCARD);
glColor4f(1.0, 0.0, 0.0, 0.0);
piglit_draw_rect(-1, -1, 2, 2);
glVertexPointer(2, GL_FLOAT, 0, vertex_data);
glEnableClientState(GL_VERTEX_ARRAY);
glDrawArrays(GL_LINE_LOOP, 0, 3);
glDrawArrays(GL_POINTS, 3, 1);
pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:chemecse,项目名称:piglit,代码行数:32,代码来源:discard-drawarrays.c
示例3: test_readpixels
static enum piglit_result test_readpixels(void)
{
/* Clear stencil to 0xfe. */
glClearStencil(0xfefe);
glClear(GL_STENCIL_BUFFER_BIT);
/* Initialize stencil. */
glEnable(GL_STENCIL_TEST);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glStencilFunc(GL_ALWAYS, 0x3333 & mask, ~0);
piglit_draw_rect(-1, -1, 1, 1);
glStencilFunc(GL_ALWAYS, 0x6666 & mask, ~0);
piglit_draw_rect(0, -1, 1, 1);
glStencilFunc(GL_ALWAYS, 0x9999 & mask, ~0);
piglit_draw_rect(-1, 0, 1, 1);
glStencilFunc(GL_ALWAYS, 0xbbbb & mask, ~0);
piglit_draw_rect(0, 0, 1, 1);
glDisable(GL_STENCIL_TEST);
return compare_stencil();
}
开发者ID:blaztinn,项目名称:piglit,代码行数:26,代码来源:fbo-stencil.c
示例4: test_copy
static enum piglit_result test_copy(void)
{
/* Clear stencil to 0xfe. */
glClearStencil(0xfefe);
glClear(GL_STENCIL_BUFFER_BIT);
/* Initialize stencil. */
glEnable(GL_STENCIL_TEST);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
/* Set the upper-right corner to 0x3333 and copy the content to the lower-left one. */
glStencilFunc(GL_ALWAYS, 0x3333 & mask, ~0);
piglit_draw_rect(0, 0, 1, 1);
if (test == BLIT)
glBlitFramebufferEXT(BUF_SIZE/2+1, BUF_SIZE/2+1, BUF_SIZE, BUF_SIZE,
0, 0, BUF_SIZE/2, BUF_SIZE/2,
GL_STENCIL_BUFFER_BIT, GL_NEAREST);
else
glCopyPixels(BUF_SIZE/2+1, BUF_SIZE/2+1, BUF_SIZE/2, BUF_SIZE/2, GL_STENCIL);
/* Initialize the other corners. */
glStencilFunc(GL_ALWAYS, 0x6666 & mask, ~0);
piglit_draw_rect(0, -1, 1, 1);
glStencilFunc(GL_ALWAYS, 0x9999 & mask, ~0);
piglit_draw_rect(-1, 0, 1, 1);
glStencilFunc(GL_ALWAYS, 0xbbbb & mask, ~0);
piglit_draw_rect(0, 0, 1, 1);
glDisable(GL_STENCIL_TEST);
return compare_stencil();
}
开发者ID:blaztinn,项目名称:piglit,代码行数:34,代码来源:fbo-stencil.c
示例5: piglit_display
enum piglit_result
piglit_display(void)
{
GLboolean pass = GL_TRUE;
static const float green[] = {0.0, 1.0, 0.0, 0.0};
static const float blue[] = {0.0, 0.0, 1.0, 0.0};
glClearColor(1.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glFogfv(GL_FOG_COLOR, green);
piglit_draw_rect(-1, -1, 1, 2);
glFogfv(GL_FOG_COLOR, blue);
piglit_draw_rect(0, -1, 1, 2);
pass &= piglit_probe_rect_rgba(0, 0,
piglit_width / 2, piglit_height,
green);
pass &= piglit_probe_rect_rgba(piglit_width / 2, 0,
piglit_width / 2, piglit_height,
blue);
glutSwapBuffers();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:blaztinn,项目名称:piglit,代码行数:27,代码来源:glsl-fs-fogcolor-statechange.c
示例6: piglit_display
enum piglit_result
piglit_display(void)
{
GLboolean pass = GL_TRUE;
static float red[] = {1.0, 0.0, 0.0, 0.0};
static float green[] = {0.0, 1.0, 0.0, 0.0};
static float blue[] = {0.0, 0.0, 1.0, 0.0};
/* whole window gray -- none should be visible */
glClearColor(0.5, 0.5, 0.5, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* Clear stencil to 0, which will be drawn green */
glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT);
/* quad at 10, 10 that will be drawn blue. */
glEnable(GL_SCISSOR_TEST);
glScissor(10, 10, 10, 10);
glClearStencil(1);
glClear(GL_STENCIL_BUFFER_BIT);
/* 0-sized quad at 10, 30 that shouldn't be drawn (red) */
glScissor(10, 30, 0, 0);
glClearStencil(2);
glClear(GL_STENCIL_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
glEnable(GL_STENCIL_TEST);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
/* First quad -- stencil == 0 gets green */
glStencilFunc(GL_EQUAL, 0, ~0);
glColor4fv(green);
piglit_draw_rect(0, 0, piglit_width, piglit_height);
/* Second quad -- stencil == 1 gets blue */
glStencilFunc(GL_EQUAL, 1, ~0);
glColor4fv(blue);
piglit_draw_rect(0, 0, piglit_width, piglit_height);
/* Last quad -- stencil == 2 gets red (shouldn't occur!) */
glStencilFunc(GL_EQUAL, 2, ~0);
glColor4fv(red);
piglit_draw_rect(0, 0, piglit_width, piglit_height);
pass &= piglit_probe_rect_rgb(0, 0, piglit_width, 10, green);
pass &= piglit_probe_rect_rgb(0, 10, 10, 10, green);
pass &= piglit_probe_rect_rgb(10, 10, 10, 10, blue);
pass &= piglit_probe_rect_rgb(20, 10, piglit_width-20, 10, green);
pass &= piglit_probe_rect_rgb(0, 20, piglit_width, piglit_height - 20,
green);
glutSwapBuffers();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:blaztinn,项目名称:piglit,代码行数:59,代码来源:scissor-stencil-clear.c
示例7: piglit_display
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result
piglit_display(void)
{
static const char *vs_source =
"#version 140\n"
"in vec4 piglit_vertex;\n"
"void main()\n"
"{\n"
" gl_Position = piglit_vertex;\n"
"}\n";
static const char *fs_source =
"#version 140\n"
"uniform samplerBuffer s;\n"
"void main()\n"
"{\n"
" gl_FragColor = texelFetch(s, 0);\n"
"}\n";
bool pass = true;
GLuint tex, bo;
GLuint prog;
float green[] = {0, 1, 0, 0};
float blue[] = {0, 0, 1, 0};
uint8_t g_rgba8[] = {0x00, 0xff, 0x00, 0x00};
uint8_t b_rgba8[] = {0x00, 0x00, 0xff, 0x00};
prog = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(prog);
glGenBuffers(1, &bo);
glBindBuffer(GL_TEXTURE_BUFFER, bo);
/* Make the buffer bigger than the data to trigger the driver
* code path we want.
*/
glBufferData(GL_TEXTURE_BUFFER, 4096, NULL, GL_STREAM_DRAW);
glBufferSubData(GL_TEXTURE_BUFFER, 0, sizeof(g_rgba8), g_rgba8);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_BUFFER, tex);
glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA8, bo);
piglit_draw_rect(-1, -1, 1, 2);
glBufferSubData(GL_TEXTURE_BUFFER, 0, sizeof(b_rgba8), b_rgba8);
piglit_draw_rect(0, -1, 1, 2);
pass = pass && piglit_probe_rect_rgba(0, 0,
piglit_width / 2, piglit_height,
green);
pass = pass && piglit_probe_rect_rgba(piglit_width / 2, 0,
piglit_width / 2, piglit_height,
blue);
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:chemecse,项目名称:piglit,代码行数:59,代码来源:subdata-sync.c
示例8: hiz_run_test_stencil_read_common
/**
* Common functionality needed by hiz_run_test_stencil_read_fbo() and
* hiz_run_test_stencil_read_window().
*/
static bool
hiz_run_test_stencil_read_common()
{
static const float *expected_colors[9] = {
hiz_grey, hiz_blue, hiz_grey,
hiz_green, hiz_blue, hiz_grey,
hiz_green, hiz_green, hiz_grey,
};
static const unsigned expected_stencil[9] = {
4, 5, 4,
5, 6, 4,
5, 5, 3,
};
const float dx = piglit_width / 3.0;
const float dy = piglit_height / 3.0;
/* Set up depth state. */
glDisable(GL_DEPTH_TEST);
glClearDepth(hiz_clear_z);
/* Set up stencil state. */
glEnable(GL_STENCIL_TEST);
glClearStencil(3); /* 3 is a good canary. */
glStencilFunc(GL_LESS, 3, ~0);
glStencilOp(GL_INCR, GL_INCR, GL_INCR);
glClearColor(hiz_grey[0], hiz_grey[1], hiz_grey[2], hiz_grey[3]);
glClear(GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
| GL_STENCIL_BUFFER_BIT);
glViewport(0, 0, piglit_width, piglit_height);
piglit_ortho_projection(piglit_width, piglit_height, false);
/* Draw rect 1. */
glColor4fv(hiz_grey);
piglit_draw_rect(0 * dx, 0 * dy, /* x, y */
2 * dx, 3 * dy); /* w, h */
/* Draw rect 2. */
glColor4fv(hiz_green);
piglit_draw_rect(0 * dx, 0 * dy, /* x, y */
2 * dx, 2 * dy); /* w, h */
/* Draw rect 3. */
glColor4fv(hiz_blue);
piglit_draw_rect(1 * dx, 1 * dy, /* x, y */
2 * dx, 2 * dy); /* w, h */
if (!piglit_check_gl_error(0))
return false;
if (!hiz_probe_color_buffer(expected_colors))
return false;
return hiz_probe_stencil_buffer(expected_stencil);
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:62,代码来源:hiz-util.c
示例9: create_texcube
static GLuint
create_texcube(void)
{
GLuint tex, fb;
GLenum status;
int layer;
glGenTextures(1, &tex);
glBindTexture(target, tex);
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (test_array)
glTexStorage3D(target, TEX_LEVELS, format,
TEX_SIZE, TEX_SIZE, num_layers);
else
glTexStorage2D(target, TEX_LEVELS, format,
TEX_SIZE, TEX_SIZE);
glGenFramebuffers(1, &fb);
glBindFramebuffer(GL_FRAMEBUFFER, fb);
for (layer = 0; layer < num_layers; layer++) {
if (test_array)
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
tex, 0, layer);
else
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer,
tex, 0);
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
load_texcube();
goto done;
}
glViewport(0, 0, TEX_SIZE, TEX_SIZE);
piglit_ortho_projection(TEX_SIZE, TEX_SIZE, GL_FALSE);
glColor4fv(colors[(layer + 0) % NUM_COLORS]);
piglit_draw_rect(0, 0, TEX_HALF, TEX_HALF);
glColor4fv(colors[(layer + 2) % NUM_COLORS]);
piglit_draw_rect(TEX_HALF, 0, TEX_HALF, TEX_HALF);
glColor4fv(colors[(layer + 4) % NUM_COLORS]);
piglit_draw_rect(0, TEX_HALF, TEX_HALF, TEX_HALF);
glColor4fv(colors[(layer + 6) % NUM_COLORS]);
piglit_draw_rect(TEX_HALF, TEX_HALF, TEX_HALF, TEX_HALF);
}
done:
glGenerateMipmap(target);
glDeleteFramebuffers(1, &fb);
return tex;
}
开发者ID:chadversary,项目名称:piglit,代码行数:57,代码来源:fbo-generatemipmap-cubemap.c
示例10: 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);
}
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
glGenFramebuffersEXT(1, &fb);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D,
tex,
0);
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, 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:
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
glDeleteFramebuffersEXT(1, &fb);
return tex;
}
开发者ID:chemecse,项目名称:piglit,代码行数:57,代码来源:fbo-generatemipmap-scissor.c
示例11: 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);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
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);
}
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
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);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
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:chadversary,项目名称:piglit,代码行数:57,代码来源:fbo-generatemipmap-array.c
示例12: create_fbo
static int
create_fbo(void)
{
GLuint tex, copied_tex, fb;
GLenum status;
int i, dim;
int draw_w = TEX_WIDTH / 2, draw_h = TEX_HEIGHT / 2;
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);
/* Draw into the second level. */
glGenFramebuffersEXT(1, &fb);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D,
tex,
1);
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, draw_w, draw_h);
piglit_ortho_projection(draw_w, draw_h, GL_FALSE);
glColor4fv(red);
piglit_draw_rect(0, 0, draw_w / 2, draw_h / 2);
glColor4fv(green);
piglit_draw_rect(draw_w / 2, 0, draw_w, draw_h / 2);
glColor4fv(blue);
piglit_draw_rect(0, draw_h / 2, draw_w/2, draw_h);
glColor4fv(white);
piglit_draw_rect(draw_w / 2, draw_h / 2, draw_w, draw_h);
glGenTextures(1, &copied_tex);
glBindTexture(GL_TEXTURE_2D, copied_tex);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, draw_w, draw_h, 0);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
glDeleteFramebuffersEXT(1, &fb);
glDeleteTextures(1, &tex);
return copied_tex;
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:57,代码来源:fbo-copyteximage.c
示例13: conformOQ_GetObjivAval_multi1
/* If multiple queries are issued on the same target and id prior to calling
* GetQueryObject[u]iVARB, the result returned will always be from the last
* query issued. The results from any queries before the last one will be lost
* if the results are not retrieved before starting a new query on the same
* target and id.
*/
static bool
conformOQ_GetObjivAval_multi1(GLuint id)
{
GLint ready;
GLuint passed = 0;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glTranslatef(0.0, 0.0, -10.0);
/* draw the occluder (red) */
glColorMask(1, 1, 1, 1);
glDepthMask(GL_TRUE);
glColor3f(1, 0, 0);
piglit_draw_rect(-0.5, 0.5, 0.5, -0.5);
glPushMatrix();
glTranslatef(0.0, 0.0, -5.0);
glColorMask(0, 0, 0, 0);
glDepthMask(GL_FALSE);
/* draw the 1st box (green) which is occluded by the occluder partly */
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id);
glColor3f(0, 1, 0);
piglit_draw_rect(-0.51, 0.51, 0.51, -0.51);
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
/* draw the 2nd box (blue) which is occluded by the occluder throughly */
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id);
glColor3f(0, 0, 1);
piglit_draw_rect(-0.4, 0.4, 0.4, -0.4);
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
glPopMatrix();
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
do {
glGetQueryObjectivARB(id, GL_QUERY_RESULT_AVAILABLE_ARB,
&ready);
} while (!ready);
glGetQueryObjectuivARB(id, GL_QUERY_RESULT_ARB, &passed);
/* 'passed' should be zero */
return passed > 0 ? false : true;
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:62,代码来源:occlusion_query_conform.c
示例14: run_test
PIGLIT_GL_TEST_CONFIG_END
static bool
run_test(bool scissor_clear)
{
GLuint query;
GLint result = -1;
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glClearColor(0.0, 1.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glGenQueries(1, &query);
glBeginQuery(GL_SAMPLES_PASSED, query);
/* Render 64 pixels. This should affect the query */
piglit_draw_rect(0, 0, 8, 8);
/* Clear the framebuffer. This shouldn't affect the query */
glClearColor(0.0, 0.0, 1.0, 0.0);
if (scissor_clear) {
glScissor(0, 0, piglit_width / 2, piglit_height / 2);
glEnable(GL_SCISSOR_TEST);
}
glClear(GL_COLOR_BUFFER_BIT);
if (scissor_clear) {
glDisable(GL_SCISSOR_TEST);
}
/* Render another 64 pixels. This should continue adding to
* the query */
piglit_draw_rect(4, 0, 8, 8);
glEndQuery(GL_SAMPLES_PASSED);
glGetQueryObjectiv(query, GL_QUERY_RESULT, &result);
glDeleteQueries(1, &query);
piglit_present_results();
if (result != 128) {
printf("Failure: \n");
printf(" Occlusion query resulted in %d samples "
"(expected 128)\n",
result);
printf(" Scissor enabled? %s\n", scissor_clear ? "yes" : "no");
return false;
} else {
return true;
}
}
开发者ID:chemecse,项目名称:piglit,代码行数:55,代码来源:occlusion_query_meta_save.c
示例15: 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);
/* Bind back to the (small) window to trigger the bug */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
glGenerateMipmapEXT(GL_TEXTURE_2D);
done:
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
glDeleteFramebuffersEXT(1, &fb);
return tex;
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:55,代码来源:fbo-generatemipmap-viewport.c
示例16: 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);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
glGenFramebuffersEXT(1, &fb);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D,
tex,
0);
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");
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:BNieuwenhuizen,项目名称:piglit,代码行数:55,代码来源:fbo-copyteximage-simple.c
示例17: piglit_display
enum piglit_result
piglit_display(void)
{
static const float green[3] = { 0.0, 1.0, 0.0 };
static const float blue[3] = { 0.0, 0.0, 1.0 };
enum piglit_result result = PIGLIT_PASS;
float x = 10.0;
glClear(GL_COLOR_BUFFER_BIT);
glColor3fv(blue);
/* Bind the separately linked vertex shader and the separately linked
* fragment shader using the new interfaces. This should produce a
* green box.
*/
glUseShaderProgramEXT(GL_VERTEX_SHADER, prog[0]);
glUseShaderProgramEXT(GL_FRAGMENT_SHADER, prog[1]);
piglit_draw_rect(x, 10, 10, 10);
if (!piglit_probe_pixel_rgb(x + 5, 15, green))
result = PIGLIT_FAIL;
x += 20.0;
/* Bind the vertex shader that is already linked with a fragment
* shader and the separately linked fragment shader using the new
* interfaces. This should produce a green box.
*
* If the linked optimized away the vertex shader writes to
* gl_FrontColor (because the fragment shader in prog[2] does not use
* it), this will produce incorrect results.
*/
glUseProgram(prog[2]);
glUseShaderProgramEXT(GL_FRAGMENT_SHADER, prog[1]);
piglit_draw_rect(x, 10, 10, 10);
if (!piglit_probe_pixel_rgb(x + 5, 15, green))
result = PIGLIT_FAIL;
x += 20.0;
/* Unbind any program from the vertex shader stage so that fixed
* function is used. This should produce the same results as the
* vertex shader except that fixed-function outputs blue.
*/
glUseShaderProgramEXT(GL_VERTEX_SHADER, 0);
piglit_draw_rect(x, 10, 10, 10);
if (!piglit_probe_pixel_rgb(x + 5, 15, blue))
result = PIGLIT_FAIL;
if (!piglit_automatic)
glutSwapBuffers();
return result;
}
开发者ID:blaztinn,项目名称:piglit,代码行数:53,代码来源:sso-simple.c
示例18: create_array_fbo_1d
static GLuint
create_array_fbo_1d(void)
{
GLuint tex, fb;
GLenum status;
int i, dim;
int layer;
if (format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT)
return 0;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_1D_ARRAY_EXT, tex);
assert(glGetError() == 0);
for (i = 0, dim = TEX_WIDTH; dim >0; i++, dim /= 2) {
glTexImage2D(GL_TEXTURE_1D_ARRAY_EXT, i, format,
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_1d_array();
goto done;
}
glViewport(0, 0, TEX_WIDTH, 1);
piglit_ortho_projection(TEX_WIDTH, 1, GL_FALSE);
glColor4fv(layer_color[layer]);
piglit_draw_rect(0, 0, TEX_WIDTH / 2, 1);
glColor4fv(layer_color[(layer + 1) % 4]);
piglit_draw_rect(TEX_WIDTH / 2, 0, TEX_WIDTH, 1);
}
done:
glDeleteFramebuffersEXT(1, &fb);
glGenerateMipmapEXT(GL_TEXTURE_1D_ARRAY_EXT);
return tex;
}
开发者ID:aphogat,项目名称:piglit,代码行数:53,代码来源:fbo-generatemipmap-array.c
示例19: blend
static void blend(const float *src, const float *src1, const float *dst,
GLenum blendsrc, GLenum blenddst, GLenum blendop)
{
glUniform4fv(uniform_src0, 1, dst);
piglit_draw_rect(0, 0, piglit_width, piglit_height);
glEnable(GL_BLEND);
glBlendEquation(blendop);
glBlendFunc(blendsrc, blenddst);
glUniform4fv(uniform_src0, 1, src);
glUniform4fv(uniform_src1, 1, src1);
piglit_draw_rect(0, 0, piglit_width, piglit_height);
glDisable(GL_BLEND);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:13,代码来源:fbo-extended-blend.c
示例20: piglit_display
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result
piglit_display(void)
{
bool pass = true;
float green[4] = {0.0, 1.0, 0.0, 0.0};
GLuint q;
GLuint list;
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glClearColor(0.5, 0.5, 0.5, 0.5);
glClear(GL_COLOR_BUFFER_BIT);
glGenQueries(1, &q);
/* Generate query pass: draw bottom half of screen. */
glColor4f(0.0, 1.0, 0.0, 0.0);
glBeginQuery(GL_SAMPLES_PASSED, q);
piglit_draw_rect(-1, -1, 2, 1);
glEndQuery(GL_SAMPLES_PASSED);
/* Conditional render that should draw top half of screen. */
glBeginConditionalRenderNV(q, GL_QUERY_WAIT_NV);
piglit_draw_rect(-1, 0, 2, 1);
glEndConditionalRenderNV();
/* Generate query fail */
glBeginQuery(GL_SAMPLES_PASSED, q);
glEndQuery(GL_SAMPLES_PASSED);
/* Conditional render that should not draw full screen. */
glBeginConditionalRenderNV(q, GL_QUERY_WAIT_NV);
glColor4f(1.0, 0.0, 0.0, 0.0);
piglit_draw_rect(-1, -1, 2, 2);
glEndConditionalRenderNV();
glEndList();
glCallList(list);
pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
green);
piglit_present_results();
glDeleteQueries(1, &q);
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:50,代码来源:dlist.c
注:本文中的piglit_draw_rect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论