Commit 3e523347 authored by Martin Schultz's avatar Martin Schultz
Browse files

stopped using glew on OSX, because it did not load core profile functions...

stopped using glew on OSX, because it did not load core profile functions properly. use gl3.h instead. This causes a warning, because gl.h is also included, remove gl.h as soon as we don need to support compatibility contexts anymore.

added functionality to query exensions the modern way to ACG
use this function in about widget to display supported extensions.
parent fe889cfc
......@@ -2075,9 +2075,11 @@ void GLState::bindFramebuffer(GLenum _target, GLuint _framebuffer)
if (stateStack_.back().framebuffers_[i] != _framebuffer)
#endif
{
if (!glBindFramebufferEXT)
#ifndef __APPLE__
if (!glBindFramebuffer)
glewInit();
glBindFramebufferEXT(_target, _framebuffer);
#endif
glBindFramebuffer(_target, _framebuffer);
stateStack_.back().framebuffers_[i] = _framebuffer;
}
}
......
......@@ -65,7 +65,7 @@
#if defined(ARCH_DARWIN)
#include <GL/glew.h>
#include <OpenGL/gl3.h>
#elif defined(WIN32)
......
......@@ -63,9 +63,10 @@ inline const char *_getExtensionString() {
// glGetString(GL_EXTENSIONS) is deprecated and not available in core profile
// enumerate extensions with glGetStringi(GL_EXTENSIONS, id) instead
#ifndef __APPLE__
if (!glGetStringi)
glewInit();
#endif
static std::string supported_str;
if (supported_str.empty()) {
......@@ -92,6 +93,11 @@ inline const char *_getExtensionString() {
}
}
std::string getExtensionString()
{
return _getExtensionString();
}
/** Check if the extension given by a std::string is supported by the current OpenGL extension
*/
bool checkExtensionSupported( const std::string& _extension ) {
......
......@@ -255,6 +255,13 @@ inline void ACG::GLState::texcoordPointer(GLint n, GLenum t, GLsizei s, const GL
{ ::ACG::GLState::texcoordPointer(n, t, s, p); }
*/
/**
* @brief getExtensionString returns a string containing all supported OpenGL extensions
* this function uses the new style to query the extensions
*
* @return std::string with all supported extensions
*/
std::string ACGDLLEXPORT getExtensionString( ) ;
/** Check if the extension given by a std::string is supported by the current OpenGL extension
*/
......
......@@ -110,9 +110,11 @@ void QtGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_rect)
static bool initialized = false;
if (!initialized)
{
#ifndef __APPLE__
// we use GLEW to manage extensions
// initialize it first
glewInit();
#endif
for (unsigned int i = 0; i < views_->size (); i++)
{
views_->at(i)->initializeGL ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment