Merge pull request #221 from tomhog/topic-gles3-ios
GLES3 support improvements on iOS
This commit is contained in:
@@ -30,7 +30,7 @@ void Depth::apply(State&) const
|
||||
{
|
||||
glDepthFunc((GLenum)_func);
|
||||
glDepthMask((GLboolean)_depthWriteMask);
|
||||
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
|
||||
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
|
||||
glDepthRangef(_zNear,_zFar);
|
||||
#else
|
||||
glDepthRange(_zNear,_zFar);
|
||||
|
||||
@@ -172,13 +172,13 @@
|
||||
#define GL_NONE 0x0
|
||||
#endif
|
||||
|
||||
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
|
||||
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
|
||||
//GLES defines (OES)
|
||||
#define GL_RGB8_OES 0x8051
|
||||
#define GL_RGBA8_OES 0x8058
|
||||
#endif
|
||||
|
||||
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GL3_AVAILABLE)
|
||||
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE) || defined(OSG_GL3_AVAILABLE)
|
||||
#define GL_POLYGON 0x0009
|
||||
#define GL_QUADS 0x0007
|
||||
#define GL_QUAD_STRIP 0x0008
|
||||
|
||||
@@ -451,7 +451,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
glVersion = validContext ? findAsciiToFloat( versionString ) : 0.0f;
|
||||
glslLanguageVersion = 0.0f;
|
||||
|
||||
bool shadersBuiltIn = OSG_GLES2_FEATURES || OSG_GL3_FEATURES;
|
||||
bool shadersBuiltIn = OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES;
|
||||
|
||||
isShaderObjectsSupported = validContext && (shadersBuiltIn || osg::isGLExtensionSupported(contextID,"GL_ARB_shader_objects"));
|
||||
isVertexShaderSupported = validContext && (shadersBuiltIn || osg::isGLExtensionSupported(contextID,"GL_ARB_vertex_shader"));
|
||||
@@ -472,7 +472,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
isGLExtensionSupported(contextID,"GL_NV_texture_rectangle"));
|
||||
|
||||
isCubeMapSupported = validContext &&
|
||||
(OSG_GLES2_FEATURES || OSG_GL3_FEATURES ||
|
||||
(OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES ||
|
||||
isGLExtensionSupported(contextID,"GL_ARB_texture_cube_map") ||
|
||||
isGLExtensionSupported(contextID,"GL_EXT_texture_cube_map") ||
|
||||
(glVersion >= 1.3f));
|
||||
@@ -718,17 +718,17 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
setGLExtensionFuncPtr(glBindBufferBase, "glBindBufferBase", "glBindBufferBaseEXT", "glBindBufferBaseNV" , validContext);
|
||||
setGLExtensionFuncPtr(glTexBuffer, "glTexBuffer","glTexBufferARB" , validContext);
|
||||
|
||||
isVBOSupported = validContext && (OSG_GLES2_FEATURES || OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID,"GL_ARB_vertex_buffer_object"));
|
||||
isPBOSupported = validContext && (OSG_GLES2_FEATURES || OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID,"GL_ARB_pixel_buffer_object"));
|
||||
isVBOSupported = validContext && (OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID,"GL_ARB_vertex_buffer_object"));
|
||||
isPBOSupported = validContext && (OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID,"GL_ARB_pixel_buffer_object"));
|
||||
isTBOSupported = validContext && osg::isGLExtensionSupported(contextID,"GL_ARB_texture_buffer_object");
|
||||
isVAOSupported = validContext && (OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID, "GL_ARB_vertex_array_object", "GL_OES_vertex_array_object"));
|
||||
isVAOSupported = validContext && (OSG_GLES3_FEATURES || OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID, "GL_ARB_vertex_array_object", "GL_OES_vertex_array_object"));
|
||||
isTransformFeedbackSupported = validContext && osg::isGLExtensionSupported(contextID, "GL_ARB_transform_feedback2");
|
||||
isBufferObjectSupported = isVBOSupported && isPBOSupported;
|
||||
|
||||
|
||||
// BlendFunc extensions
|
||||
isBlendFuncSeparateSupported = validContext &&
|
||||
(OSG_GLES2_FEATURES || OSG_GL3_FEATURES ||
|
||||
(OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES ||
|
||||
osg::isGLExtensionSupported(contextID, "GL_EXT_blend_func_separate") ||
|
||||
(glVersion >= 1.4f));
|
||||
|
||||
@@ -820,7 +820,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
bool radeonHardwareDetected = (rendererString.find("Radeon")!=std::string::npos || rendererString.find("RADEON")!=std::string::npos);
|
||||
bool fireGLHardwareDetected = (rendererString.find("FireGL")!=std::string::npos || rendererString.find("FIREGL")!=std::string::npos);
|
||||
|
||||
bool builtInSupport = OSG_GLES2_FEATURES || OSG_GL3_FEATURES;
|
||||
bool builtInSupport = OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES;
|
||||
|
||||
isMultiTexturingSupported = validContext &&
|
||||
(builtInSupport || OSG_GLES1_FEATURES ||
|
||||
@@ -852,7 +852,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
isTextureBorderClampSupported = validContext &&
|
||||
(OSG_GL3_FEATURES ||
|
||||
((OSG_GL1_FEATURES || OSG_GL2_FEATURES) && isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_border_clamp", 1.3f)) ||
|
||||
(OSG_GLES2_FEATURES && isGLExtensionSupported(contextID,"GL_EXT_texture_border_clamp")));
|
||||
((OSG_GLES2_FEATURES || OSG_GLES3_FEATURES) && isGLExtensionSupported(contextID,"GL_EXT_texture_border_clamp")));
|
||||
|
||||
isGenerateMipMapSupported = validContext && (builtInSupport || isGLExtensionOrVersionSupported(contextID,"GL_SGIS_generate_mipmap", 1.4f));
|
||||
preferGenerateMipmapSGISForPowerOfTwo = (radeonHardwareDetected||fireGLHardwareDetected) ? false : true;
|
||||
@@ -939,13 +939,13 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
|
||||
// Blending
|
||||
isBlendColorSupported = validContext &&
|
||||
(OSG_GLES2_FEATURES || OSG_GL3_FEATURES ||
|
||||
(OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES ||
|
||||
isGLExtensionSupported(contextID,"GL_EXT_blend_color") ||
|
||||
(glVersion >= 1.2f));
|
||||
|
||||
setGLExtensionFuncPtr(glBlendColor, "glBlendColor", "glBlendColorEXT", validContext);
|
||||
|
||||
bool bultInSupport = OSG_GLES2_FEATURES || OSG_GL3_FEATURES;
|
||||
bool bultInSupport = OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES;
|
||||
isBlendEquationSupported = validContext &&
|
||||
(bultInSupport ||
|
||||
isGLExtensionSupported(contextID, "GL_EXT_blend_equation") ||
|
||||
@@ -1012,7 +1012,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
isGLExtensionSupported(contextID,"GL_SGIS_point_parameters"));
|
||||
|
||||
|
||||
isPointSpriteSupported = validContext && (OSG_GL3_FEATURES || isGLExtensionSupported(contextID, "GL_ARB_point_sprite") || isGLExtensionSupported(contextID, "GL_OES_point_sprite") || isGLExtensionSupported(contextID, "GL_NV_point_sprite"));
|
||||
isPointSpriteSupported = validContext && (OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES || isGLExtensionSupported(contextID, "GL_ARB_point_sprite") || isGLExtensionSupported(contextID, "GL_OES_point_sprite") || isGLExtensionSupported(contextID, "GL_NV_point_sprite"));
|
||||
isPointSpriteCoordOriginSupported = validContext && (OSG_GL3_FEATURES || (glVersion >= 2.0f));
|
||||
|
||||
|
||||
@@ -1027,7 +1027,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
|
||||
|
||||
// Multisample
|
||||
isMultisampleSupported = validContext && (OSG_GLES2_FEATURES || OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_ARB_multisample"));
|
||||
isMultisampleSupported = validContext && (OSG_GLES2_FEATURES || OSG_GLES2_FEATURES || OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_ARB_multisample"));
|
||||
isMultisampleFilterHintSupported = validContext && isGLExtensionSupported(contextID, "GL_NV_multisample_filter_hint");
|
||||
|
||||
setGLExtensionFuncPtr(glSampleCoverage, "glSampleCoverage", "glSampleCoverageARB", validContext);
|
||||
@@ -1159,7 +1159,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
|
||||
if (validContext)
|
||||
{
|
||||
if (osg::getGLVersionNumber() >= 2.0 || osg::isGLExtensionSupported(contextID, "GL_ARB_vertex_shader") || OSG_GLES2_FEATURES || OSG_GL3_FEATURES)
|
||||
if (osg::getGLVersionNumber() >= 2.0 || osg::isGLExtensionSupported(contextID, "GL_ARB_vertex_shader") || OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES)
|
||||
{
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,&glMaxTextureUnits);
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
|
||||
@@ -1061,7 +1061,7 @@ void Image::readPixels(int x,int y,int width,int height,
|
||||
|
||||
void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMapsIfAvailable, GLenum type, unsigned int face)
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
// OSG_NOTICE<<"Image::readImageFromCurrentTexture()"<<std::endl;
|
||||
|
||||
const osg::GLExtensions* extensions = osg::GLExtensions::Get(contextID,true);
|
||||
|
||||
@@ -68,7 +68,7 @@ PolygonMode::Mode PolygonMode::getMode(Face face) const
|
||||
|
||||
void PolygonMode::apply(State&) const
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
if (_modeFront==_modeBack)
|
||||
{
|
||||
glPolygonMode(GL_FRONT_AND_BACK,(GLenum)_modeFront);
|
||||
|
||||
@@ -181,7 +181,7 @@ void State::initializeExtensionProcs()
|
||||
|
||||
_isSecondaryColorSupported = osg::isGLExtensionSupported(_contextID,"GL_EXT_secondary_color");
|
||||
_isFogCoordSupported = osg::isGLExtensionSupported(_contextID,"GL_EXT_fog_coord");
|
||||
_isVertexBufferObjectSupported = OSG_GLES2_FEATURES || OSG_GL3_FEATURES || osg::isGLExtensionSupported(_contextID,"GL_ARB_vertex_buffer_object");
|
||||
_isVertexBufferObjectSupported = OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES || osg::isGLExtensionSupported(_contextID,"GL_ARB_vertex_buffer_object");
|
||||
_isVertexArrayObjectSupported = _glExtensions->isVAOSupported;
|
||||
|
||||
const DisplaySettings* ds = getDisplaySettings() ? getDisplaySettings() : osg::DisplaySettings::instance().get();
|
||||
@@ -226,7 +226,7 @@ void State::initializeExtensionProcs()
|
||||
setGLExtensionFuncPtr(_glDrawArraysInstanced, "glDrawArraysInstanced","glDrawArraysInstancedARB","glDrawArraysInstancedEXT");
|
||||
setGLExtensionFuncPtr(_glDrawElementsInstanced, "glDrawElementsInstanced","glDrawElementsInstancedARB","glDrawElementsInstancedEXT");
|
||||
|
||||
if (osg::getGLVersionNumber() >= 2.0 || osg::isGLExtensionSupported(_contextID, "GL_ARB_vertex_shader") || OSG_GLES2_FEATURES || OSG_GL3_FEATURES)
|
||||
if (osg::getGLVersionNumber() >= 2.0 || osg::isGLExtensionSupported(_contextID, "GL_ARB_vertex_shader") || OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES)
|
||||
{
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,&_glMaxTextureUnits);
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
|
||||
@@ -2133,7 +2133,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
|
||||
{
|
||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE,GL_TRUE);
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_PRIORITY,0.0f);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ void Texture1D::setImage(Image* image)
|
||||
|
||||
void Texture1D::apply(State& state) const
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
// get the contextID (user defined ID of 0 upwards) for the
|
||||
// current OpenGL context.
|
||||
const unsigned int contextID = state.getContextID();
|
||||
@@ -267,7 +267,7 @@ void Texture1D::computeInternalFormat() const
|
||||
|
||||
void Texture1D::applyTexImage1D(GLenum target, Image* image, State& state, GLsizei& inwidth, GLsizei& numMipmapLevels) const
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
// if we don't have a valid image we can't create a texture!
|
||||
if (!image || !image->data())
|
||||
return;
|
||||
@@ -378,7 +378,7 @@ void Texture1D::applyTexImage1D(GLenum target, Image* image, State& state, GLsiz
|
||||
|
||||
void Texture1D::copyTexImage1D(State& state, int x, int y, int width)
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
const unsigned int contextID = state.getContextID();
|
||||
|
||||
// get the texture object for the current contextID.
|
||||
@@ -435,7 +435,7 @@ void Texture1D::copyTexImage1D(State& state, int x, int y, int width)
|
||||
|
||||
void Texture1D::copyTexSubImage1D(State& state, int xoffset, int x, int y, int width)
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
const unsigned int contextID = state.getContextID();
|
||||
|
||||
// get the texture object for the current contextID.
|
||||
@@ -467,7 +467,7 @@ void Texture1D::copyTexSubImage1D(State& state, int xoffset, int x, int y, int w
|
||||
|
||||
void Texture1D::allocateMipmap(State& state) const
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
const unsigned int contextID = state.getContextID();
|
||||
|
||||
// get the texture object for the current contextID.
|
||||
|
||||
@@ -321,7 +321,7 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st
|
||||
{
|
||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE,GL_TRUE);
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_PRIORITY,0.0f);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ void PixelStorageModes::retrieveStoreModes()
|
||||
{
|
||||
glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpack_alignment);
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glGetIntegerv(GL_UNPACK_ROW_LENGTH, &unpack_row_length);
|
||||
glGetIntegerv(GL_UNPACK_SKIP_ROWS, &unpack_skip_rows);
|
||||
glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &unpack_skip_pixels);
|
||||
@@ -276,7 +276,7 @@ void PixelStorageModes::retrieveStoreModes()
|
||||
#endif
|
||||
|
||||
glGetIntegerv(GL_PACK_ALIGNMENT, &pack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glGetIntegerv(GL_PACK_ROW_LENGTH, &pack_row_length);
|
||||
glGetIntegerv(GL_PACK_SKIP_ROWS, &pack_skip_rows);
|
||||
glGetIntegerv(GL_PACK_SKIP_PIXELS, &pack_skip_pixels);
|
||||
@@ -288,7 +288,7 @@ void PixelStorageModes::retrieveStoreModes()
|
||||
void PixelStorageModes::retrieveStoreModes3D()
|
||||
{
|
||||
glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glGetIntegerv(GL_UNPACK_ROW_LENGTH, &unpack_row_length);
|
||||
glGetIntegerv(GL_UNPACK_SKIP_ROWS, &unpack_skip_rows);
|
||||
glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &unpack_skip_pixels);
|
||||
@@ -299,7 +299,7 @@ void PixelStorageModes::retrieveStoreModes3D()
|
||||
#endif
|
||||
|
||||
glGetIntegerv(GL_PACK_ALIGNMENT, &pack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glGetIntegerv(GL_PACK_ROW_LENGTH, &pack_row_length);
|
||||
glGetIntegerv(GL_PACK_SKIP_ROWS, &pack_skip_rows);
|
||||
glGetIntegerv(GL_PACK_SKIP_PIXELS, &pack_skip_pixels);
|
||||
@@ -3437,7 +3437,7 @@ static void closestFit(GLenum target, GLint width, GLint height,
|
||||
GLint internalFormat, GLenum format, GLenum type,
|
||||
GLint *newWidth, GLint *newHeight)
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
/* Use proxy textures if OpenGL version is >= 1.1 */
|
||||
if ( (strtod((const char *)glGetString(GL_VERSION),NULL) >= 1.1)
|
||||
) {
|
||||
@@ -3592,7 +3592,7 @@ int gluBuild1DMipmapLevelsCore(GLenum target, GLint internalFormat,
|
||||
GLint userLevel, GLint baseLevel,GLint maxLevel,
|
||||
const void *data)
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
GLint newwidth;
|
||||
GLint level, levels;
|
||||
GLushort *newImage;
|
||||
@@ -3786,7 +3786,7 @@ static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat,
|
||||
|
||||
cmpts = elements_per_group(format,type);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
@@ -3808,7 +3808,7 @@ static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat,
|
||||
otherImage = (GLushort *) malloc(memreq);
|
||||
if (otherImage == NULL) {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -3836,7 +3836,7 @@ static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat,
|
||||
}
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -3913,7 +3913,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat,
|
||||
usersImage = (const GLubyte *) data + psm.unpack_skip_rows * rowsize +
|
||||
psm.unpack_skip_pixels * group_size;
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
@@ -3925,20 +3925,20 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat,
|
||||
if (width == newwidth && height == newheight) {
|
||||
/* Use usersImage for level userLevel */
|
||||
if (baseLevel <= level && level <= maxLevel) {
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
#endif
|
||||
glTexImage2D(target, level, internalFormat, width,
|
||||
height, 0, format, type,
|
||||
usersImage);
|
||||
}
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
#endif
|
||||
|
||||
if(levels == 0) { /* we're done. clean up and return */
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -4001,7 +4001,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat,
|
||||
}
|
||||
if (dstImage == NULL) {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -4168,7 +4168,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat,
|
||||
}
|
||||
if (dstImage == NULL) {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -4227,7 +4227,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat,
|
||||
|
||||
if (dstImage == NULL) {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -4415,7 +4415,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat,
|
||||
}
|
||||
if (dstImage == NULL) {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -4429,7 +4429,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat,
|
||||
level = userLevel;
|
||||
}
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
|
||||
#endif
|
||||
|
||||
@@ -4579,7 +4579,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat,
|
||||
if (newMipmapImage == NULL) {
|
||||
/* out of memory so return */
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -4615,7 +4615,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat,
|
||||
} /* for level */
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -7428,7 +7428,7 @@ static void closestFit3D(GLTexImage3DProc gluTexImage3D,
|
||||
GLint internalFormat, GLenum format, GLenum type,
|
||||
GLint *newWidth, GLint *newHeight, GLint *newDepth)
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
GLint widthPowerOf2= nearestPower(width);
|
||||
GLint heightPowerOf2= nearestPower(height);
|
||||
GLint depthPowerOf2= nearestPower(depth);
|
||||
@@ -7837,7 +7837,7 @@ static int gluBuild3DMipmapLevelsCore(GLTexImage3DProc gluTexImage3D,
|
||||
}
|
||||
if(levels == 0) { /* we're done. clean up and return */
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -7903,7 +7903,7 @@ static int gluBuild3DMipmapLevelsCore(GLTexImage3DProc gluTexImage3D,
|
||||
}
|
||||
if (dstImage == NULL) {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -8124,7 +8124,7 @@ static int gluBuild3DMipmapLevelsCore(GLTexImage3DProc gluTexImage3D,
|
||||
}
|
||||
if (dstImage == NULL) {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -8185,7 +8185,7 @@ static int gluBuild3DMipmapLevelsCore(GLTexImage3DProc gluTexImage3D,
|
||||
|
||||
if (dstImage == NULL) {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -8263,7 +8263,7 @@ static int gluBuild3DMipmapLevelsCore(GLTexImage3DProc gluTexImage3D,
|
||||
}
|
||||
if (dstImage == NULL) {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
@@ -8279,7 +8279,7 @@ static int gluBuild3DMipmapLevelsCore(GLTexImage3DProc gluTexImage3D,
|
||||
level = userLevel;
|
||||
}
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
|
||||
#endif
|
||||
|
||||
@@ -8466,7 +8466,7 @@ static int gluBuild3DMipmapLevelsCore(GLTexImage3DProc gluTexImage3D,
|
||||
} /* for level */
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
|
||||
#endif
|
||||
|
||||
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
|
||||
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
|
||||
#define GL_POLYGON_SMOOTH_HINT 0x0C53
|
||||
#define GL_LINE_SMOOTH_HINT 0x0C52
|
||||
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
|
||||
|
||||
@@ -96,7 +96,7 @@ bool StateSetManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& aa)
|
||||
(_stateset->getTextureMode(0,GL_TEXTURE_RECTANGLE)&mode)!=0 ||
|
||||
(_stateset->getTextureMode(0,GL_TEXTURE_CUBE_MAP)&mode)!=0;
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
_texture |= ((_stateset->getTextureMode(0,GL_TEXTURE_1D)&mode)!=0);
|
||||
#endif
|
||||
}
|
||||
@@ -181,7 +181,7 @@ void StateSetManipulator::setTextureEnabled(bool newtexture)
|
||||
if ( _texture ) mode = osg::StateAttribute::INHERIT|osg::StateAttribute::ON;
|
||||
for( unsigned int ii=0; ii<_maxNumOfTextureUnits; ii++ )
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
_stateset->setTextureMode( ii, GL_TEXTURE_1D, mode );
|
||||
#endif
|
||||
_stateset->setTextureMode( ii, GL_TEXTURE_2D, mode );
|
||||
|
||||
@@ -460,7 +460,7 @@ void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo
|
||||
}
|
||||
|
||||
// set up depth mask for first rendering pass
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
glPushAttrib(GL_DEPTH_BUFFER_BIT);
|
||||
#endif
|
||||
|
||||
@@ -469,7 +469,7 @@ void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo
|
||||
ad.dispatchArrays(state);
|
||||
ad.dispatchPrimitives();
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
// restore depth mask settings
|
||||
glPopAttrib();
|
||||
#endif
|
||||
@@ -478,14 +478,14 @@ void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo
|
||||
if (_doublepass)
|
||||
{
|
||||
// set up color mask for second rendering pass
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
glPushAttrib(GL_COLOR_BUFFER_BIT);
|
||||
#endif
|
||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
|
||||
ad.dispatchPrimitives();
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
// restore color mask settings
|
||||
glPopAttrib();
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# AVFoundation plugin only works with OSX/Cocoa (not X11 or Carbon)
|
||||
IF(NOT OSG_WINDOWING_SYSTEM STREQUAL "Cocoa")
|
||||
MESSAGE(WARNING "Disabling AVFoundation plugin because it requires OSG_WINDOWING_SYSTEM to be Cocoa")
|
||||
IF(NOT OSG_WINDOWING_SYSTEM STREQUAL "Cocoa" AND NOT OSG_WINDOWING_SYSTEM STREQUAL "IOS")
|
||||
MESSAGE(WARNING "Disabling AVFoundation plugin because it requires OSG_WINDOWING_SYSTEM to be Cocoa or IOS")
|
||||
RETURN()
|
||||
ENDIF()
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ class Logos: public osg::Drawable
|
||||
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo) const
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
|
||||
if( renderInfo.getContextID() != _contextID )
|
||||
return;
|
||||
|
||||
@@ -341,7 +341,7 @@ void ShadowMap::init()
|
||||
_stateset->setTextureAttribute(_baseTextureUnit,fakeTex,osg::StateAttribute::ON);
|
||||
_stateset->setTextureMode(_baseTextureUnit,GL_TEXTURE_2D,osg::StateAttribute::ON);
|
||||
_stateset->setTextureMode(_baseTextureUnit,GL_TEXTURE_3D,osg::StateAttribute::OFF);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
_stateset->setTextureMode(_baseTextureUnit,GL_TEXTURE_1D,osg::StateAttribute::OFF);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv
|
||||
_stateset->setTextureAttribute(st->_baseTextureUnit,fakeTex,osg::StateAttribute::ON);
|
||||
_stateset->setTextureMode(st->_baseTextureUnit,GL_TEXTURE_2D,osg::StateAttribute::ON);
|
||||
_stateset->setTextureMode(st->_baseTextureUnit,GL_TEXTURE_3D,osg::StateAttribute::OFF);
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
_stateset->setTextureMode(st->_baseTextureUnit,GL_TEXTURE_1D,osg::StateAttribute::OFF);
|
||||
#endif
|
||||
}
|
||||
@@ -664,7 +664,7 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv
|
||||
|
||||
for( unsigned stage = 1; stage < 4; stage ++ )
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
stateset->setTextureMode( stage, GL_TEXTURE_1D, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF );
|
||||
#endif
|
||||
stateset->setTextureMode( stage, GL_TEXTURE_2D, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF );
|
||||
|
||||
@@ -85,7 +85,7 @@ void LightPointDrawable::reset()
|
||||
|
||||
void LightPointDrawable::drawImplementation(osg::RenderInfo& renderInfo) const
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
osg::State& state = *renderInfo.getState();
|
||||
|
||||
state.applyMode(GL_POINT_SMOOTH,true);
|
||||
|
||||
@@ -30,7 +30,7 @@ LightPointSpriteDrawable::LightPointSpriteDrawable(const LightPointSpriteDrawabl
|
||||
|
||||
void LightPointSpriteDrawable::drawImplementation(osg::RenderInfo& renderInfo) const
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
osg::State& state = *renderInfo.getState();
|
||||
|
||||
if (!state.getModeValidity(GL_POINT_SPRITE_ARB))
|
||||
|
||||
@@ -33,12 +33,22 @@ using namespace osgText;
|
||||
using namespace std;
|
||||
|
||||
#define FIXED_FUNCTION defined(OSG_GL_FIXED_FUNCTION_AVAILABLE)
|
||||
#define SHADERS_GL3 (defined(OSG_GL3_AVAILABLE))
|
||||
#define SHADERS_GL3 (defined(OSG_GL3_AVAILABLE) || defined(OSG_GLES3_AVAILABLE))
|
||||
#define SHADERS_GL2 !FIXED_FUNCTION && !SHADERS_GL3
|
||||
#define IS_ES (defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE))
|
||||
|
||||
#if SHADERS_GL3
|
||||
|
||||
#if !IS_ES
|
||||
#define GLSL_VERSION_STR "330 core"
|
||||
#define GLYPH_CMP "r"
|
||||
#else
|
||||
#define GLSL_VERSION_STR "300 es"
|
||||
#define GLYPH_CMP "a"
|
||||
#endif
|
||||
|
||||
static const char* gl3_TextVertexShader = {
|
||||
"#version 330 core\n"
|
||||
"#version " GLSL_VERSION_STR "\n"
|
||||
"// gl3_TextVertexShader\n"
|
||||
"#ifdef GL_ES\n"
|
||||
" precision highp float;\n"
|
||||
@@ -58,7 +68,7 @@ static const char* gl3_TextVertexShader = {
|
||||
};
|
||||
|
||||
static const char* gl3_TextFragmentShader = {
|
||||
"#version 330 core\n"
|
||||
"#version " GLSL_VERSION_STR "\n"
|
||||
"// gl3_TextFragmentShader\n"
|
||||
"#ifdef GL_ES\n"
|
||||
" precision highp float;\n"
|
||||
@@ -69,7 +79,7 @@ static const char* gl3_TextFragmentShader = {
|
||||
"out vec4 color;\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" if (texCoord.x>=0.0) color = vertexColor * vec4(1.0, 1.0, 1.0, texture(glyphTexture, texCoord).r);\n"
|
||||
" if (texCoord.x>=0.0) color = vertexColor * vec4(1.0, 1.0, 1.0, texture(glyphTexture, texCoord)." GLYPH_CMP ");\n"
|
||||
" else color = vertexColor;\n"
|
||||
"}\n"
|
||||
};
|
||||
|
||||
@@ -519,7 +519,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo)
|
||||
{
|
||||
setDrawBuffer( GL_NONE, true );
|
||||
setReadBuffer( GL_NONE, true );
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glDrawBuffer( GL_NONE );
|
||||
glReadBuffer( GL_NONE );
|
||||
#endif
|
||||
@@ -911,7 +911,7 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b
|
||||
|
||||
if (!using_multiple_render_targets)
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
|
||||
if( getDrawBufferApplyMask() )
|
||||
glDrawBuffer(_drawBuffer);
|
||||
@@ -997,7 +997,7 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b
|
||||
blitMask, GL_NEAREST);
|
||||
}
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
if (needToBlitColorBuffers)
|
||||
{
|
||||
for (FrameBufferObject::AttachmentMap::const_iterator
|
||||
@@ -1349,7 +1349,7 @@ void RenderStage::drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& pr
|
||||
|
||||
if (_clearMask & GL_DEPTH_BUFFER_BIT)
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||
glClearDepth( _clearDepth);
|
||||
#else
|
||||
glClearDepthf( _clearDepth);
|
||||
@@ -1366,7 +1366,7 @@ void RenderStage::drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& pr
|
||||
state.haveAppliedAttribute( osg::StateAttribute::STENCIL );
|
||||
}
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
if (_clearMask & GL_ACCUM_BUFFER_BIT)
|
||||
{
|
||||
glClearAccum( _clearAccum[0], _clearAccum[1], _clearAccum[2], _clearAccum[3]);
|
||||
|
||||
@@ -1232,7 +1232,7 @@ void SceneView::draw()
|
||||
case(osg::DisplaySettings::HORIZONTAL_INTERLACE):
|
||||
case(osg::DisplaySettings::CHECKERBOARD):
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
if( 0 == ( _camera->getInheritanceMask() & DRAW_BUFFER) )
|
||||
{
|
||||
_renderStageLeft->setDrawBuffer(_camera->getDrawBuffer());
|
||||
|
||||
@@ -9,8 +9,13 @@
|
||||
#if OSG_GLES1_FEATURES
|
||||
#import <OpenGLES/ES1/glext.h>
|
||||
#else
|
||||
#import <OpenGLES/ES2/glext.h>
|
||||
#if defined(OSG_GLES3_FEATURES)
|
||||
|
||||
#define MUTLI_GLES (OSG_GLES2_FEATURES && OSG_GLES3_FEATURES)
|
||||
|
||||
#if OSG_GLES2_FEATURES || MUTLI_GLES
|
||||
#import <OpenGLES/ES2/glext.h>
|
||||
#endif
|
||||
#if OSG_GLES3_FEATURES || MUTLI_GLES
|
||||
#import <OpenGLES/ES3/glext.h>
|
||||
#endif
|
||||
|
||||
@@ -38,6 +43,18 @@
|
||||
#define GL_STENCIL_ATTACHMENT_OES GL_STENCIL_ATTACHMENT
|
||||
|
||||
#define GL_RGB5_A1_OES GL_RGB5_A1
|
||||
|
||||
#if OSG_GLES3_FEATURES && !MUTLI_GLES
|
||||
#define glRenderbufferStorageMultisampleAPPLE glRenderbufferStorageMultisample
|
||||
#define glDiscardFramebufferEXT glInvalidateFramebuffer
|
||||
//#define glResolveMultisampleFramebufferAPPLE glResolveMultisampleFramebuffer
|
||||
|
||||
#define GL_DEPTH24_STENCIL8_OES GL_DEPTH24_STENCIL8
|
||||
#define GL_DEPTH_COMPONENT24_OES GL_DEPTH_COMPONENT24
|
||||
#define GL_READ_FRAMEBUFFER_APPLE GL_READ_FRAMEBUFFER
|
||||
#define GL_DRAW_FRAMEBUFFER_APPLE GL_DRAW_FRAMEBUFFER
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include "IOSUtils.h"
|
||||
@@ -513,11 +530,13 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
||||
|
||||
glBindFramebufferOES(GL_READ_FRAMEBUFFER_APPLE, _msaaFramebuffer);
|
||||
glBindFramebufferOES(GL_DRAW_FRAMEBUFFER_APPLE, _viewFramebuffer);
|
||||
|
||||
glResolveMultisampleFramebufferAPPLE();
|
||||
|
||||
|
||||
GLenum attachments[] = {GL_DEPTH_ATTACHMENT_OES, GL_COLOR_ATTACHMENT0_OES};
|
||||
#ifdef OSG_GLES3_FEATURES
|
||||
|
||||
#if !OSG_GLES3_FEATURES
|
||||
glResolveMultisampleFramebufferAPPLE();
|
||||
glDiscardFramebufferEXT(GL_READ_FRAMEBUFFER_APPLE, 2, attachments);
|
||||
#else
|
||||
switch ([_context API])
|
||||
{
|
||||
case kEAGLRenderingAPIOpenGLES3:
|
||||
@@ -528,17 +547,16 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
||||
break;
|
||||
|
||||
default:
|
||||
#if !OSG_GLES3_FEATURES
|
||||
glResolveMultisampleFramebufferAPPLE();
|
||||
#endif
|
||||
glDiscardFramebufferEXT(GL_READ_FRAMEBUFFER_APPLE, 2, attachments);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
glDiscardFramebufferEXT(GL_READ_FRAMEBUFFER_APPLE, 2, attachments);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//swap buffers (sort of i think?)
|
||||
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer);
|
||||
|
||||
@@ -881,12 +899,16 @@ bool GraphicsWindowIOS::realizeImplementation()
|
||||
#if OSG_GLES1_FEATURES
|
||||
_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
|
||||
#elif OSG_GLES2_FEATURES
|
||||
#if OSG_GLES3_FEATURES
|
||||
_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
|
||||
#endif
|
||||
|
||||
if (!_context)
|
||||
#if MULTI_GLES
|
||||
_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
|
||||
if(!_context) _context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
||||
#else
|
||||
_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
||||
#endif
|
||||
|
||||
#elif OSG_GLES3_FEATURES
|
||||
_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
|
||||
#endif
|
||||
|
||||
if (!_context || ![EAGLContext setCurrentContext:_context]) {
|
||||
@@ -894,11 +916,9 @@ bool GraphicsWindowIOS::realizeImplementation()
|
||||
#if OSG_GLES1_FEATURES
|
||||
OSG_FATAL << "GraphicsWindowIOS::realizeImplementation: ERROR: Failed to create a valid OpenGLES1 context" << std::endl;
|
||||
#elif OSG_GLES2_FEATURES
|
||||
#if OSG_GLES3_FEATURES
|
||||
OSG_FATAL << "GraphicsWindowIOS::realizeImplementation: ERROR: Failed to create a valid OpenGLES3 or OpenGLES2 context" << std::endl;
|
||||
#else
|
||||
OSG_FATAL << "GraphicsWindowIOS::realizeImplementation: ERROR: Failed to create a valid OpenGLES2 context" << std::endl;
|
||||
#endif
|
||||
OSG_FATAL << "GraphicsWindowIOS::realizeImplementation: ERROR: Failed to create a valid OpenGLES2" << std::endl;
|
||||
#elif OSG_GLES3_FEATURES
|
||||
OSG_FATAL << "GraphicsWindowIOS::realizeImplementation: ERROR: Failed to create a valid OpenGLES3 context" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user