diff --git a/GraphicsView/include/CGAL/Qt/qglviewer.h b/GraphicsView/include/CGAL/Qt/qglviewer.h index 30f87921616..546fc1d9e0c 100644 --- a/GraphicsView/include/CGAL/Qt/qglviewer.h +++ b/GraphicsView/include/CGAL/Qt/qglviewer.h @@ -1204,9 +1204,9 @@ protected: //C o n t e x t bool is_ogl_4_3; public: - //! Is used to know if the openGL context is 4.3 or 2.1. + //! Is used to know if the openGL context is 4.3 or ES 2.0. //! @returns `true` if the context is 4.3. - //! @returns `false` if the context is 2.1. + //! @returns `false` if the context is ES 2.0. bool isOpenGL_4_3()const {return is_ogl_4_3; } }; diff --git a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h index cb12cf5d9f3..d7c9a68e1ca 100644 --- a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h +++ b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h @@ -204,7 +204,7 @@ This method is automatically called once, before the first call to paintGL(). Overload init() instead of this method to modify viewer specific OpenGL state. -If a 4.3 context could not be set, a 2.1 context will be used instead. +If a 4.3 context could not be set, a ES 2.0 context will be used instead. \see `isOpenGL_4_3()` */ CGAL_INLINE_FUNCTION @@ -213,13 +213,13 @@ void CGAL::QGLViewer::initializeGL() { format.setDepthBufferSize(24); format.setStencilBufferSize(8); format.setVersion(4,3); - format.setProfile(QSurfaceFormat::CompatibilityProfile); + format.setProfile(QSurfaceFormat::CoreProfile); format.setSamples(0); format.setOption(QSurfaceFormat::DebugContext); context()->setFormat(format); bool created = context()->create(); - if(!created || context()->format().profile() != QSurfaceFormat::CompatibilityProfile) { - // impossible to get a 4.3 compatibility profile, retry with 2.0 + if(!created || context()->format().profile() != QSurfaceFormat::CoreProfile) { + // impossible to get a 4.3 core profile, retry with ES 2.0 format = QSurfaceFormat::defaultFormat(); context()->setFormat(format); created = context()->create(); @@ -456,11 +456,11 @@ CGAL_INLINE_FUNCTION void CGAL::QGLViewer::postDraw() { // Pivot point, line when camera rolls, zoom region if (gridIsDrawn()) { - glLineWidth(1.0); + if(!is_ogl_4_3) + glLineWidth(1.0); drawGrid(camera()->sceneRadius()); } if (axisIsDrawn()) { - glLineWidth(2.0); drawAxis(1.0); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp index f3fa1f76c55..9db056c2d7e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp @@ -562,7 +562,7 @@ public: //Vertex source code const char tex_vertex_source[] = { - "#version 120 \n" + "//#version 100 \n" "attribute highp vec4 vertex;\n" "attribute highp vec2 tex_coord; \n" "uniform highp mat4 mvp_matrix;\n" @@ -577,7 +577,7 @@ public: //Vertex source code const char tex_fragment_source[] = { - "#version 120 \n" + "//#version 100 \n" "uniform sampler2D texture;\n" "varying highp vec2 texc;\n" "void main(void) { \n" diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h index 302f0f7e4cd..3862fdfd87d 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h @@ -376,7 +376,7 @@ private: template const char* Volume_plane::vertexShader_source = - "#version 120 \n" + "//#version 100 \n" "attribute highp vec4 vertex; \n" "attribute highp float color; \n" "uniform highp mat4 mvp_matrix; \n" @@ -388,13 +388,13 @@ const char* Volume_plane::vertexShader_source = template const char* Volume_plane::fragmentShader_source = - "#version 120\n" + "//#version 100 \n" "varying highp vec4 fullColor; \n" "void main() { gl_FragColor = fullColor; } \n"; template const char* Volume_plane::vertexShader_bordures_source = - "#version 120 \n" + "//#version 100 \n" "attribute highp vec4 vertex; \n" "attribute highp vec4 colors; \n" "uniform highp mat4 mvp_matrix; \n" @@ -406,7 +406,7 @@ const char* Volume_plane::vertexShader_bordures_source = template const char* Volume_plane::fragmentShader_bordures_source = - "#version 120\n" + "//#version 100 \n" "varying highp vec4 fullColor; \n" "void main() { gl_FragColor = fullColor; } \n"; @@ -469,7 +469,7 @@ void Volume_plane::draw(Viewer_interface *viewer) const { } mvp.translate(QVector3D(tx, ty, tz)); - if(!program_bordures) + if(!program_bordures) { if(viewer->isOpenGL_4_3()) program_bordures = viewer->getShaderProgram(PROGRAM_SOLID_WIREFRAME); @@ -498,6 +498,7 @@ void Volume_plane::draw(Viewer_interface *viewer) const { drawRectangle(*this, !viewer->isOpenGL_4_3()); program_bordures->bind(); + vaos[2]->bind(); rectBuffer.create(); rectBuffer.bind(); rectBuffer.allocate(v_rec.data(), static_cast(v_rec.size()*sizeof(float))); @@ -509,6 +510,7 @@ void Volume_plane::draw(Viewer_interface *viewer) const { { viewer->glLineWidth(4.0f); viewer->glDrawArrays(GL_LINE_LOOP, 0, static_cast(v_rec.size()/3)); + viewer->glLineWidth(1.0f); } else { @@ -522,10 +524,11 @@ void Volume_plane::draw(Viewer_interface *viewer) const { viewer->glDepthRangef(0.0,1.0); } rectBuffer.release(); + vaos[1]->release(); program_bordures->release(); - viewer->glLineWidth(1.0f); program.bind(); + vaos[1]->bind(); int mvpLoc = program.uniformLocation("mvp_matrix"); int fLoc = program.uniformLocation("f_matrix"); program.setUniformValue(mvpLoc, mvp); @@ -535,7 +538,6 @@ void Volume_plane::draw(Viewer_interface *viewer) const { program.enableAttributeArray(vloc); program.setAttributeBuffer(vloc, GL_FLOAT, 0, 3); vVBO.release(); - cbuffer.bind(); int colorLoc = program.attributeLocation("color"); program.enableAttributeArray(colorLoc); @@ -555,6 +557,7 @@ void Volume_plane::draw(Viewer_interface *viewer) const { cbuffer.release(); printGlError(viewer, __LINE__); + vaos[1]->release(); program.release(); printGlError(viewer, __LINE__); @@ -605,9 +608,11 @@ void Volume_plane::init(Viewer_interface* viewer) { assert(vertices.size() == (3 * adim_ * bdim_)); vVBO.create(); + vaos[1]->bind(); vVBO.bind(); vVBO.allocate(vertices.data(),static_cast(sizeof(float) * vertices.size())); vVBO.release(); + vaos[1]->release(); printGlError(viewer, __LINE__); // for each patch diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp index 08c0336d0bd..792847a3bb8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp @@ -222,7 +222,7 @@ void Volume_plane_intersection::draw(Viewer_interface* viewer) const { } if(!viewer->isOpenGL_4_3()) viewer->glLineWidth(1.0f); - viewer->glDepthRangef(0.0f,1.0f); + viewer->glDepthRangef(0.0f,1.0f); } Volume_plane_intersection::Volume_plane_intersection(float x, float y, float z, diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp index acf20c0ae37..702444d0381 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp @@ -210,7 +210,6 @@ struct Scene_edit_box_item_priv{ //Vertex source code const char vertex_source[] = { - "#version 120 \n " "attribute highp vec4 vertex; " "attribute highp vec3 normals; " "attribute highp vec4 colors; " @@ -221,9 +220,13 @@ struct Scene_edit_box_item_priv{ "varying highp vec4 color; " "void main(void) " "{ " - " color = colors; " + " color = colors; " " fP = mv_matrix * vertex; " - " fN = mat3(mv_matrix)* normals; " + " mat3 mv_matrix_3; " + " mv_matrix_3[0] = mv_matrix[0].xyz; " + " mv_matrix_3[1] = mv_matrix[1].xyz; " + " mv_matrix_3[2] = mv_matrix[2].xyz; " + " fN = mv_matrix_3* normals; " " gl_Position = mvp_matrix * vertex; " "}\n " "\n " @@ -232,7 +235,7 @@ struct Scene_edit_box_item_priv{ //Fragment source code const char fragment_source[] = { - "#version 120 \n" + "//#version 100 \n" "varying highp vec4 color;" "varying highp vec4 fP; " "varying highp vec3 fN; " @@ -407,7 +410,6 @@ void Scene_edit_box_item::draw(Viewer_interface *viewer) const drawSpheres(viewer, f_matrix); - drawTransparent(viewer); } void Scene_edit_box_item::drawEdges(Viewer_interface* viewer) const @@ -453,6 +455,7 @@ void Scene_edit_box_item::drawEdges(Viewer_interface* viewer) const drawSpheres(viewer, f_matrix); } drawHl(viewer); + drawTransparent(viewer); } void Scene_edit_box_item::compute_bbox() const diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp index e47c6afc99b..d808137b1d1 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp @@ -300,7 +300,7 @@ Scene_alpha_shape_item::Scene_alpha_shape_item(Scene_points_with_normal_item *po } const char vertex_source[] = { - "#version 120 \n" + "//#version 100 \n" "attribute highp vec4 vertex;\n" "attribute highp vec3 colors;\n" "uniform highp mat4 mvp_matrix;\n" diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp index 1f4af7a4d19..26b6a482d29 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp @@ -305,7 +305,7 @@ void Scene_edit_polyhedron_item_priv::init_values() const char vertex_shader_source_bbox[] = { - "#version 120 \n" + "//#version 100 \n" "attribute highp vec3 vertex; \n" "attribute highp vec3 colors; \n" @@ -324,7 +324,7 @@ void Scene_edit_polyhedron_item_priv::init_values() }; const char fragment_shader_source[]= { - "#version 120 \n" + "//#version 100 \n" "varying vec3 fColors; \n" " \n" "void main(void) \n" @@ -339,7 +339,7 @@ void Scene_edit_polyhedron_item_priv::init_values() //Vertex source code const char vertex_source[] = { - "#version 120 \n" + "//#version 100 \n" "attribute highp vec4 vertex; \n" "attribute highp vec4 colors; \n" "uniform highp mat4 mvp_matrix; \n" @@ -347,8 +347,8 @@ void Scene_edit_polyhedron_item_priv::init_values() "varying highp vec4 color; \n" "varying highp float dist[6]; \n" "uniform bool is_clipbox_on; \n" - "uniform highp mat4x4 clipbox1; \n" - "uniform highp mat4x4 clipbox2; \n" + "uniform highp mat4 clipbox1; \n" + "uniform highp mat4 clipbox2; \n" " \n" "void compute_distances(void) \n" "{ \n" @@ -379,7 +379,7 @@ void Scene_edit_polyhedron_item_priv::init_values() //Fragment source code const char fragment_source[] = { - "#version 120 \n" + "//#version 100 \n" "varying highp vec4 color; \n" "varying highp float dist[6]; \n" "uniform bool is_clipbox_on; \n" diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index 428f3c40baf..475b6c1bbbe 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -326,7 +326,7 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer) //Vertex source code const char vertex_source[] = { - "#version 120 \n" + "//#version 100 \n" "attribute highp vec4 vertex; \n" "attribute highp vec2 v_texCoord; \n" "uniform highp mat4 projection_matrix; \n" @@ -341,7 +341,7 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer) //Fragment source code const char fragment_source[] = { - "#version 120 \n" + "//#version 100 \n" "varying highp vec2 f_texCoord; \n" "uniform sampler2D texture; \n" "void main(void) \n" diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp index 80a04dd2c94..5cc6eef9783 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp @@ -519,13 +519,13 @@ struct Scene_c3t3_item_priv { std::set intersected_cells; QSlider* tet_Slider; - //!Allows OpenGL 2.1 context to get access to glDrawArraysInstanced. + //!Allows OpenGL 2.0 context to get access to glDrawArraysInstanced. typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); - //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor. + //!Allows OpenGL 2.0 context to get access to glVertexAttribDivisor. typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); - //!Allows OpenGL 2.1 context to get access to gkFrameBufferTexture2D. + //!Allows OpenGL 2.0 context to get access to gkFrameBufferTexture2D. PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced; - //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor. + //!Allows OpenGL 2.0 context to get access to glVertexAttribDivisor. PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor; mutable std::size_t positions_poly_size; diff --git a/Polyhedron/demo/Polyhedron/Scene_image_item.cpp b/Polyhedron/demo/Polyhedron/Scene_image_item.cpp index e3460819028..123da63585b 100644 --- a/Polyhedron/demo/Polyhedron/Scene_image_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_image_item.cpp @@ -505,7 +505,6 @@ void Scene_image_item_priv::compile_shaders() //Vertex source code const char vertex_source[] = { - "#version 120 \n" "attribute highp vec4 vertex;\n" "attribute highp vec3 normal;\n" "attribute highp vec4 inColor;\n" @@ -519,14 +518,18 @@ void Scene_image_item_priv::compile_shaders() "{\n" " color=inColor; \n" " fP = mv_matrix * vertex; \n" - " fN = mat3(mv_matrix)* normal; \n" + " mat3 mv_matrix_3; " + " mv_matrix_3[0] = mv_matrix[0].xyz; " + " mv_matrix_3[1] = mv_matrix[1].xyz; " + " mv_matrix_3[2] = mv_matrix[2].xyz; " + " fN = mv_matrix_3* normals; " " gl_Position = mvp_matrix * vertex; \n" "}" }; //Fragment source code const char fragment_source[] = { - "#version 120 \n" + "//#version 100 \n" "varying highp vec4 fP; \n" "varying highp vec3 fN; \n" "varying highp vec4 color; \n" diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp index d465dce105c..c813dc7fbd1 100644 --- a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp @@ -794,7 +794,7 @@ void Scene_points_with_normal_item::drawPoints(CGAL::Three::Viewer_interface* vi d->initializeBuffers(viewer); GLfloat point_size; viewer->glGetFloatv(GL_POINT_SIZE, &point_size); -// viewer->glPointSize(d->point_Slider->value()); + viewer->setGlPointSize(d->point_Slider->value()); double ratio_displayed = 1.0; if ((viewer->inFastDrawing () || d->isPointSliderMoving()) &&((d->nb_points )/3 > limit_fast_drawing)) // arbitrary large value @@ -848,7 +848,7 @@ void Scene_points_with_normal_item::drawPoints(CGAL::Three::Viewer_interface* vi else vaos[Scene_points_with_normal_item_priv::Selected_points]->release(); d->program->release(); -// viewer->glPointSize(point_size); + viewer->setGlPointSize(point_size); } // Gets wrapped point set Point_set* Scene_points_with_normal_item::point_set() diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp index ad225a6ab04..66edfbe7f05 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp @@ -719,11 +719,11 @@ void Scene_polyhedron_selection_item::drawEdges(CGAL::Three::Viewer_interface* v { d->program = getShaderProgram(PROGRAM_SOLID_WIREFRAME); attribBuffers(viewer,PROGRAM_SOLID_WIREFRAME); + d->program->bind(); d->program->setUniformValue("viewport", vp); d->program->setUniformValue("width", 3.0f); d->program->setUniformValue("near", (GLfloat)viewer->camera()->zNear()); d->program->setUniformValue("far" , (GLfloat)viewer->camera()->zFar()); - d->program->bind(); } d->program->setAttributeValue("colors",QColor(255,153,51)); @@ -759,7 +759,7 @@ void Scene_polyhedron_selection_item::drawEdges(CGAL::Three::Viewer_interface* v viewer->glDrawArrays(GL_LINES, 0, static_cast(d->nb_temp_lines/3)); d->program->release(); vaos[Scene_polyhedron_selection_item_priv::TempEdges]->release(); - viewer->glLineWidth(3.0f); + if(!are_buffers_filled) { d->computeElements(); @@ -772,6 +772,7 @@ void Scene_polyhedron_selection_item::drawEdges(CGAL::Three::Viewer_interface* v d->program = getShaderProgram(PROGRAM_NO_SELECTION); attribBuffers(viewer,PROGRAM_NO_SELECTION); d->program->bind(); + viewer->glLineWidth(3.0f); } else { diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Polyhedron/demo/Polyhedron/Viewer.cpp index a9e99cc94fd..b44e973f404 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Polyhedron/demo/Polyhedron/Viewer.cpp @@ -38,7 +38,7 @@ public: QString message; bool _displayMessage; QTimer messageTimer; - QOpenGLFunctions_4_3_Compatibility* _recentFunctions; + QOpenGLFunctions_4_3_Core* _recentFunctions; bool is_2d_selection_mode; // D e p t h P e e l i n g @@ -208,6 +208,7 @@ void Viewer::fastDraw() void Viewer::init() { + if(!isOpenGL_4_3()) { std::cerr<<"The openGL context initialization failed " @@ -215,16 +216,16 @@ void Viewer::init() } else { - d->_recentFunctions = new QOpenGLFunctions_4_3_Compatibility(); - d->logger = new QOpenGLDebugLogger(this); - if(!d->logger->initialize()) - qDebug()<<"logger could not init."; - else{ - connect(d->logger, SIGNAL(messageLogged(QOpenGLDebugMessage)), this, SLOT(messageLogged(QOpenGLDebugMessage))); - d->logger->startLogging(); - } + d->_recentFunctions = new QOpenGLFunctions_4_3_Core(); d->_recentFunctions->initializeOpenGLFunctions(); } + d->logger = new QOpenGLDebugLogger(this); + if(!d->logger->initialize()) + qDebug()<<"logger could not init."; + else{ + connect(d->logger, SIGNAL(messageLogged(QOpenGLDebugMessage)), this, SLOT(messageLogged(QOpenGLDebugMessage))); + d->logger->startLogging(); + } glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDARBPROC)this->context()->getProcAddress("glDrawArraysInstancedARB"); if(!glDrawArraysInstanced) { @@ -255,7 +256,7 @@ void Viewer::init() //Vertex source code const char vertex_source_dist[] = { - "#version 120 \n" + "//#version 100 \n" "attribute highp vec4 vertex;\n" "uniform highp mat4 mvp_matrix;\n" "uniform highp float point_size;\n" @@ -269,7 +270,7 @@ void Viewer::init() //Fragment source code const char fragment_source_dist[] = { - "#version 120 \n" + "//#version 100 \n" "void main(void) { \n" "gl_FragColor = vec4(0.0,0.0,0.0,1.0); \n" "} \n" @@ -1186,7 +1187,7 @@ void Viewer::enableClippingBox(QVector4D box[6]) d->clipbox[i] = box[i]; } -QOpenGLFunctions_4_3_Compatibility* Viewer::openGL_4_3_functions() { return d->_recentFunctions; } +QOpenGLFunctions_4_3_Core *Viewer::openGL_4_3_functions() { return d->_recentFunctions; } void Viewer::set2DSelectionMode(bool b) { d->is_2d_selection_mode = b; } diff --git a/Polyhedron/demo/Polyhedron/Viewer.h b/Polyhedron/demo/Polyhedron/Viewer.h index c7a32666c2b..582983de04c 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.h +++ b/Polyhedron/demo/Polyhedron/Viewer.h @@ -143,7 +143,7 @@ protected: double prev_radius; public: - QOpenGLFunctions_4_3_Compatibility* openGL_4_3_functions() Q_DECL_OVERRIDE; + QOpenGLFunctions_4_3_Core* openGL_4_3_functions() Q_DECL_OVERRIDE; void setCurrentPass(int pass) Q_DECL_OVERRIDE; void setDepthWriting(bool writing_depth) Q_DECL_OVERRIDE; void setDepthPeelingFbo(QOpenGLFramebufferObject *fbo) Q_DECL_OVERRIDE; diff --git a/Polyhedron/demo/Polyhedron/resources/shader_c3t3.v b/Polyhedron/demo/Polyhedron/resources/shader_c3t3.v index 3db085fc2e7..4d052b1585d 100644 --- a/Polyhedron/demo/Polyhedron/resources/shader_c3t3.v +++ b/Polyhedron/demo/Polyhedron/resources/shader_c3t3.v @@ -1,4 +1,4 @@ -#version 120 +//#version 100 attribute highp vec4 vertex; attribute highp vec3 normals; attribute highp vec3 colors; @@ -16,7 +16,13 @@ void main(void) gl_PointSize = point_size; color = vec4(colors, vertex.x * cutplane.x + vertex.y * cutplane.y + vertex.z * cutplane.z + cutplane.w); fP = mv_matrix * vertex; - fN = mat3(mv_matrix)* normals; + + mat3 mv_matrix_3; + mv_matrix_3[0] = mv_matrix[0].xyz; + mv_matrix_3[1] = mv_matrix[1].xyz; + mv_matrix_3[2] = mv_matrix[2].xyz; + fN = mv_matrix_3* normals; + highp mat4 transOB = mat4(1, 0, 0, 0, // first column 0, 1, 0, 0, // second column 0, 0, 1, 0, // third column diff --git a/Polyhedron/demo/Polyhedron/resources/shader_c3t3_edges.v b/Polyhedron/demo/Polyhedron/resources/shader_c3t3_edges.v index 7bc330cfa68..7470a5d998d 100644 --- a/Polyhedron/demo/Polyhedron/resources/shader_c3t3_edges.v +++ b/Polyhedron/demo/Polyhedron/resources/shader_c3t3_edges.v @@ -1,4 +1,4 @@ -#version 120 +//#version 100 attribute highp vec4 vertex; attribute highp vec3 colors; uniform highp mat4 mvp_matrix; diff --git a/Polyhedron/demo/Polyhedron/resources/shader_c3t3_spheres.v b/Polyhedron/demo/Polyhedron/resources/shader_c3t3_spheres.v index f75650d9df6..1ce5c173d76 100644 --- a/Polyhedron/demo/Polyhedron/resources/shader_c3t3_spheres.v +++ b/Polyhedron/demo/Polyhedron/resources/shader_c3t3_spheres.v @@ -1,4 +1,4 @@ -#version 120 +//#version 100 attribute highp vec4 vertex; attribute highp vec3 normals; attribute highp vec3 colors; @@ -17,6 +17,10 @@ void main(void) color = vec4(colors, center.x * cutplane.x + center.y * cutplane.y + center.z * cutplane.z + cutplane.w); vec4 my_vertex = vec4(radius*vertex.x + center.x, radius* vertex.y + center.y, radius*vertex.z + center.z, 1.0) ; fP = mv_matrix * my_vertex; - fN = mat3(mv_matrix)* normals; + mat3 mv_matrix_3; + mv_matrix_3[0] = mv_matrix[0].xyz; + mv_matrix_3[1] = mv_matrix[1].xyz; + mv_matrix_3[2] = mv_matrix[2].xyz; + fN = mv_matrix_3* normals; gl_Position = mvp_matrix * my_vertex; } diff --git a/Polyhedron/demo/Polyhedron/resources/shader_flat.v b/Polyhedron/demo/Polyhedron/resources/shader_flat.v index 0f0fc88f63c..c5b8ae3bdd0 100644 --- a/Polyhedron/demo/Polyhedron/resources/shader_flat.v +++ b/Polyhedron/demo/Polyhedron/resources/shader_flat.v @@ -14,8 +14,8 @@ out VS_OUT uniform mat4 mvp_matrix; uniform mat4 mv_matrix; uniform bool is_clipbox_on; -uniform highp mat4x4 clipbox1; -uniform highp mat4x4 clipbox2; +uniform highp mat4 clipbox1; +uniform highp mat4 clipbox2; uniform highp float point_size; void compute_distances(void) diff --git a/Polyhedron/demo/Polyhedron/resources/shader_instanced.v b/Polyhedron/demo/Polyhedron/resources/shader_instanced.v index 9e7bc63bb01..6c8e70e2630 100644 --- a/Polyhedron/demo/Polyhedron/resources/shader_instanced.v +++ b/Polyhedron/demo/Polyhedron/resources/shader_instanced.v @@ -1,4 +1,4 @@ -#version 120 +//#version 100 attribute highp vec4 vertex; attribute highp vec3 normals; attribute highp vec3 colors; @@ -14,9 +14,13 @@ uniform highp float point_size; void main(void) { gl_PointSize = point_size; -color = vec4(colors, 1.0); -vec4 my_vertex = vec4(vertex.x + center.x, vertex.y + center.y, vertex.z + center.z, 1.0); -fP = mv_matrix * my_vertex; -fN = mat3(mv_matrix)* normals; + color = vec4(colors, 1.0); + vec4 my_vertex = vec4(vertex.x + center.x, vertex.y + center.y, vertex.z + center.z, 1.0); + fP = mv_matrix * my_vertex; + mat3 mv_matrix_3; + mv_matrix_3[0] = mv_matrix[0].xyz; + mv_matrix_3[1] = mv_matrix[1].xyz; + mv_matrix_3[2] = mv_matrix[2].xyz; + fN = mv_matrix_3* normals; gl_Position = mvp_matrix * my_vertex; } diff --git a/Polyhedron/demo/Polyhedron/resources/shader_spheres.v b/Polyhedron/demo/Polyhedron/resources/shader_spheres.v index 12723d0c789..82277c57cd5 100644 --- a/Polyhedron/demo/Polyhedron/resources/shader_spheres.v +++ b/Polyhedron/demo/Polyhedron/resources/shader_spheres.v @@ -1,4 +1,4 @@ -#version 120 +//#version 100 attribute highp vec4 vertex; attribute highp vec3 normals; attribute highp vec3 colors; @@ -16,10 +16,14 @@ void main(void) { gl_PointSize = point_size; for(int i=0; i<6; ++i) - dist[i] = 1; + dist[i] = 1.0; color = vec4(colors, 1.0); fP = mv_matrix * vertex; - fN = mat3(mv_matrix)* normals; + mat3 mv_matrix_3; + mv_matrix_3[0] = mv_matrix[0].xyz; + mv_matrix_3[1] = mv_matrix[1].xyz; + mv_matrix_3[2] = mv_matrix[2].xyz; + fN = mv_matrix_3* normals; gl_Position = mvp_matrix * vec4(radius*vertex.x + center.x, radius* vertex.y + center.y, radius*vertex.z + center.z, 1.0) ; } diff --git a/Polyhedron/demo/Polyhedron/resources/shader_with_light.v b/Polyhedron/demo/Polyhedron/resources/shader_with_light.v index f03f0bcd5e7..a486052d8f1 100644 --- a/Polyhedron/demo/Polyhedron/resources/shader_with_light.v +++ b/Polyhedron/demo/Polyhedron/resources/shader_with_light.v @@ -1,4 +1,4 @@ -#version 120 +//#version 100 attribute highp vec4 vertex; attribute highp vec3 normals; attribute highp vec4 colors; @@ -9,8 +9,8 @@ varying highp vec3 fN; varying highp vec4 color; varying highp float dist[6]; uniform bool is_clipbox_on; -uniform highp mat4x4 clipbox1; -uniform highp mat4x4 clipbox2; +uniform highp mat4 clipbox1; +uniform highp mat4 clipbox2; uniform highp float point_size; void compute_distances(void) @@ -39,6 +39,10 @@ void main(void) if(is_clipbox_on) compute_distances(); fP = mv_matrix * vertex; - fN = mat3(mv_matrix)* normals; + mat3 mv_matrix_3; + mv_matrix_3[0] = mv_matrix[0].xyz; + mv_matrix_3[1] = mv_matrix[1].xyz; + mv_matrix_3[2] = mv_matrix[2].xyz; + fN = mv_matrix_3* normals; gl_Position = mvp_matrix * vertex; } diff --git a/Polyhedron/demo/Polyhedron/resources/shader_with_texture.v b/Polyhedron/demo/Polyhedron/resources/shader_with_texture.v index a119ea75549..1dc3f553d1e 100644 --- a/Polyhedron/demo/Polyhedron/resources/shader_with_texture.v +++ b/Polyhedron/demo/Polyhedron/resources/shader_with_texture.v @@ -1,4 +1,4 @@ -#version 120 +//#version 100 attribute highp vec4 vertex; attribute highp vec3 normal; attribute highp vec2 v_texCoord; @@ -20,7 +20,11 @@ void main(void) { gl_PointSize = point_size; vec4 P = mv_matrix * vertex; - vec3 N = mat3(mv_matrix)* normal; + mat3 mv_matrix_3; + mv_matrix_3[0] = mv_matrix[0].xyz; + mv_matrix_3[1] = mv_matrix[1].xyz; + mv_matrix_3[2] = mv_matrix[2].xyz; + vec3 N = mv_matrix_3* normal; vec3 L = light_pos.xyz - P.xyz; N = normalize(N); L = normalize(L); @@ -30,6 +34,6 @@ void main(void) else diffuse = max(dot(N,L), 0.0) * light_diff.xyz; f_texCoord = v_texCoord; - fColors = vec3(1.0f, 1.0f, 1.0f) * (light_amb.xyz + diffuse); + fColors = vec3(1.0, 1.0, 1.0) * (light_amb.xyz + diffuse); gl_Position = mvp_matrix * f_matrix * vertex; } diff --git a/Polyhedron/demo/Polyhedron/resources/shader_with_textured_edges.v b/Polyhedron/demo/Polyhedron/resources/shader_with_textured_edges.v index 389c48e426c..50ca10feab1 100644 --- a/Polyhedron/demo/Polyhedron/resources/shader_with_textured_edges.v +++ b/Polyhedron/demo/Polyhedron/resources/shader_with_textured_edges.v @@ -1,4 +1,4 @@ -#version 120 +//#version 100 attribute highp vec4 vertex; attribute highp vec2 v_texCoord; uniform highp vec3 color_lines; diff --git a/Polyhedron/demo/Polyhedron/resources/shader_without_light.v b/Polyhedron/demo/Polyhedron/resources/shader_without_light.v index 4723e60e099..67b431c19ec 100644 --- a/Polyhedron/demo/Polyhedron/resources/shader_without_light.v +++ b/Polyhedron/demo/Polyhedron/resources/shader_without_light.v @@ -1,4 +1,4 @@ -#version 120 +//#version 100 attribute highp vec4 vertex; attribute highp vec3 colors; uniform highp mat4 mvp_matrix; @@ -6,8 +6,8 @@ uniform highp mat4 f_matrix; varying highp vec4 color; varying highp float dist[6]; uniform bool is_clipbox_on; -uniform highp mat4x4 clipbox1; -uniform highp mat4x4 clipbox2; +uniform highp mat4 clipbox1; +uniform highp mat4 clipbox2; uniform highp float point_size; void compute_distances(void) diff --git a/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.f b/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.f index 45e1ab1c534..8723565a84a 100644 --- a/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.f +++ b/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.f @@ -1,4 +1,4 @@ -#version 150 +#version 430 in GS_OUT { diff --git a/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.g b/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.g index 6a52bbc7245..2235e9a9c0e 100644 --- a/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.g +++ b/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.g @@ -1,4 +1,4 @@ -#version 150 +#version 430 layout (lines) in; layout (triangle_strip, max_vertices = 4) out; diff --git a/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.v b/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.v index ca1e2205f40..c2497f38417 100644 --- a/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.v +++ b/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.v @@ -1,4 +1,4 @@ -#version 150 +#version 430 in vec4 vertex; in vec4 colors; diff --git a/Three/include/CGAL/Three/Viewer_interface.h b/Three/include/CGAL/Three/Viewer_interface.h index ba1e8f4a34e..0c78e97c68b 100644 --- a/Three/include/CGAL/Three/Viewer_interface.h +++ b/Three/include/CGAL/Three/Viewer_interface.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include // forward declarations class QWidget; @@ -104,7 +104,7 @@ public: virtual bool hasText() const { return false; } //! \brief Constructor //! - //! Creates a valid context for OpenGL 2.1. + //! Creates a valid context for OpenGL ES 2.0. //! \param parent the parent widget. It usually is the MainWindow. Viewer_interface(QWidget* parent) : CGAL::QGLViewer(parent) {} virtual ~Viewer_interface() {} @@ -175,11 +175,11 @@ public: //! The textRenderer uses the painter to display 2D text over the 3D Scene. //! \returns the viewer's TextRender virtual TextRenderer* textRenderer() = 0; - //!Allows OpenGL 2.1 context to get access to glDrawArraysInstanced. + //!Allows OpenGL ES 2.0 context to get access to glDrawArraysInstanced. typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); - //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor. + //!Allows OpenGL ES 2.0 context to get access to glVertexAttribDivisor. typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); - //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor. + //!Allows OpenGL ES 2.0 context to get access to glVertexAttribDivisor. typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint target, GLuint attachment, GLuint textarget, GLuint texture, GLint level); PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced; @@ -257,9 +257,9 @@ public: //! 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 `isOpenGL_4_3()` is `true` + //! @returns a pointer to an initialized QOpenGLFunctions_4_3_Core if `isOpenGL_4_3()` is `true` //! @returns NULL if `isOpenGL_4_3()` is `false` - virtual QOpenGLFunctions_4_3_Compatibility* openGL_4_3_functions() = 0; + virtual QOpenGLFunctions_4_3_Core* openGL_4_3_functions() = 0; //! getter for point size under old openGL context; virtual const GLfloat& getGlPointSize()const = 0; //! setter for point size under old openGL context;