Commit 329e575f authored by Sylvain Thery's avatar Sylvain Thery

full GL 3.3 coreprofile support

parent 2b08f627
......@@ -837,9 +837,6 @@ void Clipping::importMesh(std::string& filename)
void Clipping::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
// create the render
m_render = new Algo::Render::GL2::MapRender();
m_render_topo = new Algo::Render::GL2::Topo3RenderMap<PFP>();
......
......@@ -139,9 +139,6 @@ unsigned int nb_ears;
void MyQT::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
// create the render
m_render = new Algo::Render::GL2::MapRender();
......
......@@ -59,9 +59,6 @@ MAP myMap;
void MyQT::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
// create the render
m_render = new Algo::Render::GL2::MapRender();
......
......@@ -57,9 +57,6 @@ PFP::MAP myMap;
void MyQT::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
m_frame = new Utils::FrameManipulator();
// frame is rendered twice the size of normal
......
......@@ -49,8 +49,6 @@ void MCMesh::cb_initGL()
Geom::Vec4f colDif(0.8f, 0.9f, 0.7f, 1.0f);
Geom::Vec4f colSpec(0.9f, 0.9f, 0.9f, 1.0f);
Utils::GLSLShader::setCurrentOGLVersion(2);
m_render = new Algo::Render::GL2::MapRender();
m_positionVBO = new Utils::VBO();
......
......@@ -60,8 +60,6 @@ void SimpleGMap2::initGUI()
void SimpleGMap2::cb_initGL()
{
Utils::GLSLShader::setCurrentOGLVersion(1) ;
Geom::BoundingBox<VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
VEC3 gPosObj = bb.center() ;
float tailleX = bb.size(0) ;
......
......@@ -122,8 +122,6 @@ void SimpleGMap3::cb_keyPress(int code)
void SimpleGMap3::cb_initGL()
{
Utils::GLSLShader::setCurrentOGLVersion(2) ;
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
VEC3 gPosObj = bb.center() ;
float tailleX = bb.size(0) ;
......
......@@ -95,8 +95,6 @@ void SimpleMap3::initGUI()
void SimpleMap3::cb_initGL()
{
Utils::GLSLShader::setCurrentOGLVersion(2) ;
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
VEC3 gPosObj = bb.center() ;
float tailleX = bb.size(0) ;
......
......@@ -48,9 +48,6 @@ TexView::~TexView()
void TexView::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
// create VBO for position
m_positionVBO = new Utils::VBO;
m_texcoordVBO = new Utils::VBO;
......
......@@ -23,7 +23,6 @@
*******************************************************************************/
#include "viewer.h"
#include "Utils/chrono.h"
Viewer::Viewer() :
m_renderStyle(FLAT),
......@@ -38,7 +37,8 @@ Viewer::Viewer() :
m_flatShader(NULL),
m_vectorShader(NULL),
m_simpleColorShader(NULL),
m_pointSprite(NULL)
m_pointSprite(NULL),
m_nbFrames(0)
{
normalScaleFactor = 1.0f ;
vertexScaleFactor = 0.1f ;
......@@ -78,9 +78,11 @@ void Viewer::initGUI()
void Viewer::cb_initGL()
{
Utils::GLSLShader::setCurrentOGLVersion(2) ;
CGoGNout << "GL VERSION = "<< glGetString(GL_VERSION)<< CGoGNendl;
Utils::GLSLShader::areShadersSupported();
int major = 0;
int minor = 0;
glGetIntegerv(GL_MAJOR_VERSION, &major);
glGetIntegerv(GL_MINOR_VERSION, &minor);
CGoGNout <<"Using GL "<< major <<"."<< minor << CGoGNendl;
m_render = new Algo::Render::GL2::MapRender() ;
m_topoRender = new Algo::Render::GL2::TopoRender() ;
......@@ -174,6 +176,14 @@ void Viewer::cb_redraw()
glLineWidth(1.0f) ;
m_render->draw(m_vectorShader, Algo::Render::GL2::POINTS) ;
}
m_nbFrames++;
if (m_nbFrames >=100)
{
std::cout << 100000.0/m_frame_ch.elapsed()<< " fps"<<std::endl;
m_nbFrames = 0;
m_frame_ch.start();
}
}
void Viewer::cb_Open()
......
......@@ -48,6 +48,7 @@
#include "Utils/pointSprite.h"
#include "Utils/text3d.h"
#include "Utils/vbo.h"
#include "Utils/chrono.h"
#include "Utils/Qt/qtInputs.h"
......@@ -115,6 +116,9 @@ public:
Utils::ShaderSimpleColor* m_simpleColorShader ;
Utils::PointSprite* m_pointSprite ;
Utils::Chrono m_frame_ch;
unsigned int m_nbFrames;
Viewer() ;
void initGUI() ;
......
......@@ -96,9 +96,6 @@ void ObjView::cb_keyPress(int k)
void ObjView::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
m_dr = new Utils::Drawer;
// create VBO for position
......
......@@ -204,11 +204,6 @@ void MyQT::cb_Save()
void MyQT::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
CGoGNout << "GL VERSION = "<< glGetString(GL_VERSION)<< CGoGNendl;
Utils::GLSLShader::areShadersSupported();
// create the renders
m_topo_render = new Algo::Render::GL2::Topo3RenderMap<PFP>();
m_explode_render = new Algo::Render::GL2::ExplodeVolumeRender(true,true,true);
......@@ -447,7 +442,7 @@ int main(int argc, char **argv)
{
position = myMap.addAttribute<VEC3, VERTEX, MAP>("position");
int nb = 64;
int nb = 32;
Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, nb, nb, nb);
cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f);
......
......@@ -82,8 +82,6 @@ void Viewer::initGUI()
void Viewer::cb_initGL()
{
Utils::GLSLShader::setCurrentOGLVersion(2) ;
m_render = new Algo::Render::GL2::MapRender() ;
m_topoRender = new Algo::Render::GL2::TopoRender() ;
......
......@@ -60,8 +60,6 @@ VertexAttribute<VEC3, MAP> normal;
void MyQT::cb_initGL()
{
Utils::GLSLShader::setCurrentOGLVersion(2);
// create the render
m_render = new Algo::Render::GL2::MapRender();
......
......@@ -37,8 +37,6 @@ void MyQT::cb_initGL()
Geom::Vec3f lPosObj = (bb.min() + bb.max()) / PFP::REAL(2);
setParamObject(lWidthObj,lPosObj.data());
Utils::GLSLShader::setCurrentOGLVersion(2);
// create the render
m_render = new Algo::Render::GL2::MapRender();
......@@ -58,11 +56,19 @@ void MyQT::cb_initGL()
// FOR WALL PAPER
m_textureWP = new Utils::Texture<2,Geom::Vec3uc>(GL_UNSIGNED_BYTE);
if (!m_textureWP->load("../SCHNApps/resources/cgogn/cgogn2.png"))
if (!m_textureWP->load("../../SCHNApps/resources/cgogn/cgogn2.png"))
computeTexture();
m_textureWP->update();
m_textureWP->setWrapping(GL_CLAMP_TO_EDGE);
m_textureWP2 = new Utils::Texture<2,Geom::Vec3uc>(GL_UNSIGNED_BYTE);
if (!m_textureWP2->load("../../SCHNApps/resources/icons/cameras.png"))
computeTexture();
m_textureWP2->update();
m_textureWP2->setWrapping(GL_CLAMP_TO_EDGE);
m_shaderWP = new Utils::ShaderWallPaper();
m_shaderWP->setTextureUnit(GL_TEXTURE0);
m_shaderWP->setTexture(m_textureWP);
......@@ -78,7 +84,10 @@ void MyQT::cb_redraw()
// FOR WALL PAPER
m_render->draw(m_shader, Algo::Render::GL2::LINES);
m_shaderWP->setTexture(m_textureWP);
m_shaderWP->draw();
m_shaderWP->drawFront(this->getWidth(), this->getHeight(),150,10,200,200,m_textureWP2);
}
......@@ -87,7 +96,7 @@ void MyQT::cb_keyPress(int keycode)
switch(keycode)
{
case 'l' :
if (m_textureWP->load("../SCHNApps/resources/cgogn/cgogn2.png"))
if (m_textureWP->load("../../SCHNApps/resources/cgogn/cgogn2.png"))
m_textureWP->update();
m_textureWP->setWrapping(GL_CLAMP_TO_EDGE);
break;
......
......@@ -74,6 +74,7 @@ public:
// FOR WALL PAPER
Utils::Texture<2,Geom::Vec3uc>* m_textureWP;
Utils::Texture<2,Geom::Vec3uc>* m_textureWP2;
Utils::ShaderWallPaper* m_shaderWP;
MyQT():
......
......@@ -124,9 +124,6 @@ void MyQT::createMap()
// initialization GL callback
void MyQT::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
// create the render
m_render = new Algo::Render::GL2::MapRender();
......
......@@ -82,9 +82,6 @@ void MyQT::cb_explode(int x)
void MyQT::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
m_render_topo = new Algo::Render::GL2::TopoRender();
m_render_topo->updateData<PFP>(myMap, position, 0.95f, 0.9f, 0.8f);
m_dm_topo = new DartMarker<MAP>(myMap);
......
......@@ -113,9 +113,6 @@ void MyQT::cb_explode(int x)
void MyQT::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
m_render_topo = new Algo::Render::GL2::Topo3RenderMap<PFP>();
m_render_topo->updateData(myMap, position, 0.95f, 0.9f, 0.8f);
......
......@@ -124,8 +124,6 @@ void MyQT::createMap()
// initialization GL callback
void MyQT::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
// create the render
m_render = new Algo::Render::GL2::MapRender();
......
......@@ -110,9 +110,6 @@ void MyQT::storeVerticesInfo()
void MyQT::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
// create the render
m_render = new Algo::Render::GL2::MapRender();
......
......@@ -245,9 +245,6 @@ void MyQT::cb_keyPress(int keycode)
void MyQT::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
// create the render
m_render = new Algo::Render::GL2::MapRender();
......
......@@ -129,9 +129,6 @@ void MyQT::storeVerticesInfoGen(unsigned int orb, const AttributeHandlerGen* att
void MyQT::cb_initGL()
{
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
m_render_topo = new Algo::Render::GL2::Topo3RenderMap<PFP>();
m_render_topo->updateData(myMap, position, 0.9f, 0.8f, 0.8f);
......
......@@ -48,6 +48,7 @@ SET ( COMPILE_SANDBOX ON CACHE BOOL "compile all in sandbox" )
SET ( ONELIB OFF CACHE BOOL "build CGoGN in one lib" )
SET ( WITH_GLEWMX OFF CACHE BOOL "use multi-contex GLEW" )
SET( USE_OGL_CORE_PROFILE OFF CACHE BOOL "use OpenGL 3.3 core profile (do not work on mac)" )
IF(WIN32)
......@@ -83,9 +84,14 @@ ELSE (WITH_GLEWMX)
ENDIF (WITH_GLEWMX)
add_definitions(-DSHADERPATH="${CGoGN_ROOT_DIR}/lib/Shaders/")
IF(USE_OGL_CORE_PROFILE)
add_definitions(-DUSE_OGL_CORE_PROFILE=1)
ENDIF()
add_definitions(-DGLM_FORCE_RADIANS)
add_definitions(-DSHADERPATH="${CGoGN_ROOT_DIR}/lib/Shaders/")
# define includes of external libs
SET (CGoGN_EXT_INCLUDES
${CGoGN_ROOT_DIR}/ThirdParty/include
......
......@@ -16,6 +16,8 @@ SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/.. CACHE STRING "CGoGN root dir")
SET(CMAKE_MODULE_PATH ${CGoGN_ROOT_DIR}/cmake_modules/)
SET( SLOT_DEBUG_MODE OFF CACHE BOOL "build with slot debugging mode" )
SET( USE_OGL_CORE_PROFILE OFF CACHE BOOL "use OpenGL 3.3 core profile (do not work on mac)" )
find_package(OpenGL REQUIRED)
......@@ -61,6 +63,10 @@ IF(SLOT_DEBUG_MODE)
add_definitions(-DSLOT_DEBUG_MODE=1)
ENDIF()
IF(USE_OGL_CORE_PROFILE)
add_definitions(-DUSE_OGL_CORE_PROFILE=1)
ENDIF()
# define includes of external libs
SET (EXT_INCLUDES
${CGoGN_ROOT_DIR}/ThirdParty/include
......
......@@ -220,8 +220,6 @@ void Surface_RenderTopo_DockTab::updateMapParameters()
const Surface_RenderTopo_Plugin::ViewMapParam& p = m_plugin->h_viewParameterSet[view][map];
bool attChanged;
QString vec3TypeName = QString::fromStdString(nameOfType(PFP2::VEC3()));
int i = 1;
......@@ -236,7 +234,6 @@ void Surface_RenderTopo_DockTab::updateMapParameters()
if (combo_positionAttribute->currentIndex() != i)
{
combo_positionAttribute->setCurrentIndex(i);
attChanged = true;
}
}
++i;
......
......@@ -51,8 +51,8 @@ public slots:
const QList<View*>& getLinkedViews() const { return l_views; }
bool isLinkedToView(View* view) const { return l_views.contains(view); }
// const qglviewer::Vec& getBBmin() const { return m_bbMin; }
// const qglviewer::Vec& getBBmax() const { return m_bbMax; }
const qglviewer::Vec& getBBmin() const { return m_bbMin; }
const qglviewer::Vec& getBBmax() const { return m_bbMax; }
float getBBdiagSize() const { return m_bbDiagSize; }
Utils::GLSLShader* getBBDrawerShader() const
......@@ -83,6 +83,7 @@ public:
virtual void draw(Utils::GLSLShader* shader, int primitive) = 0;
virtual void drawBB() = 0;
virtual void transformedBB(qglviewer::Vec& bbMin, qglviewer::Vec& bbMax) = 0;
virtual void initBBDrawer() = 0;
void setPrimitiveDirty(int primitive) { m_render->setPrimitiveDirty(primitive); }
......@@ -256,6 +257,7 @@ public:
void drawBB();
void updateBB(const VertexAttribute<VEC3, MAP>& position);
void initBBDrawer();
void updateBBDrawer();
void transformedBB(qglviewer::Vec& bbMin, qglviewer::Vec& bbMax);
......
......@@ -82,11 +82,11 @@ void MapHandler<PFP>::draw(Utils::GLSLShader* shader, int primitive)
template <typename PFP>
void MapHandler<PFP>::drawBB()
{
if(!m_bbDrawer)
{
m_bbDrawer = new Utils::Drawer();
updateBBDrawer();
}
// if(!m_bbDrawer)
// {
// m_bbDrawer = new Utils::Drawer();
// updateBBDrawer();
// }
// QGLViewer::drawAxis();
m_bbDrawer->callList();
......@@ -97,9 +97,22 @@ void MapHandler<PFP>::updateBB(const VertexAttribute<VEC3, MAP>& position)
{
m_bb = CGoGN::Algo::Geometry::computeBoundingBox<PFP>(*(static_cast<MAP*>(m_map)), position);
m_bbDiagSize = m_bb.diagSize();
const typename PFP::VEC3& bmin = m_bb.min();
m_bbMin = qglviewer::Vec(bmin[0],bmin[1],bmin[2]);
const typename PFP::VEC3& bmax = m_bb.max();
m_bbMax = qglviewer::Vec(bmax[0],bmax[1],bmax[2]);
updateBBDrawer();
}
template <typename PFP>
void MapHandler<PFP>::initBBDrawer()
{
if(!m_bbDrawer)
m_bbDrawer = new Utils::Drawer();
}
template <typename PFP>
void MapHandler<PFP>::updateBBDrawer()
......@@ -192,7 +205,7 @@ void MapHandler<PFP>::createTopoRender(CGoGN::Utils::GLSLShader* sh1)
if (m_map->dimension() == 2)
{
CGoGN::Utils::ShaderSimpleColor* ssc =static_cast<CGoGN::Utils::ShaderSimpleColor*>(sh1);
CGoGN::Utils::ShaderSimpleColor* ssc = static_cast<CGoGN::Utils::ShaderSimpleColor*>(sh1);
m_topoRender = new Algo::Render::GL2::TopoRender(ssc);
m_topoRender->setInitialDartsColor(0.25f, 0.25f, 0.25f) ;
......
......@@ -9,6 +9,8 @@
#include "schnapps.h"
#include "Utils/gl_matrices.h"
#include "Utils/GLSLShader.h"
#include "Utils/drawer.h"
namespace CGoGN
{
......@@ -31,13 +33,13 @@ class View : public QGLViewer
public:
static unsigned int viewCount;
View(const QString& name, SCHNApps* s, const QGLWidget* shareWidget = NULL);
View(const QString& name, SCHNApps* s, QGLFormat& format);
View(const QString& name, SCHNApps* s, QGLFormat& format, const QGLWidget* shareWidget);
~View();
const QString& getName() const { return m_name; }
MapHandlerGen* lastSelectedMap() { return m_lastSelectedMap;}
// void setLastSelectedMap(MapHandlerGen* m) { m_lastSelectedMap=m; }
void closeDialogs();
......@@ -154,6 +156,8 @@ protected:
ListPopUp* m_dialogPlugins;
ListPopUp* m_dialogCameras;
Utils::Drawer* m_frameDrawer;
};
} // namespace SCHNApps
......
......@@ -9,6 +9,10 @@
#include <iostream>
#define WITH_QT 1
#include "Utils/textures.h"
#include "Utils/Shaders/shaderWallPaper.h"
namespace CGoGN
{
......@@ -16,7 +20,6 @@ namespace SCHNApps
{
class View;
struct Texture;
class ViewButton : public QObject
{
......@@ -29,7 +32,7 @@ public:
QSize getSize();
void click(int x, int y, int globalX, int globalY);
void drawAt(int x, int y);
void drawAt(int x, int y, Utils::ShaderWallPaper* shader);
static const int SIZE = 24;
static const int SPACE = 4;
......@@ -37,7 +40,7 @@ public:
protected:
QString m_img;
View* m_view;
Texture* m_tex;
Utils::Texture<2,Geom::Vec3uc>* m_texture;
signals:
void clicked(int x, int y, int globalX, int globalY);
......@@ -48,16 +51,9 @@ class ViewButtonArea : public QObject
Q_OBJECT
public:
ViewButtonArea(View* view) :
m_view(view),
m_form(0,0,0,0)
{}
ViewButtonArea(View* view);
~ViewButtonArea()
{
// foreach(ViewButton* b, l_buttons)
// delete b;
}
~ViewButtonArea();
void addButton(ViewButton* button);
void removeButton(ViewButton* button);
......@@ -77,6 +73,7 @@ protected:
View* m_view;
QRect m_form;
QList<ViewButton*> l_buttons;
Utils::ShaderWallPaper* m_shaderButton;
};
} // namespace SCHNApps
......
......@@ -174,37 +174,39 @@ void Camera::drawBBCam()
if (!m_drawBB)
return;
float shift = 0.01f*(m_bbMax - m_bbMin).norm();
glDisable(GL_LIGHTING);
glColor3f(0.5f,1.0f,0.0f);
glLineWidth(1.0f);
glBegin(GL_LINE_LOOP);
glVertex3f(m_bbMin[0]-shift, m_bbMin[1]-shift, m_bbMin[2]-shift);
glVertex3f(m_bbMin[0]-shift, m_bbMax[1]+shift, m_bbMin[2]-shift);
glVertex3f(m_bbMax[0]+shift, m_bbMax[1]+shift, m_bbMin[2]-shift);
glVertex3f(m_bbMax[0]+shift, m_bbMin[1]-shift, m_bbMin[2]-shift);
glVertex3f(m_bbMin[0]-shift, m_bbMin[1]-shift, m_bbMin[2]-shift);
glEnd();
glBegin(GL_LINE_LOOP);
glVertex3f(m_bbMax[0]+shift, m_bbMax[1]+shift, m_bbMax[2]+shift);
glVertex3f(m_bbMax[0]+shift, m_bbMin[1]-shift, m_bbMax[2]+shift);
glVertex3f(m_bbMin[0]-shift, m_bbMin[1]-shift, m_bbMax[2]+shift);
glVertex3f(m_bbMin[0]-shift, m_bbMax[1]+shift, m_bbMax[2]+shift);
glVertex3f(m_bbMax[0]+shift, m_bbMax[1]+shift, m_bbMax[2]+shift);
glEnd();
glBegin(GL_LINES);
glVertex3f(m_bbMin[0]-shift, m_bbMin[1]-shift, m_bbMin[2]-shift);
glVertex3f(m_bbMin[0]-shift, m_bbMin[1]-shift, m_bbMax[2]+shift);
glVertex3f(m_bbMin[0]-shift, m_bbMax[1]+shift, m_bbMin[2]-shift);
glVertex3f(m_bbMin[0]-shift, m_bbMax[1]+shift, m_bbMax[2]+shift);
glVertex3f(m_bbMax[0]+shift, m_bbMax[1]+shift, m_bbMin[2]-shift);
glVertex3f(m_bbMax[0]+shift, m_bbMax[1]+shift, m_bbMax[2]+shift);
glVertex3f(m_bbMax[0]+shift, m_bbMin[1]-shift, m_bbMin[2]-shift);
glVertex3f(m_bbMax[0]+shift, m_bbMin[1]-shift, m_bbMax[2]+shift);
glEnd();
glColor3f(1.0f,1.0f,1.0f);
glEnable(GL_LIGHTING);
//TODO with Drawer ?
// float shift = 0.01f*(m_bbMax - m_bbMin).norm();
// glDisable(GL_LIGHTING);
// glColor3f(0.5f,1.0f,0.0f);
// glLineWidth(1.0f);
// glBegin(GL_LINE_LOOP);
// glVertex3f(m_bbMin[0]-shift, m_bbMin[1]-shift, m_bbMin[2]-shift);
// glVertex3f(m_bbMin[0]-shift, m_bbMax[1]+shift, m_bbMin[2]-shift);
// glVertex3f(m_bbMax[0]+shift, m_bbMax[1]+shift, m_bbMin[2]-shift);
// glVertex3f(m_bbMax[0]+shift, m_bbMin[1]-shift, m_bbMin[2]-shift);
// glVertex3f(m_bbMin[0]-shift, m_bbMin[1]-shift, m_bbMin[2]-shift);
// glEnd();
// glBegin(GL_LINE_LOOP);
// glVertex3f(m_bbMax[0]+shift, m_bbMax[1]+shift, m_bbMax[2]+shift);
// glVertex3f(m_bbMax[0]+shift, m_bbMin[1]-shift, m_bbMax[2]+shift);
// glVertex3f(m_bbMin[0]-shift, m_bbMin[1]-shift, m_bbMax[2]+shift);
// glVertex3f(m_bbMin[0]-shift, m_bbMax[1]+shift, m_bbMax[2]+shift);
// glVertex3f(m_bbMax[0]+shift, m_bbMax[1]+shift, m_bbMax[2]+shift);
// glEnd();
// glBegin(GL_LINES);
// glVertex3f(m_bbMin[0]-shift, m_bbMin[1]-shift, m_bbMin[2]-shift);
// glVertex3f(m_bbMin[0]-shift, m_bbMin[1]-shift, m_bbMax[2]+shift);
// glVertex3f(m_bbMin[0]-shift, m_bbMax[1]+shift, m_bbMin[2]-shift);
// glVertex3f(m_bbMin[0]-shift, m_bbMax[1]+shift, m_bbMax[2]+shift);
// glVertex3f(m_bbMax[0]+shift, m_bbMax[1]+shift, m_bbMin[2]-shift);
// glVertex3f(m_bbMax[0]+shift, m_bbMax[1]+shift, m_bbMax[2]+shift);
// glVertex3f(m_bbMax[0]+shift, m_bbMin[1]-shift, m_bbMin[2]-shift);
// glVertex3f(m_bbMax[0]+shift, m_bbMin[1]-shift, m_bbMax[2]+shift);
// glEnd();
// glColor3f(1.0f,1.0f,1.0f);
// glEnable(GL_LIGHTING);
}
} // namespace SCHNApps
......
......@@ -10,6 +10,7 @@ namespace SCHNApps
Plugin::Plugin() : m_schnapps(NULL)
{
glewExperimental = GL_TRUE; // needed for GL Core Profile 3.3
glewInit();
}
......
......@@ -44,6 +44,12 @@ SCHNApps::SCHNApps(const QString& appPath, PythonQtObjectPtr& pythonContext, Pyt
{
GenericMap::initAllStatics(&m_sp);
#ifdef USE_OGL_CORE_PROFILE
CGoGN::Utils::GLSLShader::setCurrentOGLVersion(3);
#else
CGoGN::Utils::GLSLShader::setCurrentOGLVersion(3);
#endif
this->setupUi(this);
// create & setup control dock
......@@ -104,9 +110,8 @@ SCHNApps::SCHNApps(const QString& appPath, PythonQtObjectPtr& pythonContext, Pyt
connect(action_ShowHidePythonDock, SIGNAL(triggered()), this, SLOT(showHidePythonDock()));
connect(action_LoadPythonScript, SIGNAL(triggered()), this, SLOT(loadPythonScriptFromFileDialog()));
// create & setup central widget (views)
// glewInit();
// create & setup central widget (views)
m_centralLayout = new QVBoxLayout(centralwidget);
m_rootSplitter = new QSplitter(centralwidget);
......@@ -194,11 +199,28 @@ View* SCHNApps::addView(const QString& name)
if (m_views.contains(name))
return NULL;
QGLFormat format;
if (Utils::GLSLShader::CURRENT_OGL_VERSION >= 3)
{
format.setProfile(QGLFormat::CoreProfile);
format.setVersion(Utils::GLSLShader::MAJOR_OGL_CORE, Utils::GLSLShader::MINOR_OGL_CORE);
format.setDepth(true);
format.setDoubleBuffer(true);
format.setBlueBufferSize(8);
std::cout << "CORE_PROFILE GL"<< std::endl;
}
else
{
format = QGLFormat::defaultFormat();
std::cout << "DEFAULT GL"<< std::endl;
}