mirror of https://github.com/CGAL/cgal
Changed() fix and texture ID generation.
This commit is contained in:
parent
2bf6e15e96
commit
12501598bb
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include <QOpenGLFunctions_3_3_Core>
|
#include <QOpenGLFunctions_3_3_Core>
|
||||||
#include <QOpenGLShader>
|
#include <QOpenGLShader>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
// constants
|
// constants
|
||||||
const int slow_distance_grid_size = 100;
|
const int slow_distance_grid_size = 100;
|
||||||
|
|
@ -44,6 +44,7 @@ Scene::Scene()
|
||||||
m_blue_ramp.build_blue();
|
m_blue_ramp.build_blue();
|
||||||
m_max_distance_function = (FT)0.0;
|
m_max_distance_function = (FT)0.0;
|
||||||
texture = new Texture(m_grid_size,m_grid_size);
|
texture = new Texture(m_grid_size,m_grid_size);
|
||||||
|
are_buffers_initialized = false;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -75,6 +76,8 @@ Scene::~Scene()
|
||||||
void Scene::compile_shaders()
|
void Scene::compile_shaders()
|
||||||
{
|
{
|
||||||
initializeOpenGLFunctions();
|
initializeOpenGLFunctions();
|
||||||
|
glGenTextures(1, &textureId);
|
||||||
|
qDebug()<<"textureId = "<<textureId;
|
||||||
if(! buffers[0].create() || !buffers[1].create() || !buffers[2].create() || !buffers[3].create() || !buffers[4].create() || !buffers[5].create() || !buffers[6].create() || !buffers[7].create())
|
if(! buffers[0].create() || !buffers[1].create() || !buffers[2].create() || !buffers[3].create() || !buffers[4].create() || !buffers[5].create() || !buffers[6].create() || !buffers[7].create())
|
||||||
{
|
{
|
||||||
std::cerr<<"VBO Creation FAILED"<<std::endl;
|
std::cerr<<"VBO Creation FAILED"<<std::endl;
|
||||||
|
|
@ -300,6 +303,8 @@ void Scene::initialize_buffers()
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE );
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE );
|
||||||
vao[6].release();
|
vao[6].release();
|
||||||
|
|
||||||
|
are_buffers_initialized == true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -511,7 +516,8 @@ void Scene::changed()
|
||||||
compute_elements(_UNSIGNED);
|
compute_elements(_UNSIGNED);
|
||||||
else
|
else
|
||||||
compute_elements(_SIGNED);
|
compute_elements(_SIGNED);
|
||||||
initialize_buffers();
|
are_buffers_initialized = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Scene::open(QString filename)
|
int Scene::open(QString filename)
|
||||||
|
|
@ -582,6 +588,8 @@ void Scene::update_bbox()
|
||||||
|
|
||||||
void Scene::draw(QGLViewer* viewer)
|
void Scene::draw(QGLViewer* viewer)
|
||||||
{
|
{
|
||||||
|
if(!are_buffers_initialized)
|
||||||
|
initialize_buffers();
|
||||||
QColor color;
|
QColor color;
|
||||||
QMatrix4x4 fMatrix;
|
QMatrix4x4 fMatrix;
|
||||||
fMatrix.setToIdentity();
|
fMatrix.setToIdentity();
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ private:
|
||||||
Edge_tree m_edge_tree;
|
Edge_tree m_edge_tree;
|
||||||
|
|
||||||
Cut_planes_types m_cut_plane;
|
Cut_planes_types m_cut_plane;
|
||||||
|
bool are_buffers_initialized;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// utility functions
|
// utility functions
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue