static int BoundsBehindViewerRun() { float mat[16]; IceTImage image; IceTInt rank; icetGetIntegerv(ICET_RANK, &rank); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); icetGLDrawCallback(draw); icetStrategy(ICET_STRATEGY_REDUCE); icetBoundingBoxd(-1.0, 1.0, -1.0, 1.0, -0.0, 0.0); icetSetColorFormat(ICET_IMAGE_COLOR_RGBA_UBYTE); icetSetDepthFormat(ICET_IMAGE_DEPTH_FLOAT); /* We're just going to use one tile. */ icetResetTiles(); icetAddTile(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0); /* Set up the transformation such that the quad in draw should cover the entire screen, but part of it extends behind the viewpoint. Furthermore, a naive division by w will show all points to the right of the screen (which, of course, is wrong). */ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslated(0.0, 0.0, -1.5); glRotated(10.0, 0.0, 1.0, 0.0); glScaled(10.0, 10.0, 10.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 2.0); printstat("Modelview matrix:\n"); glGetFloatv(GL_MODELVIEW_MATRIX, mat); PrintMatrix(mat); printstat("Projection matrix:\n"); glGetFloatv(GL_PROJECTION_MATRIX, mat); PrintMatrix(mat); /* Other normal OpenGL setup. */ glEnable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); glColor3d(1.0, 1.0, 1.0); /* All the processes have the same data. Go ahead and tell IceT. */ icetDataReplicationGroupColor(0); image = icetGLDrawFrame(); /* Test the resulting image to make sure the polygon was drawn over it. */ if (rank == 0) { IceTUInt *cb = icetImageGetColorui(image); if (cb[0] != 0xFFFFFFFF) { printstat("First pixel in color buffer wrong: 0x%x\n", cb[0]); return TEST_FAILED; } } return TEST_PASSED; }
int BoundsBehindViewer(int argc, char * argv[]) { float mat[16]; /* To remove warning */ (void)argc; (void)argv; GLint rank; icetGetIntegerv(ICET_RANK, &rank); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); icetDrawFunc(draw); icetStrategy(ICET_STRATEGY_REDUCE); icetBoundingBoxf(-1.0, 1.0, -1.0, 1.0, -0.0, 0.0); /* We're just going to use one tile. */ icetResetTiles(); icetAddTile(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0); /* Set up the transformation such that the quad in draw should cover the entire screen, but part of it extends behind the viewpoint. Furthermore, a naive division by w will show all points to the right of the screen (which, of course, is wrong). */ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0, 0.0, -1.5); glRotatef(10.0, 0.0, 1.0, 0.0); glScalef(10.0, 10.0, 10.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 2.0); printf("Modelview matrix:\n"); glGetFloatv(GL_MODELVIEW_MATRIX, mat); PrintMatrix(mat); printf("Projection matrix:\n"); glGetFloatv(GL_PROJECTION_MATRIX, mat); PrintMatrix(mat); /* Other normal OpenGL setup. */ glEnable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); glColor3f(1.0, 1.0, 1.0); /* All the processes have the same data. Go ahead and tell IceT. */ icetDataReplicationGroupColor(0); icetDrawFrame(); /* Test the resulting image to make sure the polygon was drawn over it. */ if (rank == 0) { GLuint *cb = (GLuint *)icetGetColorBuffer(); if (cb[0] != 0xFFFFFFFF) { printf("First pixel in color buffer wrong: 0x%x\n", cb[0]); finalize_test(TEST_FAILED); return TEST_FAILED; } } finalize_test(TEST_PASSED); return TEST_PASSED; }