Commit 3a230d93 authored by Jan Möbius's avatar Jan Möbius
Browse files

Get rid of glew on apple at least in the code, todo remove linking stuff for glew on apple

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11000 383ad7c9-94d9-4d36-a494-682f7c89f535
parent a401d68a
......@@ -1655,6 +1655,7 @@ bool Core::checkOpenGLCapabilities() {
missing += tr("Your graphics card does not support the GL_ARB_vertex_buffer_object extension!\n");
}
if ( !ok ) {
QString message = tr("Error! \nThe OpenGL capabilities of your current machine/driver are not sufficient!\n\n");
message += tr("The following checks failed:\n\n");
......
......@@ -419,13 +419,14 @@ int main(int argc, char **argv)
// After setting all Options from command line, build the real gui
w->init();
#ifndef __APPLE__
GLenum err = glewInit();
if (GLEW_OK != err)
{
/* Problem: glewInit failed, something is seriously wrong. */
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
}
#endif
for ( int i = 0 ; i < args.FileCount(); ++i )
w->commandLineOpen(args.File(i), openPolyMeshes);
......
......@@ -464,6 +464,7 @@ void CoreWidget::showAboutWidget( ) {
// =====================================================================================
// glew Information
// =====================================================================================
#ifndef __APPLE__
aboutWidget_->OpenFlipperAbout->append("\n");
aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
aboutWidget_->OpenFlipperAbout->append(tr("GLEW Specific Info:"));
......@@ -471,6 +472,7 @@ void CoreWidget::showAboutWidget( ) {
QString glewVersion = QString((const char *)glewGetString(GLEW_VERSION));
aboutWidget_->OpenFlipperAbout->append(tr("GLEW Version:\t") + glewVersion);
#endif
// =====================================================================================
// Qt information
......
......@@ -1144,10 +1144,10 @@ void glViewer::initializeGL()
// unlock update (we started locked)
properties_.unLockUpdate();
customAnaglyphSupported_ = glewIsSupported("GL_ARB_fragment_program") &&
(glewIsSupported("GL_ARB_texture_rectangle") ||
glewIsSupported("GL_EXT_texture_rectangle") ||
glewIsSupported("GL_NV_texture_rectangle"));
customAnaglyphSupported_ = ACG::checkExtensionSupported("GL_ARB_fragment_program") &&
(ACG::checkExtensionSupported("GL_ARB_texture_rectangle") ||
ACG::checkExtensionSupported("GL_EXT_texture_rectangle") ||
ACG::checkExtensionSupported("GL_NV_texture_rectangle"));
initialized_ = true;
......
......@@ -396,6 +396,11 @@ void glViewer::drawScenePhilipsStereo() {
void
glViewer::updateColorTextureBuffer() {
if ( !ACG::checkExtensionSupported("GL_ARB_texture_rectangle") ) {
std::cerr << "GL_ARB_texture_rectangle not supported! " << std::endl;
return;
}
int vp_l, vp_b, vp_w, vp_h;
glstate_->get_viewport (vp_l, vp_b, vp_w, vp_h);
......@@ -430,10 +435,10 @@ glViewer::updateColorTextureBuffer() {
// Color texture
pColorTexture_.bind();
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGB, glstate_->viewport_width(), glstate_->viewport_height(), 0,
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, glstate_->viewport_width(), glstate_->viewport_height(), 0,
GL_RGB, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
colorTextureBufferWidth_ = glstate_->viewport_width();
colorTextureBufferHeight_ = glstate_->viewport_height();
......@@ -445,6 +450,11 @@ glViewer::updateColorTextureBuffer() {
void
glViewer::updateDepthStencilTextureBuffer() {
if ( !ACG::checkExtensionSupported("GL_ARB_texture_rectangle") ) {
std::cerr << "GL_ARB_texture_rectangle not supported! " << std::endl;
return;
}
int vp_l, vp_b, vp_w, vp_h;
glstate_->get_viewport (vp_l, vp_b, vp_w, vp_h);
......@@ -481,10 +491,10 @@ glViewer::updateDepthStencilTextureBuffer() {
// Depth stencil texture
pDepthStencilTexture_.bind();
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGB, glstate_->viewport_width(), glstate_->viewport_height(), 0,
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, glstate_->viewport_width(), glstate_->viewport_height(), 0,
GL_RGB, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
depthStencilTextureBufferWidth_ = glstate_->viewport_width();
depthStencilTextureBufferHeight_ = glstate_->viewport_height();
......@@ -600,6 +610,12 @@ glViewer::updateCustomAnaglyphStereo()
if (!customAnaglyphSupported_)
return;
if ( !ACG::checkExtensionSupported("GL_ARB_texture_rectangle") ) {
std::cerr << "GL_ARB_texture_rectangle not supported! " << std::endl;
customAnaglyphSupported_ = false;
return;
}
if (!agProgram_)
{
GLint errorPos;
......@@ -634,13 +650,13 @@ glViewer::updateCustomAnaglyphStereo()
if (glstate_->viewport_width () != agTexWidth_ ||
glstate_->viewport_height () != agTexHeight_)
{
glBindTexture (GL_TEXTURE_RECTANGLE_NV, agTexture_[0]);
glTexImage2D (GL_TEXTURE_RECTANGLE_NV, 0, GL_RGB, glstate_->viewport_width (),
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[0]);
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, glstate_->viewport_width (),
glstate_->viewport_height (), 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
glBindTexture (GL_TEXTURE_RECTANGLE_NV, agTexture_[1]);
glTexImage2D (GL_TEXTURE_RECTANGLE_NV, 0, GL_RGB, glstate_->viewport_width (),
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[1]);
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, glstate_->viewport_width (),
glstate_->viewport_height (), 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
glBindTexture (GL_TEXTURE_RECTANGLE_NV, 0);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
agTexWidth_ = glstate_->viewport_width ();
agTexHeight_ = glstate_->viewport_height ();
......@@ -709,9 +725,9 @@ glViewer::drawScene_customAnaglyphStereo()
glClear(GL_DEPTH_BUFFER_BIT);
drawScene_mono();
glBindTexture (GL_TEXTURE_RECTANGLE_NV, agTexture_[0]);
glCopyTexSubImage2D (GL_TEXTURE_RECTANGLE_NV, 0, 0, 0, vp_l, vp_b, vp_w, vp_h);
glBindTexture (GL_TEXTURE_RECTANGLE_NV, 0);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[0]);
glCopyTexSubImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, vp_l, vp_b, vp_w, vp_h);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
// right eye
glMatrixMode(GL_PROJECTION);
......@@ -723,17 +739,17 @@ glViewer::drawScene_customAnaglyphStereo()
glClear(GL_DEPTH_BUFFER_BIT);
drawScene_mono();
glBindTexture (GL_TEXTURE_RECTANGLE_NV, agTexture_[1]);
glCopyTexSubImage2D (GL_TEXTURE_RECTANGLE_NV, 0, 0, 0, vp_l, vp_b, vp_w, vp_h);
glBindTexture (GL_TEXTURE_RECTANGLE_NV, 0);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[1]);
glCopyTexSubImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, vp_l, vp_b, vp_w, vp_h);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
glActiveTexture (GL_TEXTURE0);
glBindTexture (GL_TEXTURE_RECTANGLE_NV, agTexture_[0]);
glEnable (GL_TEXTURE_RECTANGLE_NV);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[0]);
glEnable (GL_TEXTURE_RECTANGLE_ARB);
glActiveTexture (GL_TEXTURE1);
glBindTexture (GL_TEXTURE_RECTANGLE_NV, agTexture_[1]);
glEnable (GL_TEXTURE_RECTANGLE_NV);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[1]);
glEnable (GL_TEXTURE_RECTANGLE_ARB);
glEnable (GL_FRAGMENT_PROGRAM_ARB);
glBindProgramARB (GL_FRAGMENT_PROGRAM_ARB, agProgram_);
......@@ -775,12 +791,12 @@ glViewer::drawScene_customAnaglyphStereo()
glDisable (GL_FRAGMENT_PROGRAM_ARB);
glActiveTexture (GL_TEXTURE1);
glBindTexture (GL_TEXTURE_RECTANGLE_NV, 0);
glDisable (GL_TEXTURE_RECTANGLE_NV);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
glDisable (GL_TEXTURE_RECTANGLE_ARB);
glActiveTexture (GL_TEXTURE0);
glBindTexture (GL_TEXTURE_RECTANGLE_NV, 0);
glDisable (GL_TEXTURE_RECTANGLE_NV);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
glDisable (GL_TEXTURE_RECTANGLE_ARB);
}
......
......@@ -106,7 +106,9 @@ void QtGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_rect)
{
// we use GLEW to manage extensions
// initialize it first
#ifndef __APPLE__
glewInit();
#endif
for (unsigned int i = 0; i < views_->size (); i++)
{
views_->at(i)->initializeGL ();
......
......@@ -110,7 +110,9 @@ void SimpleGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_re
{
// we use GLEW to manage extensions
// initialize it first
#ifndef __APPLE__
glewInit();
#endif
view_->initializeGL();
cursorPainter_->initializeGL ();
initialized_ = true;
......
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