Changeset 10703
- Timestamp:
- 10/30/09 16:17:38 (4 years ago)
- Location:
- OpenSceneGraph/trunk
- Files:
-
- 13 modified
-
CMakeLists.txt (modified) (1 diff)
-
CMakeModules/OsgMacroUtils.cmake (modified) (3 diffs)
-
include/osg/ClipPlane (modified) (1 diff)
-
include/osg/GL2Extensions (modified) (2 diffs)
-
include/osg/Light (modified) (1 diff)
-
include/osg/Transform (modified) (1 diff)
-
include/osgViewer/api/X11/GraphicsWindowX11 (modified) (4 diffs)
-
include/osgViewer/api/X11/PixelBufferX11 (modified) (3 diffs)
-
src/osgPlugins/osg/StateSet.cpp (modified) (1 diff)
-
src/osgPlugins/scale/ReaderWriterSCALE.cpp (modified) (1 diff)
-
src/osgViewer/CMakeLists.txt (modified) (1 diff)
-
src/osgViewer/GraphicsWindowX11.cpp (modified) (14 diffs)
-
src/osgViewer/PixelBufferX11.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/CMakeLists.txt
r10691 r10703 287 287 OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." OFF) 288 288 OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." OFF) 289 290 SET(OPENGL_egl_LIBRARY CACHE STRING "Set the OpenGL egl library.") 289 291 290 292 # SET(OSG_GL_DISPLAYLISTS_AVAILABLE ${OSG_GL1_AVAILABLE}) -
OpenSceneGraph/trunk/CMakeModules/OsgMacroUtils.cmake
r9808 r10703 52 52 53 53 MACRO(LINK_CORELIB_DEFAULT CORELIB_NAME) 54 LINK_EXTERNAL(${CORELIB_NAME} ${OPENGL_LIBRARIES}) 54 SET(ALL_GL_LIBRARIES ${OPENGL_LIBRARIES}) 55 IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE) 56 SET(ALL_GL_LIBRARIES ${ALL_GL_LIBRARIES} ${OPENGL_egl_LIBRARY}) 57 ENDIF() 58 59 LINK_EXTERNAL(${CORELIB_NAME} ${ALL_GL_LIBRARIES}) 55 60 LINK_WITH_VARIABLES(${CORELIB_NAME} OPENTHREADS_LIBRARY) 56 61 IF(OPENSCENEGRAPH_SONAMES) … … 95 100 ENDIF(TO_INSERT) 96 101 ENDFOREACH(LINKLIB) 102 103 SET(ALL_GL_LIBRARIES ${OPENGL_LIBRARIES}) 104 IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE) 105 SET(ALL_GL_LIBRARIES ${ALL_GL_LIBRARIES} ${OPENGL_egl_LIBRARY}) 106 ENDIF() 97 107 98 108 # FOREACH(LINKLIB ${TARGET_LIBRARIES}) … … 108 118 IF(MSVC AND OSG_MSVC_VERSIONED_DLL) 109 119 #when using full path name to specify linkage, it seems that already linked libs must be specified 110 LINK_EXTERNAL(${TARGET_TARGETNAME} ${ OPENGL_LIBRARIES})120 LINK_EXTERNAL(${TARGET_TARGETNAME} ${ALL_GL_LIBRARIES}) 111 121 ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL) 112 122 -
OpenSceneGraph/trunk/include/osg/ClipPlane
r10691 r10703 21 21 #ifndef GL_CLIP_PLANE0 22 22 #define GL_CLIP_PLANE0 0x3000 23 #define GL_CLIP_PLANE1 0x3001 24 #define GL_CLIP_PLANE2 0x3002 25 #define GL_CLIP_PLANE3 0x3003 26 #define GL_CLIP_PLANE4 0x3004 27 #define GL_CLIP_PLANE5 0x3005 23 28 #endif 24 29 -
OpenSceneGraph/trunk/include/osg/GL2Extensions
r10691 r10703 37 37 #endif 38 38 39 #if !defined(GL_VERSION_2_0) 40 #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 41 #define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 42 #endif 43 39 44 #if !defined(GL_VERSION_2_0) && !defined(GL_ES_VERSION_2_0) 40 45 #define GL_VERSION_2_0 1 … … 45 50 #define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 46 51 #define GL_CURRENT_VERTEX_ATTRIB 0x8626 47 #define GL_VERTEX_PROGRAM_POINT_SIZE 0x864248 #define GL_VERTEX_PROGRAM_TWO_SIDE 0x864349 52 #define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 50 53 #define GL_STENCIL_BACK_FUNC 0x8800 -
OpenSceneGraph/trunk/include/osg/Light
r10691 r10703 21 21 #ifndef GL_LIGHT0 22 22 #define GL_LIGHT0 0x4000 23 #define GL_LIGHT1 0x4001 24 #define GL_LIGHT2 0x4002 25 #define GL_LIGHT3 0x4003 26 #define GL_LIGHT4 0x4004 27 #define GL_LIGHT5 0x4005 28 #define GL_LIGHT6 0x4006 29 #define GL_LIGHT7 0x4007 23 30 #endif 24 31 -
OpenSceneGraph/trunk/include/osg/Transform
r7648 r10703 19 19 20 20 #ifndef GL_RESCALE_NORMAL 21 #define GL_RESCALE_NORMAL 0x803A 21 #define GL_RESCALE_NORMAL 0x803A 22 #endif 23 24 #ifndef GL_NORMALIZE 25 #define GL_NORMALIZE 0x0BA1 22 26 #endif 23 27 -
OpenSceneGraph/trunk/include/osgViewer/api/X11/GraphicsWindowX11
r8763 r10703 25 25 26 26 #include <X11/X.h> 27 #include <GL/glx.h> 27 #include <X11/Xlib.h> 28 #include <X11/Xutil.h> 29 30 #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) 31 #define OSG_USE_EGL 32 #include <EGL/egl.h> 33 #else 34 #include <GL/glx.h> 35 #endif 36 37 28 38 #include <string.h> 29 39 … … 42 52 _window(0), 43 53 _visualInfo(0), 44 _glxContext(0), 54 _context(0), 55 #ifdef OSG_USE_EGL 56 _surface(0), 57 #endif 45 58 _currentCursor(0), 46 59 _initialized(false), … … 145 158 Window& getParent() { return _parent; } 146 159 Window& getWindow() { return _window; } 147 GLXContext& getGLXContext() { return _glxContext; } 160 161 162 #ifdef OSG_USE_EGL 163 typedef EGLContext Context; 164 #else 165 typedef GLXContext Context; 166 #endif 167 168 Context& getContext() { return _context; } 148 169 149 170 Cursor getCurrentCursor() { return _currentCursor; } … … 181 202 Window _window; 182 203 XVisualInfo* _visualInfo; 183 GLXContext _glxContext; 204 Context _context; 205 206 #ifdef OSG_USE_EGL 207 EGLSurface _surface; 208 #endif 184 209 185 210 Cursor _currentCursor; -
OpenSceneGraph/trunk/include/osgViewer/api/X11/PixelBufferX11
r7873 r10703 20 20 #define OSGVIEWER_PIXELBUFFERX11 1 21 21 22 #include <osg/GraphicsContext> 23 #include <osgViewer/Export> 22 #include <osgViewer/api/X11/GraphicsWindowX11> 24 23 25 #define GLX_GLXEXT_PROTOTYPES 1 26 27 #include <X11/X.h> 28 #include <GL/glx.h> 29 30 #ifndef GLX_VERSION_1_3 31 typedef XID GLXPbuffer; 24 #ifndef OSG_USE_EGL 25 #ifndef GLX_VERSION_1_3 26 typedef XID GLXPbuffer; 27 #endif 32 28 #endif 33 34 29 35 30 namespace osgViewer … … 78 73 Display* getDisplay() const { return _display; } 79 74 80 GLXPbuffer& getPbuffer() { return _pbuffer; } 81 GLXContext& getGLXContext() { return _glxContext; } 75 #ifdef OSG_USE_EGL 76 typedef EGLContext Context; 77 typedef EGLSurface Pbuffer; 78 #else 79 typedef GLXContext Context; 80 typedef GLXPbuffer Pbuffer; 81 #endif 82 83 Pbuffer& getPbuffer() { return _pbuffer; } 84 Context& getContext() { return _context; } 82 85 83 86 protected: … … 91 94 bool _valid; 92 95 Display* _display; 93 GLXPbuffer_pbuffer;96 Pbuffer _pbuffer; 94 97 XVisualInfo* _visualInfo; 95 GLXContext _glxContext;98 Context _context; 96 99 97 100 bool _initialized; -
OpenSceneGraph/trunk/src/osgPlugins/osg/StateSet.cpp
r10699 r10703 7 7 #include <osg/PolygonOffset> 8 8 #include <osg/LineStipple> 9 #include <osg/Light> 10 #include <osg/ClipPlane> 11 #include <osg/AlphaFunc> 12 #include <osg/Point> 13 #include <osg/Material> 14 #include <osg/Fog> 15 #include <osg/GL2Extensions> 9 16 10 17 #include <osgDB/Registry> -
OpenSceneGraph/trunk/src/osgPlugins/scale/ReaderWriterSCALE.cpp
r10504 r10703 166 166 xform->addChild( node ); 167 167 168 // turn on GL_NORMALIZE to prevent problems with scaled normals 169 osg::StateSet* ss = xform->getOrCreateStateSet(); 170 ss->setMode( GL_NORMALIZE, osg::StateAttribute::ON ); 171 168 #ifndef OSG_GLES2_AVAILABLE 169 // turn on GL_NORMALIZE to prevent problems with scaled normals 170 osg::StateSet* ss = xform->getOrCreateStateSet(); 171 ss->setMode( GL_NORMALIZE, osg::StateAttribute::ON ); 172 #endif 173 172 174 return xform; 173 175 } -
OpenSceneGraph/trunk/src/osgViewer/CMakeLists.txt
r10699 r10703 109 109 ENDIF() 110 110 111 IF(OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE) 112 ELSE() 113 SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} 114 ${HEADER_PATH}/api/X11/GraphicsWindowX11 115 ${HEADER_PATH}/api/X11/PixelBufferX11 116 ) 111 SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} 112 ${HEADER_PATH}/api/X11/GraphicsWindowX11 113 ${HEADER_PATH}/api/X11/PixelBufferX11 114 ) 117 115 118 SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} 119 GraphicsWindowX11.cpp 120 PixelBufferX11.cpp 121 ) 122 ENDIF() 116 SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} 117 GraphicsWindowX11.cpp 118 PixelBufferX11.cpp 119 ) 123 120 124 121 IF(OSGVIEWER_USE_XRANDR) -
OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowX11.cpp
r10544 r10703 277 277 else 278 278 { 279 #ifdef OSG_USE_EGL 280 281 _visualInfo = new XVisualInfo; 282 int depth = DefaultDepth( _display, _traits->screenNum ); 283 if (XMatchVisualInfo( _display, _traits->screenNum, depth, TrueColor, _visualInfo )==0) 284 { 285 osg::notify(osg::NOTICE)<<"GraphicsWindowX11::createVisualInfo() failed."<<std::endl; 286 return false; 287 } 288 289 #else 279 290 280 291 typedef std::vector<int> Attributes; … … 298 309 if (_traits->stencil) { attributes.push_back(GLX_STENCIL_SIZE); attributes.push_back(_traits->stencil); } 299 310 300 #if defined(GLX_SAMPLE_BUFFERS) && defined (GLX_SAMPLES)301 302 if (_traits->sampleBuffers) { attributes.push_back(GLX_SAMPLE_BUFFERS); attributes.push_back(_traits->sampleBuffers); }303 if (_traits->sampleBuffers) { attributes.push_back(GLX_SAMPLES); attributes.push_back(_traits->samples); }304 305 #endif311 #if defined(GLX_SAMPLE_BUFFERS) && defined (GLX_SAMPLES) 312 313 if (_traits->sampleBuffers) { attributes.push_back(GLX_SAMPLE_BUFFERS); attributes.push_back(_traits->sampleBuffers); } 314 if (_traits->sampleBuffers) { attributes.push_back(GLX_SAMPLES); attributes.push_back(_traits->samples); } 315 316 #endif 306 317 // TODO 307 318 // GLX_AUX_BUFFERS … … 314 325 315 326 _visualInfo = glXChooseVisual( _display, _traits->screenNum, &(attributes.front()) ); 327 #endif 316 328 } 317 329 … … 603 615 _ownsWindow = windowHandle == 0; 604 616 605 606 607 617 _display = XOpenDisplay(_traits->displayName().c_str()); 608 618 … … 614 624 } 615 625 616 // Query for GLX extension 617 int errorBase, eventBase; 618 if( glXQueryExtension( _display, &errorBase, &eventBase) == False ) 619 { 620 osg::notify(osg::NOTICE)<<"Error: " << XDisplayName(_traits->displayName().c_str()) <<" has no GLX extension." << std::endl; 621 622 XCloseDisplay( _display ); 623 _display = 0; 624 _valid = false; 625 return; 626 } 627 626 #ifdef OSG_USE_EGL 627 628 EGLDisplay eglDisplay = eglGetDisplay((EGLNativeDisplayType)_display); 629 630 EGLint eglMajorVersion, eglMinorVersion; 631 if (!eglInitialize(eglDisplay, &eglMajorVersion, &eglMinorVersion)) 632 { 633 osg::notify(osg::NOTICE)<<"GraphicsWindowX11::init() - eglInitialize() failed."<<std::endl; 634 635 XCloseDisplay( _display ); 636 _display = 0; 637 _valid = false; 638 return; 639 } 640 641 osg::notify(osg::NOTICE)<<"GraphicsWindowX11::init() - eglInitialize() succeded eglMajorVersion="<<eglMajorVersion<<" iMinorVersion="<<eglMinorVersion<<std::endl; 642 643 #else 644 // Query for GLX extension 645 int errorBase, eventBase; 646 if( glXQueryExtension( _display, &errorBase, &eventBase) == False ) 647 { 648 osg::notify(osg::NOTICE)<<"Error: " << XDisplayName(_traits->displayName().c_str()) <<" has no GLX extension." << std::endl; 649 650 XCloseDisplay( _display ); 651 _display = 0; 652 _valid = false; 653 return; 654 } 655 #endif 656 628 657 // osg::notify(osg::NOTICE)<<"GLX extension, errorBase="<<errorBase<<" eventBase="<<eventBase<<std::endl; 629 658 … … 648 677 } 649 678 650 GLXContext sharedContextGLX = NULL;679 Context sharedContextGLX = NULL; 651 680 652 681 // get any shared GLX contexts … … 654 683 if (graphicsWindowX11) 655 684 { 656 sharedContextGLX = graphicsWindowX11->get GLXContext();685 sharedContextGLX = graphicsWindowX11->getContext(); 657 686 } 658 687 else … … 661 690 if (pixelBufferX11 && pixelBufferX11->valid()) 662 691 { 663 sharedContextGLX = pixelBufferX11->getGLXContext(); 664 } 665 } 666 667 _glxContext = glXCreateContext( _display, _visualInfo, sharedContextGLX, True ); 668 669 if (!_glxContext) 670 { 671 osg::notify(osg::NOTICE)<<"Error: Unable to create OpenGL graphics context."<<std::endl; 672 XCloseDisplay( _display ); 673 _display = 0; 674 _valid = false; 675 return; 676 } 677 678 _initialized = _ownsWindow ? createWindow() : setWindow(windowHandle); 679 _valid = _initialized; 680 692 sharedContextGLX = pixelBufferX11->getContext(); 693 } 694 } 695 696 #ifdef OSG_USE_EGL 697 698 _valid = _ownsWindow ? createWindow() : setWindow(windowHandle); 699 700 if (!_valid) 701 { 702 XCloseDisplay( _display ); 703 _display = 0; 704 return; 705 } 706 707 osg::notify(osg::NOTICE)<<"GraphicsWindowX11::init() - window created ="<<_valid<<std::endl; 708 709 EGLConfig eglConfig = 0; 710 711 #if defined(OSG_GLES1_AVAILABLE) 712 EGLint configAttribs[3]; 713 configAttribs[0] = EGL_SURFACE_TYPE; 714 configAttribs[1] = EGL_WINDOW_BIT; 715 configAttribs[2] = EGL_NONE; 716 #else 717 EGLint configAttribs[5]; 718 configAttribs[0] = EGL_SURFACE_TYPE; 719 configAttribs[1] = EGL_WINDOW_BIT; 720 configAttribs[2] = EGL_RENDERABLE_TYPE; 721 configAttribs[3] = EGL_OPENGL_ES2_BIT; 722 configAttribs[4] = EGL_NONE; 723 #endif 724 725 int numConfigs; 726 if (!eglChooseConfig(eglDisplay, configAttribs, &eglConfig, 1, &numConfigs) || (numConfigs != 1)) 727 { 728 osg::notify(osg::NOTICE)<<"GraphicsWindowX11::init() - eglChooseConfig() failed."<<std::endl; 729 XCloseDisplay( _display ); 730 _valid = false; 731 _display = 0; 732 return; 733 } 734 735 _surface = eglCreateWindowSurface(eglDisplay, eglConfig, (EGLNativeWindowType)_window, NULL); 736 if (_surface == EGL_NO_SURFACE) 737 { 738 osg::notify(osg::NOTICE)<<"GraphicsWindowX11::init() - eglCreateWindowSurface(..) failed."<<std::endl; 739 XCloseDisplay( _display ); 740 _valid = false; 741 _display = 0; 742 return; 743 } 744 745 #if defined(OSG_GLES1_AVAILABLE) 746 EGLint* contextAttribs = 0; 747 #else 748 EGLint contextAttribs[3]; 749 pi32ContextAttribs[0] = EGL_CONTEXT_CLIENT_VERSION; 750 pi32ContextAttribs[1] = 2; 751 pi32ContextAttribs[2] = EGL_NONE; 752 #endif 753 754 _context = eglCreateContext(eglDisplay, eglConfig, NULL, contextAttribs); 755 if (_context == EGL_NO_CONTEXT) 756 { 757 osg::notify(osg::NOTICE)<<"GraphicsWindowX11::init() - eglCreateContext(..) failed."<<std::endl; 758 XCloseDisplay( _display ); 759 _valid = false; 760 _display = 0; 761 return; 762 } 763 764 _initialized = true; 765 766 #else 767 768 _context = glXCreateContext( _display, _visualInfo, sharedContextGLX, True ); 769 770 if (!_context) 771 { 772 osg::notify(osg::NOTICE)<<"Error: Unable to create OpenGL graphics context."<<std::endl; 773 XCloseDisplay( _display ); 774 _display = 0; 775 _valid = false; 776 return; 777 } 778 779 _initialized = _ownsWindow ? createWindow() : setWindow(windowHandle); 780 _valid = _initialized; 781 782 #endif 783 681 784 if (_valid == false) 682 785 { … … 724 827 { 725 828 osg::notify(osg::NOTICE)<<"Error: Unable to create Window."<<std::endl; 726 _ glxContext = 0;829 _context = 0; 727 830 return false; 728 831 } … … 850 953 } 851 954 852 // osg::notify(osg::NOTICE)<<"GraphicsWindowX11::makeCurrentImplementation "<<this<<" "<<OpenThreads::Thread::CurrentThread()<<std::endl; 853 // osg::notify(osg::NOTICE)<<" glXMakeCurrent ("<<_display<<","<<_window<<","<<_glxContext<<std::endl; 854 855 return glXMakeCurrent( _display, _window, _glxContext )==True; 955 #ifdef OSG_USE_EGL 956 EGLDisplay eglDisplay = eglGetDisplay((EGLNativeDisplayType)_display); 957 bool result = eglMakeCurrent(eglDisplay, _surface, _surface, _context)==EGL_TRUE; 958 959 osg::notify(osg::NOTICE)<<"GraphicsWindowX11::makeCurrentImplementation "<<this<<" "<<OpenThreads::Thread::CurrentThread()<<" _surface="<<_surface<<" _context="<<_context<<" result="<<result<<std::endl; 960 961 return result; 962 #else 963 return glXMakeCurrent( _display, _window, _context )==True; 964 #endif 856 965 } 857 966 … … 864 973 } 865 974 866 // osg::notify(osg::NOTICE)<<"GraphicsWindowX11::releaseContextImplementation() "<<this<<" "<<OpenThreads::Thread::CurrentThread()<<std::endl; 867 // osg::notify(osg::NOTICE)<<" glXMakeCurrent ("<<_display<<std::endl; 868 869 return glXMakeCurrent( _display, None, NULL )==True; 975 osg::notify(osg::NOTICE)<<"GraphicsWindowX11::releaseContextImplementation() "<<this<<" "<<OpenThreads::Thread::CurrentThread()<<std::endl; 976 977 #ifdef OSG_USE_EGL 978 EGLDisplay eglDisplay = eglGetDisplay((EGLNativeDisplayType)_display); 979 return eglMakeCurrent( eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT )==EGL_TRUE; 980 #else 981 return glXMakeCurrent( _display, None, NULL )==True; 982 #endif 870 983 } 871 984 … … 883 996 if (_display) 884 997 { 885 if (_glxContext) 886 { 887 glXDestroyContext(_display, _glxContext ); 998 if (_context) 999 { 1000 #ifdef OSG_USE_EGL 1001 EGLDisplay eglDisplay = eglGetDisplay((EGLNativeDisplayType)_display); 1002 eglDestroyContext( eglDisplay, _context ); 1003 #else 1004 glXDestroyContext( _display, _context ); 1005 #endif 888 1006 } 889 1007 … … 899 1017 _window = 0; 900 1018 _parent = 0; 901 _ glxContext = 0;1019 _context = 0; 902 1020 903 1021 if (_visualInfo) 904 1022 { 905 XFree(_visualInfo); 1023 #ifdef OSG_USE_EGL 1024 delete _visualInfo; 1025 #else 1026 XFree(_visualInfo); 1027 #endif 906 1028 _visualInfo = 0; 907 1029 } … … 925 1047 // osg::notify(osg::NOTICE)<<"swapBuffersImplementation "<<this<<" "<<OpenThreads::Thread::CurrentThread()<<std::endl; 926 1048 927 glXSwapBuffers(_display, _window); 1049 #ifdef OSG_USE_EGL 1050 EGLDisplay eglDisplay = eglGetDisplay((EGLNativeDisplayType)_display); 1051 eglSwapBuffers( eglDisplay, _surface ); 1052 #else 1053 glXSwapBuffers( _display, _window ); 1054 #endif 928 1055 929 1056 while( XPending(_display) ) -
OpenSceneGraph/trunk/src/osgViewer/PixelBufferX11.cpp
r8362 r10703 32 32 _pbuffer(0), 33 33 _visualInfo(0), 34 _ glxContext(0),34 _context(0), 35 35 _initialized(false), 36 36 _realized(false), … … 235 235 } 236 236 237 _ glxContext = glXCreateContext( _display, _visualInfo, sharedContextGLX, True );238 239 if (!_ glxContext)237 _context = glXCreateContext( _display, _visualInfo, sharedContextGLX, True ); 238 239 if (!_context) 240 240 { 241 241 osg::notify(osg::NOTICE)<<"Error: Unable to create OpenGL graphics context."<<std::endl; … … 295 295 XCloseDisplay( _display ); 296 296 _display = 0; 297 _ glxContext = 0;297 _context = 0; 298 298 _valid = false; 299 299 return; … … 313 313 if (_display) 314 314 { 315 if (_ glxContext)316 { 317 glXDestroyContext(_display, _ glxContext );315 if (_context) 316 { 317 glXDestroyContext(_display, _context ); 318 318 } 319 319 … … 339 339 340 340 _pbuffer = 0; 341 _ glxContext = 0;341 _context = 0; 342 342 343 343 if (_visualInfo) … … 375 375 // osg::notify(osg::NOTICE)<<"Closing PixelBufferX11"<<std::endl; 376 376 _pbuffer = 0; 377 _ glxContext = 0;377 _context = 0; 378 378 _initialized = false; 379 379 _realized = false; … … 409 409 410 410 // osg::notify(osg::NOTICE)<<"PixelBufferX11::makeCurrentImplementation "<<this<<" "<<OpenThreads::Thread::CurrentThread()<<std::endl; 411 // osg::notify(osg::NOTICE)<<" glXMakeCurrent ("<<_display<<","<<_pbuffer<<","<<_glxContext<<std::endl; 412 413 return glXMakeCurrent( _display, _pbuffer, _glxContext )==True; 411 412 #ifdef OSG_USE_EGL 413 return eglMakeCurrent(_display, _pbuffer, _pbuffer, _context)==EGL_TRUE; 414 #else 415 return glXMakeCurrent( _display, _pbuffer, _context )==True; 416 #endif 414 417 } 415 418 … … 430 433 431 434 // osg::notify(osg::NOTICE)<<"PixelBufferX11::releaseContextImplementation() "<<this<<" "<<OpenThreads::Thread::CurrentThread()<<std::endl; 432 // osg::notify(osg::NOTICE)<<" glXMakeCurrent ("<<_display<<std::endl; 433 434 return glXMakeCurrent( _display, None, NULL )==True; 435 436 #ifdef OSG_USE_EGL 437 return eglMakeCurrent( _display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT )==EGL_TRUE; 438 #else 439 return glXMakeCurrent( _display, None, NULL )==True; 440 #endif 435 441 } 436 442 … … 447 453 // osg::notify(osg::NOTICE)<<"PixelBufferX11::swapBuffersImplementation "<<this<<" "<<OpenThreads::Thread::CurrentThread()<<std::endl; 448 454 449 glXSwapBuffers(_display, _pbuffer); 450 } 455 #ifdef OSG_USE_EGL 456 eglSwapBuffers( _display, _pbuffer ); 457 #else 458 glXSwapBuffers( _display, _pbuffer ); 459 #endif 460 }
