diff --git a/applications/present3D/present3D.cpp b/applications/present3D/present3D.cpp index 92b5396b1..c0d8261b7 100644 --- a/applications/present3D/present3D.cpp +++ b/applications/present3D/present3D.cpp @@ -723,7 +723,7 @@ int main( int argc, char **argv ) } -#if !defined(OSG_GLES2_AVAILABLE) +#if !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) // add back in enabling of the GL_ALPHA_TEST to get around the core OSG no longer setting it by default for opaque bins. // the alpha test is required for the volume rendering alpha clipping to work. diff --git a/include/osg/ClampColor b/include/osg/ClampColor index 7ee69eaf5..f059bd8cd 100644 --- a/include/osg/ClampColor +++ b/include/osg/ClampColor @@ -31,6 +31,11 @@ #define GL_CLAMP_FRAGMENT_COLOR GL_CLAMP_FRAGMENT_COLOR_ARB #endif +#if defined(OSG_GL3_AVAILABLE) + #define GL_CLAMP_VERTEX_COLOR 0x891A + #define GL_CLAMP_FRAGMENT_COLOR 0x891B +#endif + namespace osg { /** Encapsulates OpenGL ClampColor state. */ diff --git a/include/osg/GL b/include/osg/GL index 5b279241f..0b1f0d251 100644 --- a/include/osg/GL +++ b/include/osg/GL @@ -87,6 +87,11 @@ #include +#elif defined(OSG_GL3_AVAILABLE) + + #define GL3_PROTOTYPES 1 + #include + #else #ifndef __gl_h_ @@ -145,12 +150,17 @@ #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_GL3_AVAILABLE) #define GL_POLYGON 0x0009 #define GL_QUADS 0x0007 #define GL_QUAD_STRIP 0x0008 #endif +#if defined(OSG_GL3_AVAILABLE) + #define GL_LUMINANCE 0x1909 + #define GL_LUMINANCE_ALPHA 0x190A +#endif + #ifdef OSG_GLES1_AVAILABLE inline void glColor4ubv(const GLubyte* c) { glColor4ub(c[0], c[1], c[2], c[3]); } inline void glColor3fv(const GLfloat* c) { glColor4f(c[0], c[1], c[2], 1.0f); } diff --git a/include/osg/TexGen b/include/osg/TexGen index d6d3dca4a..3e8a14256 100644 --- a/include/osg/TexGen +++ b/include/osg/TexGen @@ -17,7 +17,7 @@ #include #include -#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) +#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GL3_AVAILABLE) #define GL_OBJECT_LINEAR 0x2401 #define GL_EYE_LINEAR 0x2400 #define GL_SPHERE_MAP 0x2402 diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index 87e8fc58a..1df039ef8 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -32,12 +32,16 @@ #include "dxtctool.h" #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) - #define GL_BITMAP 0x1A00 #define GL_RED 0x1903 #define GL_GREEN 0x1904 #define GL_BLUE 0x1905 - #define GL_COLOR_INDEX 0x1900 #define GL_DEPTH_COMPONENT 0x1902 + #define GL_STENCIL_INDEX 0x1901 +#endif + +#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GL3_AVAILABLE) + #define GL_BITMAP 0x1A00 + #define GL_COLOR_INDEX 0x1900 #define GL_INTENSITY12 0x804C #define GL_INTENSITY16 0x804D #define GL_INTENSITY4 0x804A @@ -52,7 +56,6 @@ #define GL_LUMINANCE6_ALPHA2 0x8044 #define GL_LUMINANCE8 0x8040 #define GL_LUMINANCE8_ALPHA8 0x8045 - #define GL_STENCIL_INDEX 0x1901 #define GL_RGBA8 0x8058 #define GL_PACK_ROW_LENGTH 0x0D02 #endif diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index c0fedfb69..7b0406683 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -1747,7 +1747,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) + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_PRIORITY,0.0f); #endif diff --git a/src/osg/TextureRectangle.cpp b/src/osg/TextureRectangle.cpp index ba85084cf..258a42eae 100644 --- a/src/osg/TextureRectangle.cpp +++ b/src/osg/TextureRectangle.cpp @@ -297,7 +297,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) + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_PRIORITY,0.0f); #endif diff --git a/src/osgDB/DatabasePager.cpp b/src/osgDB/DatabasePager.cpp index b0097a968..68a38271e 100644 --- a/src/osgDB/DatabasePager.cpp +++ b/src/osgDB/DatabasePager.cpp @@ -2007,7 +2007,7 @@ void DatabasePager::compileGLObjects(osg::State& state, double& availableTime) if (!dtc.first.empty() && (elapsedTime+estimatedTextureDuration)compileGLObjects(state); - #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) GLint p; glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_RESIDENT, &p); #endif diff --git a/src/osgFX/AnisotropicLighting.cpp b/src/osgFX/AnisotropicLighting.cpp index 1acad4c83..a6ef53359 100644 --- a/src/osgFX/AnisotropicLighting.cpp +++ b/src/osgFX/AnisotropicLighting.cpp @@ -216,7 +216,7 @@ namespace texenv->setMode(osg::TexEnv::DECAL); ss->setTextureAttributeAndModes(0, texenv.get(), osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON); - #if !defined(OSG_GLES2_AVAILABLE) + #if !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) ss->setMode( GL_ALPHA_TEST, osg::StateAttribute::OFF ); #else osg::notify(osg::NOTICE)<<"Warning: osgFX::AnisotropicLighting unable to disable GL_ALPHA_TEST."<disableAllVertexArrays(); - #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) glPushAttrib(GL_TRANSFORM_BIT); glEnable(GL_RESCALE_NORMAL); #endif @@ -539,7 +539,7 @@ void Text3D::drawImplementation(osg::RenderInfo& renderInfo) const default: renderPerGlyph(*renderInfo.getState()); break; } - #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) glPopAttrib(); #endif } diff --git a/src/osgUtil/RenderStage.cpp b/src/osgUtil/RenderStage.cpp index 8f10a9173..7b78430d4 100644 --- a/src/osgUtil/RenderStage.cpp +++ b/src/osgUtil/RenderStage.cpp @@ -1286,7 +1286,7 @@ void RenderStage::drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& pr state.haveAppliedAttribute( osg::StateAttribute::STENCIL ); } - #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) if (_clearMask & GL_ACCUM_BUFFER_BIT) { glClearAccum( _clearAccum[0], _clearAccum[1], _clearAccum[2], _clearAccum[3]); diff --git a/src/osgUtil/SceneView.cpp b/src/osgUtil/SceneView.cpp index 13f9981a2..3e9766467 100644 --- a/src/osgUtil/SceneView.cpp +++ b/src/osgUtil/SceneView.cpp @@ -30,7 +30,7 @@ using namespace osg; using namespace osgUtil; -#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) +#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) // define under GLES to keep the main SceneView.cpp clean. #define GL_BACK_LEFT 0x0402 #define GL_BACK_RIGHT 0x0403 @@ -1289,7 +1289,7 @@ void SceneView::draw() break; case(osg::DisplaySettings::VERTICAL_INTERLACE): { - #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) if( 0 == ( _camera->getInheritanceMask() & DRAW_BUFFER) ) { _renderStageLeft->setDrawBuffer(_camera->getDrawBuffer()); @@ -1372,7 +1372,7 @@ void SceneView::draw() break; case(osg::DisplaySettings::HORIZONTAL_INTERLACE): { - #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) if( 0 == ( _camera->getInheritanceMask() & DRAW_BUFFER) ) { _renderStageLeft->setDrawBuffer(_camera->getDrawBuffer()); @@ -1454,7 +1454,7 @@ void SceneView::draw() break; case(osg::DisplaySettings::CHECKERBOARD): { - #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE) if( 0 == ( _camera->getInheritanceMask() & DRAW_BUFFER) ) { _renderStageLeft->setDrawBuffer(_camera->getDrawBuffer()); diff --git a/src/osgViewer/GraphicsWindowWin32.cpp b/src/osgViewer/GraphicsWindowWin32.cpp index 2366bf071..155712a2a 100644 --- a/src/osgViewer/GraphicsWindowWin32.cpp +++ b/src/osgViewer/GraphicsWindowWin32.cpp @@ -92,6 +92,24 @@ static osg::ApplicationUsageProxy GraphicsWindowWin32_e0(osg::ApplicationUsage:: #define WGL_SAMPLE_BUFFERS_ARB 0x2041 #define WGL_SAMPLES_ARB 0x2042 +#ifndef WGL_ARB_create_context +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 +#define ERROR_INVALID_VERSION_ARB 0x2095 +#endif + +#ifndef WGL_ARB_create_context +#define WGL_ARB_create_context 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HGLRC WINAPI wglCreateContextAttribsARB (HDC, HGLRC, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList); +#endif + // // Entry points used from the WGL extensions //