mirror of https://github.com/CGAL/cgal
Rename isRecent into isOpenGL_4_3
This commit is contained in:
parent
71a8c1c178
commit
bca74e4a8e
|
|
@ -214,7 +214,7 @@ add_to_normal(unsigned char v,
|
|||
class Vertex_buffer_helper
|
||||
{
|
||||
public:
|
||||
Vertex_buffer_helper(const Image_accessor& data, bool is_recent);
|
||||
Vertex_buffer_helper(const Image_accessor& data, bool is_ogl_4_3);
|
||||
|
||||
void fill_buffer_data();
|
||||
|
||||
|
|
@ -252,14 +252,14 @@ private:
|
|||
Indices indices_;
|
||||
std::vector<GLfloat> colors_, normals_, vertices_;
|
||||
std::vector<GLuint> quads_;
|
||||
bool is_recent;
|
||||
bool is_ogl_4_3;
|
||||
};
|
||||
|
||||
int Vertex_buffer_helper::vertex_not_found_ = -1;
|
||||
|
||||
Vertex_buffer_helper::
|
||||
Vertex_buffer_helper(const Image_accessor& data, bool b)
|
||||
: data_(data), is_recent(b)
|
||||
: data_(data), is_ogl_4_3(b)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -374,7 +374,7 @@ Vertex_buffer_helper::push_quad(int pos1, int pos2, int pos3, int pos4)
|
|||
quads_.push_back(pos1);
|
||||
quads_.push_back(pos2);
|
||||
quads_.push_back(pos3);
|
||||
if(!is_recent)
|
||||
if(!is_ogl_4_3)
|
||||
{
|
||||
quads_.push_back(pos1);
|
||||
quads_.push_back(pos3);
|
||||
|
|
@ -424,7 +424,7 @@ struct Scene_image_item_priv
|
|||
{
|
||||
item = parent;
|
||||
v_box = new std::vector<float>();
|
||||
is_recent = static_cast<CGAL::Three::Viewer_interface*>(QGLViewer::QGLViewerPool().first())->isRecent();
|
||||
is_ogl_4_3 = static_cast<CGAL::Three::Viewer_interface*>(QGLViewer::QGLViewerPool().first())->isOpenGL_4_3();
|
||||
is_hidden = hidden;
|
||||
compile_shaders();
|
||||
initializeBuffers();
|
||||
|
|
@ -465,7 +465,7 @@ struct Scene_image_item_priv
|
|||
mutable QOpenGLVertexArrayObject vao[vaoSize];
|
||||
mutable QOpenGLShaderProgram rendering_program;
|
||||
bool is_hidden;
|
||||
bool is_recent;
|
||||
bool is_ogl_4_3;
|
||||
Scene_image_item* item;
|
||||
|
||||
//#endif // SCENE_SEGMENTED_IMAGE_GL_BUFFERS_AVAILABLE
|
||||
|
|
@ -498,7 +498,7 @@ void Scene_image_item_priv::compile_shaders()
|
|||
vao[i].create();
|
||||
m_ibo = new QOpenGLBuffer(QOpenGLBuffer::IndexBuffer);
|
||||
m_ibo->create();
|
||||
if(!is_recent)
|
||||
if(!is_ogl_4_3)
|
||||
{
|
||||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
|
|
@ -755,7 +755,7 @@ Scene_image_item_priv::initializeBuffers()
|
|||
m_voxel_scale,
|
||||
m_voxel_scale,
|
||||
m_voxel_scale);
|
||||
internal::Vertex_buffer_helper helper (image_data_accessor, is_recent);
|
||||
internal::Vertex_buffer_helper helper (image_data_accessor, is_ogl_4_3);
|
||||
helper.fill_buffer_data();
|
||||
rendering_program.bind();
|
||||
vao[0].bind();
|
||||
|
|
@ -809,7 +809,7 @@ Scene_image_item_priv::draw_gl(Viewer_interface* viewer) const
|
|||
if(!is_hidden)
|
||||
{
|
||||
vao[0].bind();
|
||||
if(!is_recent)
|
||||
if(!is_ogl_4_3)
|
||||
viewer->glDrawElements(GL_TRIANGLES, m_ibo->size()/sizeof(GLuint), GL_UNSIGNED_INT, 0);
|
||||
else
|
||||
viewer->glDrawElements(GL_LINES_ADJACENCY, m_ibo->size()/sizeof(GLuint), GL_UNSIGNED_INT, 0);
|
||||
|
|
|
|||
|
|
@ -535,7 +535,7 @@ void
|
|||
Scene_polyhedron_item_priv::initialize_buffers(CGAL::Three::Viewer_interface* viewer) const
|
||||
{
|
||||
//vao containing the data for the facets
|
||||
if(!viewer->isRecent() && !no_flat)
|
||||
if(!viewer->isOpenGL_4_3() && !no_flat)
|
||||
{
|
||||
//flat
|
||||
if(viewer->property("draw_two_sides").toBool())
|
||||
|
|
@ -611,7 +611,7 @@ Scene_polyhedron_item_priv::initialize_buffers(CGAL::Three::Viewer_interface* vi
|
|||
}
|
||||
item->vaos[Gouraud_Facets]->release();
|
||||
program->release();
|
||||
if(viewer->isRecent())
|
||||
if(viewer->isOpenGL_4_3())
|
||||
{
|
||||
//modern flat
|
||||
program = item->getShaderProgram(Scene_polyhedron_item::PROGRAM_FLAT, viewer);
|
||||
|
|
@ -1188,13 +1188,15 @@ QMenu* Scene_polyhedron_item::contextMenu()
|
|||
actionEraseNextFacet->setObjectName("actionEraseNextFacet");
|
||||
connect(actionEraseNextFacet, SIGNAL(toggled(bool)),
|
||||
this, SLOT(set_erase_next_picked_facet(bool)));
|
||||
QAction* actionDisableFlatShading=
|
||||
menu->addAction(tr("Disable Flat Shading"));
|
||||
actionDisableFlatShading->setCheckable(true);
|
||||
actionDisableFlatShading->setObjectName("actionDisableFlatShading");
|
||||
connect(actionDisableFlatShading, SIGNAL(toggled(bool)),
|
||||
this, SLOT(set_flat_disabled(bool)));
|
||||
|
||||
if(! static_cast<CGAL::Three::Viewer_interface*>(QGLViewer::QGLViewerPool().first())->isOpenGL_4_3())
|
||||
{
|
||||
QAction* actionDisableFlatShading=
|
||||
menu->addAction(tr("Disable Flat Shading"));
|
||||
actionDisableFlatShading->setCheckable(true);
|
||||
actionDisableFlatShading->setObjectName("actionDisableFlatShading");
|
||||
connect(actionDisableFlatShading, SIGNAL(toggled(bool)),
|
||||
this, SLOT(set_flat_disabled(bool)));
|
||||
}
|
||||
menu->setProperty(prop_name, true);
|
||||
}
|
||||
|
||||
|
|
@ -1245,14 +1247,14 @@ void Scene_polyhedron_item::set_erase_next_picked_facet(bool b)
|
|||
void Scene_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||
if(!are_buffers_filled)
|
||||
{
|
||||
d->compute_normals_and_vertices(viewer->isRecent(),
|
||||
d->compute_normals_and_vertices(viewer->isOpenGL_4_3(),
|
||||
false,
|
||||
viewer->property("draw_two_sides").toBool());
|
||||
d->initialize_buffers(viewer);
|
||||
compute_bbox();
|
||||
}
|
||||
|
||||
if(viewer->isRecent() &&
|
||||
if(viewer->isOpenGL_4_3() &&
|
||||
(renderingMode() == Flat || renderingMode() == FlatPlusEdges))
|
||||
{
|
||||
vaos[Scene_polyhedron_item_priv::Gouraud_Facets]->bind();
|
||||
|
|
@ -1272,7 +1274,7 @@ void Scene_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
|||
d->program->release();
|
||||
vaos[Scene_polyhedron_item_priv::Gouraud_Facets]->release();
|
||||
}
|
||||
else if(!viewer->isRecent()&&
|
||||
else if(!viewer->isOpenGL_4_3()&&
|
||||
(renderingMode() == Flat || renderingMode() == FlatPlusEdges))
|
||||
{
|
||||
vaos[Scene_polyhedron_item_priv::Facets]->bind();
|
||||
|
|
@ -1326,7 +1328,7 @@ void Scene_polyhedron_item::drawEdges(CGAL::Three::Viewer_interface* viewer) con
|
|||
{
|
||||
if (!are_buffers_filled)
|
||||
{
|
||||
d->compute_normals_and_vertices(viewer->isRecent(), false,
|
||||
d->compute_normals_and_vertices(viewer->isOpenGL_4_3(), false,
|
||||
viewer->property("draw_two_sides").toBool());
|
||||
d->initialize_buffers(viewer);
|
||||
compute_bbox();
|
||||
|
|
@ -1375,7 +1377,7 @@ void
|
|||
Scene_polyhedron_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const {
|
||||
if(!are_buffers_filled)
|
||||
{
|
||||
d->compute_normals_and_vertices(viewer->isRecent(), false, viewer->property("draw_two_sides").toBool());
|
||||
d->compute_normals_and_vertices(viewer->isOpenGL_4_3(), false, viewer->property("draw_two_sides").toBool());
|
||||
d->initialize_buffers(viewer);
|
||||
compute_bbox();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public:
|
|||
bool _displayMessage;
|
||||
QTimer messageTimer;
|
||||
QOpenGLFunctions_4_3_Compatibility* _recentFunctions;
|
||||
bool is_recent;
|
||||
bool is_ogl_4_3;
|
||||
|
||||
//! Holds useful data to draw the axis system
|
||||
struct AxisData
|
||||
|
|
@ -246,11 +246,11 @@ void Viewer::initializeGL()
|
|||
format.setVersion(2,1);
|
||||
new_context->setFormat(format);
|
||||
created = new_context->create();
|
||||
d->is_recent = false;
|
||||
d->is_ogl_4_3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
d->is_recent = true;
|
||||
d->is_ogl_4_3 = true;
|
||||
d->_recentFunctions = new QOpenGLFunctions_4_3_Compatibility();
|
||||
}
|
||||
CGAL_warning_msg(created && new_context->isValid(), "The openGL context initialization failed "
|
||||
|
|
@ -259,7 +259,7 @@ void Viewer::initializeGL()
|
|||
context()->makeCurrent();
|
||||
QGLViewer::initializeGL();
|
||||
initializeOpenGLFunctions();
|
||||
if(isRecent())
|
||||
if(isOpenGL_4_3())
|
||||
{
|
||||
d->_recentFunctions->initializeOpenGLFunctions();
|
||||
}
|
||||
|
|
@ -1675,6 +1675,9 @@ void Viewer::enableClippingBox(QVector4D box[6])
|
|||
|
||||
bool Viewer::isRecent() const { return d->is_recent; }
|
||||
|
||||
|
||||
bool Viewer::isOpenGL_4_3() const { return d->is_ogl_4_3; }
|
||||
|
||||
QOpenGLFunctions_4_3_Compatibility* Viewer::recentFunctions() { return d->_recentFunctions; }
|
||||
|
||||
#include "Viewer.moc"
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ protected:
|
|||
double prev_radius;
|
||||
|
||||
public:
|
||||
bool isRecent() const;
|
||||
bool isOpenGL_4_3() const;
|
||||
QOpenGLFunctions_4_3_Compatibility* recentFunctions();
|
||||
|
||||
}; // end class Viewer
|
||||
|
|
|
|||
|
|
@ -238,11 +238,11 @@ public:
|
|||
//! Is used to know if the openGL context is 4.3 or 2.1.
|
||||
//! @returns `true` if the context is 4.3.
|
||||
//! @returns `false` if the context is 2.1.
|
||||
virtual bool isRecent() const = 0;
|
||||
virtual bool isOpenGL_4_3() const = 0;
|
||||
//! Gives acces to recent openGL(4.3) features, allowing use of things like
|
||||
//! Geometry Shaders or Depth Textures.
|
||||
//! @returns a pointer to an initialized QOpenGLFunctions_4_3_Compatibility if `isRecent()` is `true`
|
||||
//! @returns NULL if `isRecent()` is `false`
|
||||
//! @returns a pointer to an initialized QOpenGLFunctions_4_3_Compatibility if `isOpenGL_4_3()` is `true`
|
||||
//! @returns NULL if `isOpenGL_4_3()` is `false`
|
||||
virtual QOpenGLFunctions_4_3_Compatibility* recentFunctions() = 0;
|
||||
}; // end class Viewer_interface
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue