mirror of https://github.com/CGAL/cgal
Still on that SIGSEGV
This commit is contained in:
parent
3785112993
commit
22dbcfaa2c
|
|
@ -288,8 +288,8 @@ void Scene::initialize_buffers()
|
||||||
buffers[7].release();
|
buffers[7].release();
|
||||||
tex_rendering_program.release();
|
tex_rendering_program.release();
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, textureId);
|
gl.glBindTexture(GL_TEXTURE_2D, textureId);
|
||||||
glTexImage2D(GL_TEXTURE_2D,
|
gl.glTexImage2D(GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
GL_RGB,
|
GL_RGB,
|
||||||
texture->getWidth(),
|
texture->getWidth(),
|
||||||
|
|
@ -298,10 +298,10 @@ void Scene::initialize_buffers()
|
||||||
GL_RGB,
|
GL_RGB,
|
||||||
GL_UNSIGNED_BYTE,
|
GL_UNSIGNED_BYTE,
|
||||||
texture->getData());
|
texture->getData());
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE );
|
gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE );
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE );
|
gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE );
|
||||||
vao[6].release();
|
vao[6].release();
|
||||||
|
|
||||||
are_buffers_initialized = true;
|
are_buffers_initialized = true;
|
||||||
|
|
@ -602,20 +602,20 @@ void Scene::draw(QGLViewer* viewer)
|
||||||
color.setRgbF(0.0,0.0,0.0);
|
color.setRgbF(0.0,0.0,0.0);
|
||||||
rendering_program.setUniformValue(colorLocation, color);
|
rendering_program.setUniformValue(colorLocation, color);
|
||||||
rendering_program.setUniformValue(fLocation, fMatrix);
|
rendering_program.setUniformValue(fLocation, fMatrix);
|
||||||
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_poly.size()/3));
|
gl.glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_poly.size()/3));
|
||||||
rendering_program.release();
|
rendering_program.release();
|
||||||
vao[2].release();
|
vao[2].release();
|
||||||
}
|
}
|
||||||
if(m_view_points && pos_points.size()>0)
|
if(m_view_points && pos_points.size()>0)
|
||||||
{
|
{
|
||||||
::glPointSize(2.0f);
|
gl.glPointSize(2.0f);
|
||||||
vao[0].bind();
|
vao[0].bind();
|
||||||
attrib_buffers(viewer);
|
attrib_buffers(viewer);
|
||||||
rendering_program.bind();
|
rendering_program.bind();
|
||||||
color.setRgbF(0.7,0.0,0.0);
|
color.setRgbF(0.7,0.0,0.0);
|
||||||
rendering_program.setUniformValue(colorLocation, color);
|
rendering_program.setUniformValue(colorLocation, color);
|
||||||
rendering_program.setUniformValue(fLocation, fMatrix);
|
rendering_program.setUniformValue(fLocation, fMatrix);
|
||||||
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
|
gl.glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
|
||||||
rendering_program.release();
|
rendering_program.release();
|
||||||
vao[0].release();
|
vao[0].release();
|
||||||
}
|
}
|
||||||
|
|
@ -628,7 +628,7 @@ void Scene::draw(QGLViewer* viewer)
|
||||||
color.setRgbF(0.0,0.7,0.0);
|
color.setRgbF(0.0,0.7,0.0);
|
||||||
rendering_program.setUniformValue(colorLocation, color);
|
rendering_program.setUniformValue(colorLocation, color);
|
||||||
rendering_program.setUniformValue(fLocation, fMatrix);
|
rendering_program.setUniformValue(fLocation, fMatrix);
|
||||||
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_lines.size()/3));
|
gl.glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_lines.size()/3));
|
||||||
rendering_program.release();
|
rendering_program.release();
|
||||||
vao[1].release();
|
vao[1].release();
|
||||||
}
|
}
|
||||||
|
|
@ -650,7 +650,7 @@ void Scene::draw(QGLViewer* viewer)
|
||||||
tex_rendering_program.bind();
|
tex_rendering_program.bind();
|
||||||
tex_rendering_program.setUniformValue(tex_fLocation, fMatrix);
|
tex_rendering_program.setUniformValue(tex_fLocation, fMatrix);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0,static_cast<GLsizei>(pos_plane.size()/3));
|
gl.glDrawArrays(GL_TRIANGLES, 0,static_cast<GLsizei>(pos_plane.size()/3));
|
||||||
tex_rendering_program.release();
|
tex_rendering_program.release();
|
||||||
vao[6].release();
|
vao[6].release();
|
||||||
break;
|
break;
|
||||||
|
|
@ -666,7 +666,7 @@ void Scene::draw(QGLViewer* viewer)
|
||||||
color.setRgbF(1.0,0.0,0.0);
|
color.setRgbF(1.0,0.0,0.0);
|
||||||
rendering_program.setUniformValue(colorLocation, color);
|
rendering_program.setUniformValue(colorLocation, color);
|
||||||
rendering_program.setUniformValue(fLocation, fMatrix);
|
rendering_program.setUniformValue(fLocation, fMatrix);
|
||||||
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_cut_segments.size()/3));
|
gl.glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_cut_segments.size()/3));
|
||||||
::glLineWidth(1.0f);
|
::glLineWidth(1.0f);
|
||||||
rendering_program.release();
|
rendering_program.release();
|
||||||
vao[3].release();
|
vao[3].release();
|
||||||
|
|
@ -679,7 +679,7 @@ void Scene::draw(QGLViewer* viewer)
|
||||||
color.setRgbF(.6f, .6f, .6f);
|
color.setRgbF(.6f, .6f, .6f);
|
||||||
rendering_program.setUniformValue(colorLocation, color);
|
rendering_program.setUniformValue(colorLocation, color);
|
||||||
rendering_program.setUniformValue(fLocation, fMatrix);
|
rendering_program.setUniformValue(fLocation, fMatrix);
|
||||||
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_grid.size()/3));
|
gl.glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_grid.size()/3));
|
||||||
rendering_program.release();
|
rendering_program.release();
|
||||||
vao[5].release();
|
vao[5].release();
|
||||||
|
|
||||||
|
|
@ -694,7 +694,7 @@ void Scene::draw(QGLViewer* viewer)
|
||||||
color.setRgbF(.6f, .85f, 1.f, .65f);
|
color.setRgbF(.6f, .85f, 1.f, .65f);
|
||||||
rendering_program.setUniformValue(colorLocation, color);
|
rendering_program.setUniformValue(colorLocation, color);
|
||||||
rendering_program.setUniformValue(fLocation, fMatrix);
|
rendering_program.setUniformValue(fLocation, fMatrix);
|
||||||
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_plane.size()/3));
|
gl.glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_plane.size()/3));
|
||||||
::glDisable(GL_BLEND);
|
::glDisable(GL_BLEND);
|
||||||
rendering_program.release();
|
rendering_program.release();
|
||||||
vao[4].release();
|
vao[4].release();
|
||||||
|
|
@ -1311,8 +1311,8 @@ void Scene::deactivate_cutting_plane()
|
||||||
}
|
}
|
||||||
void Scene::initGL()
|
void Scene::initGL()
|
||||||
{
|
{
|
||||||
qDebug()<<"context from scene is valid :"<<context->isValid();
|
//qDebug()<<"context from scene is valid :"<<context->isValid();
|
||||||
initializeOpenGLFunctions();
|
gl.initializeOpenGLFunctions();
|
||||||
glGenTextures(1, &textureId);
|
gl.glGenTextures(1, &textureId);
|
||||||
compile_shaders();
|
compile_shaders();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ public:
|
||||||
GLubyte* getData(){return data; }
|
GLubyte* getData(){return data; }
|
||||||
|
|
||||||
};
|
};
|
||||||
class Scene : public QObject, protected QOpenGLFunctions_3_3_Core
|
class Scene : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
@ -85,6 +85,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// member data
|
// member data
|
||||||
|
QOpenGLFunctions_3_3_Core gl;
|
||||||
Bbox m_bbox;
|
Bbox m_bbox;
|
||||||
Polyhedron *m_pPolyhedron;
|
Polyhedron *m_pPolyhedron;
|
||||||
std::list<Point> m_points;
|
std::list<Point> m_points;
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,6 @@ void Viewer::initializeGL()
|
||||||
{
|
{
|
||||||
QGLViewer::initializeGL();
|
QGLViewer::initializeGL();
|
||||||
setBackgroundColor(::Qt::white);
|
setBackgroundColor(::Qt::white);
|
||||||
m_pScene->context = this->context();
|
|
||||||
qDebug()<<"context from viewer is valid :"<<this->context()->isValid();
|
|
||||||
m_pScene->initGL();
|
m_pScene->initGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue