-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// File : OpenGLUtils_FrameBuffer.cxx
// Module : SALOME
//
+#ifdef VTK_OPENGL2
+#define GL_GLEXT_PROTOTYPES
+#endif
+
+
#include "OpenGLUtils_FrameBuffer.h"
#include <utilities.h>
# ifndef GLX_GLXEXT_LEGACY
# define GLX_GLXEXT_LEGACY
# endif
+#ifdef __APPLE__
+#import <mach-o/dyld.h>
+#import <stdlib.h>
+#import <string.h>
+void * glXGetProcAddressARB (const GLubyte *name)
+
+{
+ NSSymbol symbol;
+ char *symbolName;
+ symbolName = (char *)malloc (strlen ((const char *)name) + 2); // 1
+ strcpy(symbolName + 1, (const char *)name); // 2
+ symbolName[0] = '_'; // 3
+ symbol = NULL;
+ if (NSIsSymbolNameDefined (symbolName)) // 4
+ symbol = NSLookupAndBindSymbol (symbolName);
+ free (symbolName); // 5
+ return symbol ? NSAddressOfSymbol (symbol) : NULL; // 6
+}
+#else
# include <GL/glx.h>
+#endif
# include <dlfcn.h>
#else
# include <wingdi.h>
bool OpenGLUtils_FrameBuffer::init( const GLsizei& xSize, const GLsizei& ySize )
{
+#if defined(VTK_OPENGL2) && ! defined(WIN32)
+ int n = 0;
+ std::ostringstream strm;
+ glGetIntegerv(GL_NUM_EXTENSIONS, &n);
+ for (int i = 0; i < n; i++)
+ {
+ const char *exti = (const char *)glGetStringi(GL_EXTENSIONS, i);
+ strm<< exti <<" ";
+ }
+ std::string s = strm.str();
+ const char* ext = s.c_str();
+#else
char* ext = (char*)glGetString( GL_EXTENSIONS );
- if( !IsEXTInitialized ||
+#endif
+ if( !IsEXTInitialized || !ext ||
strstr( ext, "GL_EXT_framebuffer_object" ) == NULL )
{
MESSAGE( "Initializing OpenGL FrameBuffer extension failed" );