Merge pull request #221 from tomhog/topic-gles3-ios

GLES3 support improvements on iOS
This commit is contained in:
OpenSceneGraph git repository
2017-03-21 17:56:39 +00:00
committed by GitHub
34 changed files with 347 additions and 206 deletions

6
.gitignore vendored
View File

@@ -78,3 +78,9 @@ PlatformSpecifics/Windows/*.rc
# Visual Studio - Browsing Database File
*.sdf
*.opensdf
#osx xcode
DerivedData/
*.DS_Store
*.build
*.xcodeproj

View File

@@ -239,8 +239,8 @@ IF(APPLE)
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
#you need to manually set the default sdk version here
SET (IPHONE_SDKVER "6.0" CACHE STRING "IOS SDK-Version")
SET (IPHONE_VERSION_MIN "4.2" CACHE STRING "IOS minimum os version, use 7.0 or greater to get 64bit support")
SET (IPHONE_SDKVER "10.2" CACHE STRING "IOS SDK-Version")
SET (IPHONE_VERSION_MIN "7.0" CACHE STRING "IOS minimum os version, use 7.0 or greater to get 64bit support")
#the below is taken from ogre, it states the gcc stuff needs to happen before PROJECT() is called. I've no clue if we even need it
# Force gcc <= 4.2 on iPhone
@@ -499,6 +499,8 @@ ENDIF()
IF ((OPENGL_PROFILE STREQUAL "GLES2"))
OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." ON )
ELSEIF ((OPENGL_PROFILE STREQUAL "GLES3"))
OPTION(OSG_GLES3_AVAILABLE "Set to OFF to disable use of OpenGL ES 3.x functions library." ON )
ELSEIF ((OPENGL_PROFILE STREQUAL "GLES2+GLES3"))
OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." ON )
OPTION(OSG_GLES3_AVAILABLE "Set to OFF to disable use of OpenGL ES 3.x functions library." ON )
ELSE()
@@ -510,7 +512,7 @@ ENDIF()
OPTION(OSG_GL_LIBRARY_STATIC "Set to ON to statically link with OpenGL/GLES library." OFF)
# Map the OSG_GL*_AVAILABLE settings to OSG_GL_* settings
IF (OSG_GLES2_AVAILABLE OR OSG_GL3_AVAILABLE)
IF (OSG_GLES2_AVAILABLE OR OSG_GLES3_AVAILABLE OR OSG_GL3_AVAILABLE)
OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." OFF)
OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." OFF)
OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." OFF)
@@ -530,7 +532,7 @@ ELSE()
OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ON)
ENDIF()
IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE)
IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE OR OSG_GLES3_AVAILABLE)
OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." OFF)
ELSE()
OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON)
@@ -568,11 +570,17 @@ ELSEIF(OSG_GLES2_AVAILABLE)
IF (APPLE AND NOT ANDROID)
SET(OPENGL_HEADER1 "#include \"TargetConditionals.h\"" CACHE STRING "#include<> line for OpenGL Header")
SET(OPENGL_HEADER2 "#include <OpenGLES/ES2/gl.h>" CACHE STRING "#include<> line for additional OpenGL Headers if required")
# TODO: GLES3
ELSE()
SET(OPENGL_HEADER1 "#include <GLES2/gl2.h>" CACHE STRING "#include<> line for OpenGL Header")
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
# TODO: GLES3
ENDIF()
ELSEIF(OSG_GLES3_AVAILABLE)
IF (APPLE AND NOT ANDROID)
SET(OPENGL_HEADER1 "#include \"TargetConditionals.h\"" CACHE STRING "#include<> line for OpenGL Header")
SET(OPENGL_HEADER2 "#include <OpenGLES/ES3/gl.h>" CACHE STRING "#include<> line for additional OpenGL Headers if required")
ELSE()
SET(OPENGL_HEADER1 "#include <GLES3/gl3.h>" CACHE STRING "#include<> line for OpenGL Header")
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
ENDIF()
ELSE()
IF (APPLE)
@@ -635,6 +643,13 @@ IF(ANDROID)
FIND_LIBRARY(OPENGL_gl_LIBRARY GLESv2
PATHS
${ANDROID_SYSROOT}/usr/lib)
ELSEIF(OSG_GLES3_AVAILABLE)
FIND_PATH(OPENGL_INCLUDE_DIR GLES3/gl3.h
PATHS
${ANDROID_SYSROOT}/usr/include)
FIND_LIBRARY(OPENGL_gl_LIBRARY GLESv3
PATHS
${ANDROID_SYSROOT}/usr/lib)
ENDIF()
ENDIF()

View File

@@ -159,54 +159,48 @@ still images, and a QTKit plugin will need to be developed to handle
animations.
### Section 3. Release notes on iOS build, by Thomas Hoghart
### Section 3. Release notes on iOS build, by Thomas Hogarth
* Run CMake with either OSG_BUILD_PLATFORM_IPHONE or OSG_BUILD_PLATFORM_IPHONE_SIMULATOR set:
$ mkdir build-iOS ; cd build-iOS
$ ccmake -DOSG_BUILD_PLATFORM_IPHONE_SIMULATOR=YES -G Xcode ..
* Check that CMAKE_OSX_ARCHITECTURE is i386 for the simulator or armv6;armv7 for the device
* Disable DYNAMIC_OPENSCENEGRAPH, DYNAMIC_OPENTHREADS
This will give us the static build we need for iPhone.
* Disable OSG_GL1_AVAILABLE, OSG_GL2_AVAILABLE, OSG_GL3_AVAILABLE,
OSG_GL_DISPLAYLISTS_AVAILABLE, OSG_GL_VERTEX_FUNCS_AVAILABLE
* Enable OSG_GLES1_AVAILABLE *OR* OSG_GLES2_AVAILABLE *OR* OSG_GLES3_AVAILABLE (GLES3 will enable GLES2 features)
* Ensure OSG_WINDOWING_SYSTEM is set to IOS
* Change FREETYPE include and library paths to an iPhone version
(OpenFrameworks has one bundled with its distribution)
* Ensure that CMake_OSX_SYSROOT points to your iOS SDK.
* Generate the Xcode project
* Open the Xcode project
$ open OpenSceneGraph.xcodeproj
* Under Sources -> osgDB, select FileUtils.cpp and open the 'Get Info' panel, change File Type
to source.cpp.objcpp
With CMake, XCode and the iOS sdk installed you can generate an iOS XCode
project using the following command line
Here's an example for the command-line:
$ cmake -G Xcode \
-D OSG_BUILD_PLATFORM_IPHONE:BOOL=ON \
-D CMAKE_CXX_FLAGS:STRING="-ftree-vectorize -fvisibility-inlines-hidden -mno-thumb -arch armv6 -pipe -no-cpp-precomp -miphoneos-version-min=3.1 -mno-thumb" \
-D BUILD_OSG_APPLICATIONS:BOOL=OFF \
-D OSG_BUILD_FRAMEWORKS:BOOL=OFF \
-D OSG_WINDOWING_SYSTEM:STRING=IOS \
-D OSG_BUILD_PLATFORM_IPHONE:BOOL=ON \
-D CMAKE_OSX_ARCHITECTURES:STRING="armv6;armv7" \
-D CMAKE_OSX_SYSROOT:STRING=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk \
-D OSG_GL1_AVAILABLE:BOOL=OFF \
-D OSG_GL2_AVAILABLE:BOOL=OFF \
-D OSG_GLES1_AVAILABLE:BOOL=ON \
-D OSG_GL_DISPLAYLISTS_AVAILABLE:BOOL=OFF \
-D OSG_GL_FIXED_FUNCTION_AVAILABLE:BOOL=ON \
-D OSG_GL_LIBRARY_STATIC:BOOL=OFF \
-D OSG_GL_MATRICES_AVAILABLE:BOOL=ON \
-D OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE:BOOL=ON \
-D OSG_GL_VERTEX_FUNCS_AVAILABLE:BOOL=OFF \
-D DYNAMIC_OPENSCENEGRAPH:BOOL=OFF \
-D DYNAMIC_OPENTHREADS:BOOL=OFF .
export THIRDPARTY_PATH=/path/to/my/3rdParty
cmake ./ -G Xcode -DOSG_BUILD_PLATFORM_IPHONE:BOOL=ON \
-DIPHONE_SDKVER="10.2" \
-DIPHONE_VERSION_MIN="8.0" \
-DOPENGL_PROFILE:STRING=GLES2 \
-DBUILD_OSG_APPLICATIONS:BOOL=OFF \
-DBUILD_OSG_EXAMPLES:BOOL=ON \
-DOSG_WINDOWING_SYSTEM:STRING=IOS \
-DOSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX="imageio" \
-DDYNAMIC_OPENSCENEGRAPH:BOOL=OFF \
-DDYNAMIC_OPENTHREADS:BOOL=OFF \
-DCURL_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/curl-ios-device/include" \
-DCURL_LIBRARY:PATH="$THIRDPARTY_PATH/curl-ios-device/lib/libcurl.a" \
-DFREETYPE_INCLUDE_DIR_freetype2:PATH="$THIRDPARTY_PATH/freetype-ios-universal/include/freetype" \
-DFREETYPE_INCLUDE_DIR_ft2build:PATH="$THIRDPARTY_PATH/freetype-ios-universal/include" \
-DFREETYPE_LIBRARY:PATH="$THIRDPARTY_PATH/freetype-ios-universal/lib/libFreeType_iphone_universal.a" \
-DTIFF_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/tiff-ios-device/include" \
-DTIFF_LIBRARY:PATH="$THIRDPARTY_PATH/tiff-ios-device/lib/libtiff.a" \
-DGDAL_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/gdal-ios-device/include" \
-DGDAL_LIBRARY:PATH="$THIRDPARTY_PATH/gdal-ios-device/lib/libgdal.a"
Be sure to set the THIRDPARTY_PATH to the path containing your thirdparty
dependancies. Set IPHONE_SDKVER to the version of the iOS sdk you have
installed, in this instance 10.2. IPHONE_VERSION_MIN controls the base sdk
used by xcode, and lastly set OPENGL_PROFILE to the version of GLES you want
to use.
Once this completes an XCode project will have been generated in the osg root
folder. Open the generated Xcode project, select the example_osgViewerIPhone
target. In 'General' tab set a development team. In the 'Build Settings' tab
search for 'Other Linker Flags', then for each target type (debug, release etc)
that you want to use open the list of arguments and delete the 'OpenGL' line
and the '-framework' line above it. This is because cmake has tried to add the
desktop OpenGL library which we don't want.
Once this is done you should be able to build and deploy the example_osgViewerIPhone
target on your device.
Known issues:
* When Linking final app against ive plugin, you need to add -lz to
the 'Other linker flags' list.
* Apps and exes don't get created
* You can only select Simulator, or Device projects. In the XCode
project you will see both types but the sdk they link will
be the same.

View File

@@ -3,6 +3,7 @@ SET(TARGET_SRC
iphoneViewerAppDelegate.mm
main.m
osgPlugins.h
shaders.h
osgIPhoneViewer-Info.plist
)
@@ -11,8 +12,11 @@ SET(TARGET_ADDED_LIBRARIES osgdb_osg osgdb_imageio osgdb_avfoundation)
#backup setting
SET(TMP_OSG_BUILD_APPLICATION_BUNDLES {$OSG_BUILD_APPLICATION_BUNDLES})
SET(OSG_BUILD_APPLICATION_BUNDLES TRUE)
SET(MACOSX_DEPLOYMENT_TARGET, ${IPHONE_VERSION_MIN})
SETUP_EXAMPLE(osgViewerIPhone)
SET_TARGET_PROPERTIES(example_osgViewerIPhone PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")
SET_TARGET_PROPERTIES(example_osgViewerIPhone PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${IPHONE_VERSION_MIN}
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
#restore setting
SET(OSG_BUILD_APPLICATION_BUNDLES {$TMP_OSG_BUILD_APPLICATION_BUNDLES})

View File

@@ -1,17 +1,24 @@
// Created by Thomas Hogarth 2009
// cleaned up by Stephan Huber 2013
// Cleaned up by Stephan Huber 2013
// Added gles3 support 2017 TH
//
// this example will create a fullscreen window showing a grey box. You can interact with it via
// this example will create a fullscreen window showing a box. You can interact with it via
// multi-touch gestures.
#import "iphoneViewerAppDelegate.h"
#include <osgGA/MultiTouchTrackballManipulator>
#include <osg/ShapeDrawable>
#include <osgUtil/Optimizer>
//include the iphone specific windowing stuff
#include <osgViewer/api/IOS/GraphicsWindowIOS>
#include "shaders.h"
// global programs
osg::ref_ptr<osg::Program> _vertColorProgram;
@interface MyViewController : UIViewController
@@ -33,10 +40,19 @@
@synthesize _window;
//
// Shape drawables sometimes use gl_quads so use this function to convert
//
void optimizeNode(osg::Node* node) {
osgUtil::Optimizer optimizer;
optimizer.optimize(node, osgUtil::Optimizer::TRISTRIP_GEOMETRY);
}
//
// create a camera to set up the projection and model view matrices, and the subgraph to draw in the HUD
//
osg::Camera* createHUD(unsigned int w, unsigned int h)
{
// create a camera to set up the projection and model view matrices, and the subgraph to draw in the HUD
osg::Camera* camera = new osg::Camera;
// set the projection matrix
@@ -55,28 +71,21 @@ osg::Camera* createHUD(unsigned int w, unsigned int h)
// we don't want the camera to grab event focus from the viewers main camera(s).
camera->setAllowEventFocus(false);
// add to this camera a subgraph to render
{
osg::Geode* geode = new osg::Geode();
std::string timesFont("fonts/arial.ttf");
// turn lighting off for the text and disable depth test to ensure it's always ontop.
osg::StateSet* stateset = geode->getOrCreateStateSet();
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
osg::Vec3 position(50.0f,h-50,0.0f);
{
osgText::Text* text = new osgText::Text;
geode->addDrawable( text );
text->setFont(timesFont);
osgText::Text* text = new osgText::Text();
text->setUseVertexBufferObjects(true);
text->setFont(0);//"fonts/arial.ttf");
text->setPosition(position);
text->setText("A simple multi-touch-example\n1 touch = rotate, \n2 touches = drag + scale, \n3 touches = home");
text->setColor(osg::Vec4(0.9,0.1,0.1,1.0));
geode->addDrawable( text );
}
camera->addChild(geode);
@@ -106,24 +115,29 @@ private:
osg::Geode* geode = new osg::Geode();
osg::ShapeDrawable* drawable = new osg::ShapeDrawable(new osg::Box(osg::Vec3(0,0,0), 100));
drawable->setUseVertexBufferObjects(true);
drawable->setDataVariance(osg::Object::DYNAMIC);
#if defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
drawable->getOrCreateStateSet()->setAttributeAndModes(_vertColorProgram, osg::StateAttribute::ON);
optimizeNode(drawable);
#endif
drawable->setColor(osg::Vec4(0.5, 0.5, 0.5,1));
geode->addDrawable(drawable);
ss << "Touch " << i;
osgText::Text* text = new osgText::Text;
geode->addDrawable( text );
drawable->setDataVariance(osg::Object::DYNAMIC);
_drawables.push_back(drawable);
text->setFont("fonts/arial.ttf");
text->setUseVertexBufferObjects(true);
text->setFont(0); //"fonts/arial.ttf");
text->setPosition(osg::Vec3(110,0,0));
text->setText(ss.str());
_texts.push_back(text);
text->setDataVariance(osg::Object::DYNAMIC);
text->setText(ss.str());
geode->addDrawable( text );
_drawables.push_back(drawable);
_texts.push_back(text);
osg::MatrixTransform* mat = new osg::MatrixTransform();
mat->addChild(geode);
@@ -133,8 +147,6 @@ private:
parent_group->addChild(mat);
}
parent_group->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
}
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *)
@@ -179,28 +191,29 @@ private:
{
case osgGA::GUIEventAdapter::TOUCH_BEGAN:
_drawables[j]->setColor(osg::Vec4(0,1,0,1));
std::cout << "touch began: " << ss.str() << std::endl;
OSG_INFO << "touch began: " << ss.str() << std::endl;
break;
case osgGA::GUIEventAdapter::TOUCH_MOVED:
//std::cout << "touch moved: " << ss.str() << std::endl;
//OSG_INFO << "touch moved: " << ss.str() << std::endl;
_drawables[j]->setColor(osg::Vec4(1,1,1,1));
break;
case osgGA::GUIEventAdapter::TOUCH_ENDED:
_drawables[j]->setColor(osg::Vec4(1,0,0,1));
std::cout << "touch ended: " << ss.str() << std::endl;
OSG_INFO << "touch ended: " << ss.str() << std::endl;
++num_touch_ended;
break;
case osgGA::GUIEventAdapter::TOUCH_STATIONERY:
_drawables[j]->setColor(osg::Vec4(0.8,0.8,0.8,1));
_drawables[j]->setColor(osg::Vec4(0.5,0.5,0.5,1));
break;
default:
break;
}
}
// hide unused geometry
@@ -279,11 +292,11 @@ private:
osg::ref_ptr<osg::Referenced> windata = new osgViewer::GraphicsWindowIOS::WindowData(parent_view);
// Setup the traits parameters
traits->x = 50;
traits->y = 50;
traits->width = w-100;
traits->height = h-100;
traits->depth = 16; //keep memory down, default is currently 24
traits->x = 0;
traits->y = 0;
traits->width = w;
traits->height = h;
traits->depth = 16; //can be 16 or 24
traits->windowDecoration = false;
traits->doubleBuffer = true;
traits->sharedContext = 0;
@@ -301,43 +314,60 @@ private:
{
_viewer->getCamera()->setGraphicsContext(graphicsContext);
_viewer->getCamera()->setViewport(new osg::Viewport(0, 0, traits->width, traits->height));
_viewer->getCamera()->setProjectionMatrixAsPerspective(60.0, (double)traits->width/(double)traits->height, 0.1, 1000.0);
}
}
// create our default programs
#if defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
_vertColorProgram = new osg::Program();
_vertColorProgram->addShader( new osg::Shader(osg::Shader::VERTEX, ColorShaderVert));
_vertColorProgram->addShader( new osg::Shader(osg::Shader::FRAGMENT, ColorShaderFrag));
#endif
//create root
_root = new osg::MatrixTransform();
_root = new osg::MatrixTransform();
_root->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE);
//load and attach scene model
osg::ref_ptr<osg::Node> model = (osgDB::readNodeFile("hog.osg"));
if (model) {
_root->addChild(model);
}
else {
osg::ref_ptr<osg::Node> model = osgDB::readNodeFile("hog.osg");
if (!model) {
osg::Geode* geode = new osg::Geode();
osg::ShapeDrawable* drawable = new osg::ShapeDrawable(new osg::Box(osg::Vec3(1,1,1), 1));
osg::ShapeDrawable* drawable = new osg::ShapeDrawable(new osg::Box(osg::Vec3(0,0,0), 1));
drawable->setColor(osg::Vec4(0.1,0.1,0.9,1.0));
geode->addDrawable(drawable);
_root->addChild(geode);
model = geode;
}
// attach shader program if needed
#if defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
model->getOrCreateStateSet()->setAttributeAndModes(_vertColorProgram, osg::StateAttribute::ON);
optimizeNode(model);
#endif
_root->addChild(model);
// create text hud
osg::Camera* hud_camera = createHUD(w,h);
_root->addChild(hud_camera);
// attach root to viewer and add event handlers
_viewer->setSceneData(_root.get());
_viewer->setCameraManipulator(new osgGA::MultiTouchTrackballManipulator());
_viewer->addEventHandler(new TestMultiTouchEventHandler(hud_camera));
// sun single-threaded
// run single-threaded
_viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
osg::setNotifyLevel(osg::INFO);
_viewer->realize();
// render a frame so the window-manager shows some content and not only an empty + black window
_viewer->frame();
osg::setNotifyLevel(osg::WARN);
// create a display link, which will update our scene on every screen-refresh
_displayLink = [application.keyWindow.screen displayLinkWithTarget:self selector:@selector(updateScene)];

View File

@@ -14,6 +14,6 @@ USE_GRAPICSWINDOW_IMPLEMENTATION(IOS)
USE_OSGPLUGIN(osg)
USE_OSGPLUGIN(imageio)
USE_OSGPLUGIN(avfoundation)
//USE_OSGPLUGIN(avfoundation)
//USE_OSGPLUGIN(freetype)

View File

@@ -0,0 +1,59 @@
#pragma once
#include <osg/GL>
//
// vertex color shader
//
#if OSG_GLES3_FEATURES
const char* ColorShaderVert =
"#version 300 es\n"
"in vec4 osg_Vertex;\n"
"in vec4 osg_Color;\n"
"out vec4 vertColor;\n"
"uniform mat4 osg_ModelViewProjectionMatrix;\n"
"void main()\n"
"{\n"
" gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;\n"
" vertColor = osg_Color;\n"
"}\n";
const char* ColorShaderFrag =
"#version 300 es\n"
"in lowp vec4 vertColor;\n"
"out lowp vec4 fragColor;\n"
"void main()\n"
"{\n"
" fragColor = vertColor;\n"
"}\n";
#elif OSG_GLES2_FEATURES
const char* ColorShaderVert =
"#version 100\n"
"attribute vec4 osg_Vertex;\n"
"attribute vec4 osg_Color;\n"
"uniform mat4 osg_ModelViewProjectionMatrix;\n"
"varying vec4 vertColor;\n"
"void main()\n"
"{\n"
" gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;\n"
" vertColor = osg_Color;\n"
"}\n";
const char* ColorShaderFrag =
"#version 100\n"
"varying lowp vec4 vertColor;\n"
"void main()\n"
"{\n"
" gl_FragColor = vertColor;\n"
"}\n";
#else
const char* ColorShaderVert = NULL;
const char* ColorShaderFrag = NULL;
#endif

View File

@@ -26,7 +26,7 @@
#include <OpenThreads/Mutex>
#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_FRONT_LEFT 0x0400
#define GL_FRONT_RIGHT 0x0401
#define GL_BACK_LEFT 0x0402

View File

@@ -61,10 +61,13 @@
#define GL_GREEN 0x1904
#define GL_BLUE 0x1905
#define GL_DEPTH_COMPONENT 0x1902
#endif
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
#define GL_STENCIL_INDEX 0x1901
#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_BITMAP 0x1A00
#define GL_COLOR_INDEX 0x1900
#define GL_INTENSITY12 0x804C

View File

@@ -17,7 +17,7 @@
#include <osg/StateAttribute>
#include <osg/GL>
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
#define GL_POINT 0x1B00
#define GL_LINE 0x1B01
#define GL_FILL 0x1B02

View File

@@ -17,7 +17,7 @@
#include <osg/Plane>
#include <osg/StateAttribute>
#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_OBJECT_LINEAR 0x2401
#define GL_EYE_LINEAR 0x2400
#define GL_SPHERE_MAP 0x2402

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -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 );

View File

@@ -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

View File

@@ -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()

View File

@@ -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;

View File

@@ -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
}

View File

@@ -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 );

View File

@@ -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);

View File

@@ -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))

View File

@@ -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"
};

View File

@@ -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]);

View File

@@ -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());

View File

@@ -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;
}