Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

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

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);
......
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