Removed the GLclampd declaration and replaced its usage with GLdouble to standardize the OSG extension setup with current GL/GLES headers.

Added a float fallback from osg::DepthDangeIndex to suppprt GLES.
This commit is contained in:
Robert Osfield 2017-08-16 14:20:00 +01:00
parent bfbaecaf49
commit f3adcda6b7
4 changed files with 11 additions and 9 deletions

View File

@ -690,10 +690,6 @@ namespace osg
#endif
#endif
#endif
#if defined(OSG_GLES1_FEATURES) || defined(OSG_GLES2_FEATURES)|| defined(OSG_GLES3_FEATURES)
typedef double GLclampd;
#endif
}
#endif

View File

@ -557,7 +557,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
bool isSGIXMinMaxSupported;
bool isLogicOpSupported;
void (GL_APIENTRY * glBlendColor) (GLclampf red , GLclampf green , GLclampf blue , GLclampf alpha);
void (GL_APIENTRY * glBlendColor) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
void (GL_APIENTRY * glBlendEquation)(GLenum mode);
void (GL_APIENTRY * glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha);
void (GL_APIENTRY * glBlendEquationi)(GLuint buf, GLenum mode);
@ -599,7 +599,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
bool isMultisampleSupported;
bool isMultisampleFilterHintSupported;
void (GL_APIENTRY * glSampleCoverage) (GLclampf value, GLboolean invert);
void (GL_APIENTRY * glSampleCoverage) (GLfloat value, GLboolean invert);
// Point
@ -725,8 +725,9 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
void (GL_APIENTRY * glScissorArrayv) (GLuint first, GLsizei count, const GLint * v);
void (GL_APIENTRY * glScissorIndexed) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
void (GL_APIENTRY * glScissorIndexedv) (GLuint index, const GLint * v);
void (GL_APIENTRY * glDepthRangeArrayv) (GLuint first, GLsizei count, const GLclampd * v);
void (GL_APIENTRY * glDepthRangeIndexed) (GLuint index, GLclampd n, GLclampd f);
void (GL_APIENTRY * glDepthRangeArrayv) (GLuint first, GLsizei count, const GLdouble * v);
void (GL_APIENTRY * glDepthRangeIndexed) (GLuint index, GLdouble n, GLdouble f);
void (GL_APIENTRY * glDepthRangeIndexedf) (GLuint index, GLfloat n, GLfloat f);
void (GL_APIENTRY * glGetFloati_v) (GLenum target, GLuint index, GLfloat *data);
void (GL_APIENTRY * glGetDoublei_v) (GLenum target, GLuint index, GLdouble *data);

View File

@ -41,7 +41,11 @@ void DepthRangeIndexed::apply(State& state) const
const GLExtensions* extensions = state.get<GLExtensions>();
if (extensions->glDepthRangeIndexed)
{
extensions->glDepthRangeIndexed(static_cast<GLuint>(_index), static_cast<GLclampd>(_zNear), static_cast<GLclampd>(_zFar));
extensions->glDepthRangeIndexed(static_cast<GLuint>(_index), static_cast<GLdouble>(_zNear), static_cast<GLdouble>(_zFar));
}
else if (extensions->glDepthRangeIndexedf)
{
extensions->glDepthRangeIndexedf(static_cast<GLuint>(_index), static_cast<GLfloat>(_zNear), static_cast<GLfloat>(_zFar));
}
else
{

View File

@ -1171,6 +1171,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
osg::setGLExtensionFuncPtr(glScissorIndexedv, "glScissorIndexedv", validContext);
osg::setGLExtensionFuncPtr(glDepthRangeArrayv, "glDepthRangeArrayv", validContext);
osg::setGLExtensionFuncPtr(glDepthRangeIndexed, "glDepthRangeIndexed", validContext);
osg::setGLExtensionFuncPtr(glDepthRangeIndexedf, "glDepthRangeIndexedfOES", "glDepthRangeIndexedfNV", validContext);
osg::setGLExtensionFuncPtr(glGetFloati_v, "glGetFloati_v", validContext);
osg::setGLExtensionFuncPtr(glGetDoublei_v, "glGetDoublei_v", validContext);
osg::setGLExtensionFuncPtr(glGetIntegerIndexedvEXT, "glGetIntegerIndexedvEXT", validContext);