/** * Test clamping for depth range near and far. Make sure clamped * to [0, 1]. Test default values for near and far. * OpenGL 4.3 Core section 13.6.1 ref: * "Values in v are each clamped to the range [0, 1] when specified." * */ static bool depth_range_bounds(GLint maxVP) { bool pass = true; GLdouble dr[2], drGet[2]; int i; /* intial values for near, far are 0.0, 1.0 repsectively */ for (i = 0; i < maxVP; i++) { glGetDoublei_v(GL_DEPTH_RANGE, i, dr); if (dr[0] != 0.0 || dr[1] != 1.0) { printf("depth_range default value wrong for idx %d\n", i); pass = false; } } pass = piglit_check_gl_error(GL_NO_ERROR) && pass; /* test clamping of depth_range values */ dr[0] = -0.001; dr[1] = 2.0; glDepthRangeArrayv(0, 1, dr); glGetDoublei_v(GL_DEPTH_RANGE, 0, drGet); if (drGet[0] != 0.0 || drGet[1] != 1.0) { printf("depth_range clamping failed glDepthRangeArrayv\n"); pass = false; } glDepthRangeIndexed(1, dr[0], dr[1]); glGetDoublei_v(GL_DEPTH_RANGE, 1, drGet); if (drGet[0] != 0.0 || drGet[1] != 1.0) { printf("depth_range clamping failed glDepthRangeIndexed\n"); pass = false; } return pass; }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL41_nglDepthRangeIndexed(JNIEnv *env, jclass clazz, jint index, jdouble n, jdouble f, jlong function_pointer) { glDepthRangeIndexedPROC glDepthRangeIndexed = (glDepthRangeIndexedPROC)((intptr_t)function_pointer); glDepthRangeIndexed(index, n, f); }
void GL3GraphicContextProvider::set_depth_range(int viewport, float n, float f) { OpenGL::set_active(this); glDepthRangeIndexed(viewport, (float)n, (float)f); }