Seamless cube map sampling in OpenGL

This commit is contained in:
rdb 2014-06-18 22:29:50 +00:00
parent 8d3f7d62f4
commit df30721f79
4 changed files with 27 additions and 6 deletions

View File

@ -571,7 +571,7 @@ reset() {
_supports_depth_stencil =
has_extension("GL_EXT_packed_depth_stencil") || has_extension("GL_OES_packed_depth_stencil");
}
_supports_3d_texture = false;
if (is_at_least_gl_version(1, 2)) {
@ -634,12 +634,19 @@ reset() {
}
#endif
_cube_map_seamless = false;
#ifdef OPENGLES_2
_supports_cube_map = true;
#else
_supports_cube_map =
has_extension("GL_ARB_texture_cube_map") || is_at_least_gl_version(1, 3) ||
has_extension("GL_OES_texture_cube_map");
if (_supports_cube_map && gl_cube_map_seamless) {
if (is_at_least_gl_version(3, 2) || has_extension("GL_ARB_seamless_cube_map")) {
_cube_map_seamless = true;
}
}
#endif
_supports_compressed_texture = false;
@ -2214,6 +2221,10 @@ begin_frame(Thread *current_thread) {
}
#endif // NDEBUG
if (_cube_map_seamless) {
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
}
report_my_gl_errors();
return true;
}

View File

@ -579,6 +579,7 @@ public:
PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC _glCompressedTexSubImage3D;
PFNGLGETCOMPRESSEDTEXIMAGEPROC _glGetCompressedTexImage;
bool _cube_map_seamless;
bool _supports_bgr;
bool _supports_rescale_normal;

View File

@ -141,11 +141,11 @@ ConfigVariableBool gl_finish
"This variable is enabled only if PStats is compiled in."));
ConfigVariableBool gl_force_depth_stencil
("gl-force-depth-stencil", false,
("gl-force-depth-stencil", false,
PRC_DESC("Temporary hack variable 7x00 vs 8x00 nVidia bug. See glGraphicsStateGuardian_src.cxx."));
ConfigVariableBool gl_matrix_palette
("gl-matrix-palette", false,
("gl-matrix-palette", false,
PRC_DESC("Temporary hack variable protecting untested code. See glGraphicsStateGuardian_src.cxx."));
ConfigVariableBool gl_force_no_error
@ -153,17 +153,26 @@ ConfigVariableBool gl_force_no_error
PRC_DESC("Avoid reporting OpenGL errors, for a small performance benefit."));
ConfigVariableBool gl_force_no_flush
("gl-force-no-flush", false,
("gl-force-no-flush", false,
PRC_DESC("Avoid calling glFlush(), for a potential performance benefit. This may be a little dangerous."));
ConfigVariableBool gl_separate_specular_color
("gl-separate-specular-color", true,
("gl-separate-specular-color", true,
PRC_DESC("When separate specular mode is on, the specular component "
"will be written to the secondary instead of the primary "
"color, which is added after the texturing stage. In other "
"words, the specular highlight will be unmodulated by the "
"color of the texture."));
ConfigVariableBool gl_cube_map_seamless
("gl-cube-map-seamless", true,
PRC_DESC("This configures Panda to try and enable seamless cube map "
"sampling when supported. This will help to remove seams "
"that show up at cube map edges, especially at lower "
"resolutions. On by default; disable if you suspect that "
"this is causing problems or if you simply don't need the "
"functionality."));
extern ConfigVariableBool gl_parallel_arrays;
void CLP(init_classes)() {
@ -189,4 +198,3 @@ void CLP(init_classes)() {
// since we won't know those until we create a graphics context (and
// the answer may be different for different contexts).
}

View File

@ -62,6 +62,7 @@ extern ConfigVariableBool gl_matrix_palette;
extern ConfigVariableBool gl_force_no_error;
extern ConfigVariableBool gl_force_no_flush;
extern ConfigVariableBool gl_separate_specular_color;
extern ConfigVariableBool gl_cube_map_seamless;
extern EXPCL_GL void CLP(init_classes)();