Commit 495d160a authored by Sylvain Thery's avatar Sylvain Thery

wrong manip ??

parent 6e1f65e5
......@@ -29,7 +29,8 @@ MCMesh::MCMesh() :
m_drawFaces(true),
m_render(NULL),
m_flatShader(NULL),
m_simpleColorShader(NULL)
m_simpleColorShader(NULL),
m_linesShader(NULL)
{}
void MCMesh::initGUI()
......@@ -61,28 +62,69 @@ void MCMesh::cb_initGL()
m_simpleColorShader = new Utils::ShaderSimpleColor();
m_simpleColorShader->setAttributePosition(m_positionVBO);
m_colorVBO = new Utils::VBO();
m_linesShader = new Utils::ShaderBoldLines();
m_linesShader->setAttributePosition(m_positionVBO);
// m_linesShader->setAttributeColor(m_colorVBO);
registerShader(m_flatShader);
registerShader(m_simpleColorShader);
registerShader(m_linesShader);
m_dr = new Utils::Drawer();
m_dr->newList();
m_dr->pointSize(4.0f);
m_dr->lineWidth(25.0f);
m_dr->begin(GL_LINES);
m_dr->color3f(1.0,0.0,0.0);
m_dr->vertex3f(15.0,15.0,65.0);
m_dr->vertex3f(110.0,110.0,65.0);
m_dr->color3f(0.0,1.0,0.0);
m_dr->vertex3f(110.0,15.0,75.0);
m_dr->vertex3f(15.0,110.0,75.0);
m_dr->end();
m_dr->endList();
}
void MCMesh::cb_redraw()
{
glEnable(GL_BLEND);
m_dr->callList(0.5f);
if (m_drawEdges)
// {
// glLineWidth(1.0f);
// if (m_drawFaces)
// {
// Geom::Vec4f c(0.0f, 0.0f, 0.0f, 0.0f);
// m_simpleColorShader->setColor(c);
// }
// else
// {
// Geom::Vec4f c(1.0f, 1.0f, 0.0f, 0.0f);
// m_simpleColorShader->setColor(c);
// }
// m_render->draw(m_simpleColorShader, Algo::Render::GL2::LINES);
// }
{
glLineWidth(1.0f);
// glLineWidth(1.0f);
// m_linesShader->setClippingPlane(Geom::Vec4f(0.03,0.03,-1.1,64));
m_linesShader->setLineWidth(12.0f);
if (m_drawFaces)
{
Geom::Vec4f c(0.0f, 0.0f, 0.0f, 0.0f);
m_simpleColorShader->setColor(c);
m_linesShader->setColor(c);
}
else
{
Geom::Vec4f c(1.0f, 1.0f, 0.0f, 0.0f);
m_simpleColorShader->setColor(c);
m_linesShader->setColor(c);
}
m_render->draw(m_simpleColorShader, Algo::Render::GL2::LINES);
m_render->draw(m_linesShader, Algo::Render::GL2::LINES);
}
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_LIGHTING);
glEnable(GL_POLYGON_OFFSET_FILL);
......@@ -158,6 +200,11 @@ void MCMesh::updateRender()
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::TRIANGLES);
m_positionVBO->updateData(position);
m_colorVBO->updateData(position);
Geom::Vec3f *ptr = reinterpret_cast<Geom::Vec3f*>(m_colorVBO->lockPtr());
for (unsigned int i=0; i<m_colorVBO->nbElts();++i)
*ptr++ /= 130.0f;
m_colorVBO->releasePtr();
bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position);
......
......@@ -39,9 +39,11 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderFlat.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderBoldLines.h"
#include "Utils/vbo.h"
#include "Algo/Geometry/boundingbox.h"
#include "Utils/drawer.h"
using namespace CGoGN ;
......@@ -79,9 +81,14 @@ public:
Algo::Render::GL2::MapRender* m_render ;
Utils::VBO* m_positionVBO ;
Utils::VBO* m_colorVBO ;
Utils::ShaderFlat* m_flatShader ;
Utils::ShaderSimpleColor* m_simpleColorShader ;
Utils::ShaderBoldLines* m_linesShader ;
Utils::Drawer* m_dr;
DATATYPE valLabel;
SAlgo::MC::Image<DATATYPE>* myImg;
......
This diff is collapsed.
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