mirror of https://github.com/CGAL/cgal
WIP Shader fixes
This commit is contained in:
parent
2c83b2c2f5
commit
f80f318503
|
|
@ -1204,9 +1204,9 @@ protected:
|
||||||
//C o n t e x t
|
//C o n t e x t
|
||||||
bool is_ogl_4_3;
|
bool is_ogl_4_3;
|
||||||
public:
|
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 `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; }
|
bool isOpenGL_4_3()const {return is_ogl_4_3; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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.
|
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()`
|
\see `isOpenGL_4_3()`
|
||||||
*/
|
*/
|
||||||
CGAL_INLINE_FUNCTION
|
CGAL_INLINE_FUNCTION
|
||||||
|
|
@ -213,13 +213,13 @@ void CGAL::QGLViewer::initializeGL() {
|
||||||
format.setDepthBufferSize(24);
|
format.setDepthBufferSize(24);
|
||||||
format.setStencilBufferSize(8);
|
format.setStencilBufferSize(8);
|
||||||
format.setVersion(4,3);
|
format.setVersion(4,3);
|
||||||
format.setProfile(QSurfaceFormat::CompatibilityProfile);
|
format.setProfile(QSurfaceFormat::CoreProfile);
|
||||||
format.setSamples(0);
|
format.setSamples(0);
|
||||||
format.setOption(QSurfaceFormat::DebugContext);
|
format.setOption(QSurfaceFormat::DebugContext);
|
||||||
context()->setFormat(format);
|
context()->setFormat(format);
|
||||||
bool created = context()->create();
|
bool created = context()->create();
|
||||||
if(!created || context()->format().profile() != QSurfaceFormat::CompatibilityProfile) {
|
if(!created || context()->format().profile() != QSurfaceFormat::CoreProfile) {
|
||||||
// impossible to get a 4.3 compatibility profile, retry with 2.0
|
// impossible to get a 4.3 core profile, retry with ES 2.0
|
||||||
format = QSurfaceFormat::defaultFormat();
|
format = QSurfaceFormat::defaultFormat();
|
||||||
context()->setFormat(format);
|
context()->setFormat(format);
|
||||||
created = context()->create();
|
created = context()->create();
|
||||||
|
|
@ -456,11 +456,11 @@ CGAL_INLINE_FUNCTION
|
||||||
void CGAL::QGLViewer::postDraw() {
|
void CGAL::QGLViewer::postDraw() {
|
||||||
// Pivot point, line when camera rolls, zoom region
|
// Pivot point, line when camera rolls, zoom region
|
||||||
if (gridIsDrawn()) {
|
if (gridIsDrawn()) {
|
||||||
glLineWidth(1.0);
|
if(!is_ogl_4_3)
|
||||||
|
glLineWidth(1.0);
|
||||||
drawGrid(camera()->sceneRadius());
|
drawGrid(camera()->sceneRadius());
|
||||||
}
|
}
|
||||||
if (axisIsDrawn()) {
|
if (axisIsDrawn()) {
|
||||||
glLineWidth(2.0);
|
|
||||||
drawAxis(1.0);
|
drawAxis(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -562,7 +562,7 @@ public:
|
||||||
//Vertex source code
|
//Vertex source code
|
||||||
const char tex_vertex_source[] =
|
const char tex_vertex_source[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"attribute highp vec4 vertex;\n"
|
"attribute highp vec4 vertex;\n"
|
||||||
"attribute highp vec2 tex_coord; \n"
|
"attribute highp vec2 tex_coord; \n"
|
||||||
"uniform highp mat4 mvp_matrix;\n"
|
"uniform highp mat4 mvp_matrix;\n"
|
||||||
|
|
@ -577,7 +577,7 @@ public:
|
||||||
//Vertex source code
|
//Vertex source code
|
||||||
const char tex_fragment_source[] =
|
const char tex_fragment_source[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"uniform sampler2D texture;\n"
|
"uniform sampler2D texture;\n"
|
||||||
"varying highp vec2 texc;\n"
|
"varying highp vec2 texc;\n"
|
||||||
"void main(void) { \n"
|
"void main(void) { \n"
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,7 @@ private:
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
const char* Volume_plane<T>::vertexShader_source =
|
const char* Volume_plane<T>::vertexShader_source =
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"attribute highp vec4 vertex; \n"
|
"attribute highp vec4 vertex; \n"
|
||||||
"attribute highp float color; \n"
|
"attribute highp float color; \n"
|
||||||
"uniform highp mat4 mvp_matrix; \n"
|
"uniform highp mat4 mvp_matrix; \n"
|
||||||
|
|
@ -388,13 +388,13 @@ const char* Volume_plane<T>::vertexShader_source =
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
const char* Volume_plane<T>::fragmentShader_source =
|
const char* Volume_plane<T>::fragmentShader_source =
|
||||||
"#version 120\n"
|
"//#version 100 \n"
|
||||||
"varying highp vec4 fullColor; \n"
|
"varying highp vec4 fullColor; \n"
|
||||||
"void main() { gl_FragColor = fullColor; } \n";
|
"void main() { gl_FragColor = fullColor; } \n";
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
const char* Volume_plane<T>::vertexShader_bordures_source =
|
const char* Volume_plane<T>::vertexShader_bordures_source =
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"attribute highp vec4 vertex; \n"
|
"attribute highp vec4 vertex; \n"
|
||||||
"attribute highp vec4 colors; \n"
|
"attribute highp vec4 colors; \n"
|
||||||
"uniform highp mat4 mvp_matrix; \n"
|
"uniform highp mat4 mvp_matrix; \n"
|
||||||
|
|
@ -406,7 +406,7 @@ const char* Volume_plane<T>::vertexShader_bordures_source =
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
const char* Volume_plane<T>::fragmentShader_bordures_source =
|
const char* Volume_plane<T>::fragmentShader_bordures_source =
|
||||||
"#version 120\n"
|
"//#version 100 \n"
|
||||||
"varying highp vec4 fullColor; \n"
|
"varying highp vec4 fullColor; \n"
|
||||||
"void main() { gl_FragColor = fullColor; } \n";
|
"void main() { gl_FragColor = fullColor; } \n";
|
||||||
|
|
||||||
|
|
@ -469,7 +469,7 @@ void Volume_plane<T>::draw(Viewer_interface *viewer) const {
|
||||||
}
|
}
|
||||||
mvp.translate(QVector3D(tx, ty, tz));
|
mvp.translate(QVector3D(tx, ty, tz));
|
||||||
|
|
||||||
if(!program_bordures)
|
if(!program_bordures)
|
||||||
{
|
{
|
||||||
if(viewer->isOpenGL_4_3())
|
if(viewer->isOpenGL_4_3())
|
||||||
program_bordures = viewer->getShaderProgram(PROGRAM_SOLID_WIREFRAME);
|
program_bordures = viewer->getShaderProgram(PROGRAM_SOLID_WIREFRAME);
|
||||||
|
|
@ -498,6 +498,7 @@ void Volume_plane<T>::draw(Viewer_interface *viewer) const {
|
||||||
drawRectangle(*this, !viewer->isOpenGL_4_3());
|
drawRectangle(*this, !viewer->isOpenGL_4_3());
|
||||||
|
|
||||||
program_bordures->bind();
|
program_bordures->bind();
|
||||||
|
vaos[2]->bind();
|
||||||
rectBuffer.create();
|
rectBuffer.create();
|
||||||
rectBuffer.bind();
|
rectBuffer.bind();
|
||||||
rectBuffer.allocate(v_rec.data(), static_cast<int>(v_rec.size()*sizeof(float)));
|
rectBuffer.allocate(v_rec.data(), static_cast<int>(v_rec.size()*sizeof(float)));
|
||||||
|
|
@ -509,6 +510,7 @@ void Volume_plane<T>::draw(Viewer_interface *viewer) const {
|
||||||
{
|
{
|
||||||
viewer->glLineWidth(4.0f);
|
viewer->glLineWidth(4.0f);
|
||||||
viewer->glDrawArrays(GL_LINE_LOOP, 0, static_cast<GLsizei>(v_rec.size()/3));
|
viewer->glDrawArrays(GL_LINE_LOOP, 0, static_cast<GLsizei>(v_rec.size()/3));
|
||||||
|
viewer->glLineWidth(1.0f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -522,10 +524,11 @@ void Volume_plane<T>::draw(Viewer_interface *viewer) const {
|
||||||
viewer->glDepthRangef(0.0,1.0);
|
viewer->glDepthRangef(0.0,1.0);
|
||||||
}
|
}
|
||||||
rectBuffer.release();
|
rectBuffer.release();
|
||||||
|
vaos[1]->release();
|
||||||
program_bordures->release();
|
program_bordures->release();
|
||||||
viewer->glLineWidth(1.0f);
|
|
||||||
|
|
||||||
program.bind();
|
program.bind();
|
||||||
|
vaos[1]->bind();
|
||||||
int mvpLoc = program.uniformLocation("mvp_matrix");
|
int mvpLoc = program.uniformLocation("mvp_matrix");
|
||||||
int fLoc = program.uniformLocation("f_matrix");
|
int fLoc = program.uniformLocation("f_matrix");
|
||||||
program.setUniformValue(mvpLoc, mvp);
|
program.setUniformValue(mvpLoc, mvp);
|
||||||
|
|
@ -535,7 +538,6 @@ void Volume_plane<T>::draw(Viewer_interface *viewer) const {
|
||||||
program.enableAttributeArray(vloc);
|
program.enableAttributeArray(vloc);
|
||||||
program.setAttributeBuffer(vloc, GL_FLOAT, 0, 3);
|
program.setAttributeBuffer(vloc, GL_FLOAT, 0, 3);
|
||||||
vVBO.release();
|
vVBO.release();
|
||||||
|
|
||||||
cbuffer.bind();
|
cbuffer.bind();
|
||||||
int colorLoc = program.attributeLocation("color");
|
int colorLoc = program.attributeLocation("color");
|
||||||
program.enableAttributeArray(colorLoc);
|
program.enableAttributeArray(colorLoc);
|
||||||
|
|
@ -555,6 +557,7 @@ void Volume_plane<T>::draw(Viewer_interface *viewer) const {
|
||||||
|
|
||||||
cbuffer.release();
|
cbuffer.release();
|
||||||
printGlError(viewer, __LINE__);
|
printGlError(viewer, __LINE__);
|
||||||
|
vaos[1]->release();
|
||||||
program.release();
|
program.release();
|
||||||
|
|
||||||
printGlError(viewer, __LINE__);
|
printGlError(viewer, __LINE__);
|
||||||
|
|
@ -605,9 +608,11 @@ void Volume_plane<T>::init(Viewer_interface* viewer) {
|
||||||
assert(vertices.size() == (3 * adim_ * bdim_));
|
assert(vertices.size() == (3 * adim_ * bdim_));
|
||||||
|
|
||||||
vVBO.create();
|
vVBO.create();
|
||||||
|
vaos[1]->bind();
|
||||||
vVBO.bind();
|
vVBO.bind();
|
||||||
vVBO.allocate(vertices.data(),static_cast<int>(sizeof(float) * vertices.size()));
|
vVBO.allocate(vertices.data(),static_cast<int>(sizeof(float) * vertices.size()));
|
||||||
vVBO.release();
|
vVBO.release();
|
||||||
|
vaos[1]->release();
|
||||||
printGlError(viewer, __LINE__);
|
printGlError(viewer, __LINE__);
|
||||||
|
|
||||||
// for each patch
|
// for each patch
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ void Volume_plane_intersection::draw(Viewer_interface* viewer) const {
|
||||||
}
|
}
|
||||||
if(!viewer->isOpenGL_4_3())
|
if(!viewer->isOpenGL_4_3())
|
||||||
viewer->glLineWidth(1.0f);
|
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,
|
Volume_plane_intersection::Volume_plane_intersection(float x, float y, float z,
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,6 @@ struct Scene_edit_box_item_priv{
|
||||||
//Vertex source code
|
//Vertex source code
|
||||||
const char vertex_source[] =
|
const char vertex_source[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n "
|
|
||||||
"attribute highp vec4 vertex; "
|
"attribute highp vec4 vertex; "
|
||||||
"attribute highp vec3 normals; "
|
"attribute highp vec3 normals; "
|
||||||
"attribute highp vec4 colors; "
|
"attribute highp vec4 colors; "
|
||||||
|
|
@ -221,9 +220,13 @@ struct Scene_edit_box_item_priv{
|
||||||
"varying highp vec4 color; "
|
"varying highp vec4 color; "
|
||||||
"void main(void) "
|
"void main(void) "
|
||||||
"{ "
|
"{ "
|
||||||
" color = colors; "
|
" color = colors; "
|
||||||
" fP = mv_matrix * vertex; "
|
" 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; "
|
" gl_Position = mvp_matrix * vertex; "
|
||||||
"}\n "
|
"}\n "
|
||||||
"\n "
|
"\n "
|
||||||
|
|
@ -232,7 +235,7 @@ struct Scene_edit_box_item_priv{
|
||||||
//Fragment source code
|
//Fragment source code
|
||||||
const char fragment_source[] =
|
const char fragment_source[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"varying highp vec4 color;"
|
"varying highp vec4 color;"
|
||||||
"varying highp vec4 fP; "
|
"varying highp vec4 fP; "
|
||||||
"varying highp vec3 fN; "
|
"varying highp vec3 fN; "
|
||||||
|
|
@ -407,7 +410,6 @@ void Scene_edit_box_item::draw(Viewer_interface *viewer) const
|
||||||
|
|
||||||
drawSpheres(viewer, f_matrix);
|
drawSpheres(viewer, f_matrix);
|
||||||
|
|
||||||
drawTransparent(viewer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_edit_box_item::drawEdges(Viewer_interface* viewer) const
|
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);
|
drawSpheres(viewer, f_matrix);
|
||||||
}
|
}
|
||||||
drawHl(viewer);
|
drawHl(viewer);
|
||||||
|
drawTransparent(viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_edit_box_item::compute_bbox() const
|
void Scene_edit_box_item::compute_bbox() const
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ Scene_alpha_shape_item::Scene_alpha_shape_item(Scene_points_with_normal_item *po
|
||||||
}
|
}
|
||||||
const char vertex_source[] =
|
const char vertex_source[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"attribute highp vec4 vertex;\n"
|
"attribute highp vec4 vertex;\n"
|
||||||
"attribute highp vec3 colors;\n"
|
"attribute highp vec3 colors;\n"
|
||||||
"uniform highp mat4 mvp_matrix;\n"
|
"uniform highp mat4 mvp_matrix;\n"
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ void Scene_edit_polyhedron_item_priv::init_values()
|
||||||
|
|
||||||
const char vertex_shader_source_bbox[] =
|
const char vertex_shader_source_bbox[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"attribute highp vec3 vertex; \n"
|
"attribute highp vec3 vertex; \n"
|
||||||
"attribute highp vec3 colors; \n"
|
"attribute highp vec3 colors; \n"
|
||||||
|
|
||||||
|
|
@ -324,7 +324,7 @@ void Scene_edit_polyhedron_item_priv::init_values()
|
||||||
};
|
};
|
||||||
const char fragment_shader_source[]=
|
const char fragment_shader_source[]=
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"varying vec3 fColors; \n"
|
"varying vec3 fColors; \n"
|
||||||
" \n"
|
" \n"
|
||||||
"void main(void) \n"
|
"void main(void) \n"
|
||||||
|
|
@ -339,7 +339,7 @@ void Scene_edit_polyhedron_item_priv::init_values()
|
||||||
//Vertex source code
|
//Vertex source code
|
||||||
const char vertex_source[] =
|
const char vertex_source[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"attribute highp vec4 vertex; \n"
|
"attribute highp vec4 vertex; \n"
|
||||||
"attribute highp vec4 colors; \n"
|
"attribute highp vec4 colors; \n"
|
||||||
"uniform highp mat4 mvp_matrix; \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 vec4 color; \n"
|
||||||
"varying highp float dist[6]; \n"
|
"varying highp float dist[6]; \n"
|
||||||
"uniform bool is_clipbox_on; \n"
|
"uniform bool is_clipbox_on; \n"
|
||||||
"uniform highp mat4x4 clipbox1; \n"
|
"uniform highp mat4 clipbox1; \n"
|
||||||
"uniform highp mat4x4 clipbox2; \n"
|
"uniform highp mat4 clipbox2; \n"
|
||||||
" \n"
|
" \n"
|
||||||
"void compute_distances(void) \n"
|
"void compute_distances(void) \n"
|
||||||
"{ \n"
|
"{ \n"
|
||||||
|
|
@ -379,7 +379,7 @@ void Scene_edit_polyhedron_item_priv::init_values()
|
||||||
//Fragment source code
|
//Fragment source code
|
||||||
const char fragment_source[] =
|
const char fragment_source[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"varying highp vec4 color; \n"
|
"varying highp vec4 color; \n"
|
||||||
"varying highp float dist[6]; \n"
|
"varying highp float dist[6]; \n"
|
||||||
"uniform bool is_clipbox_on; \n"
|
"uniform bool is_clipbox_on; \n"
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer)
|
||||||
//Vertex source code
|
//Vertex source code
|
||||||
const char vertex_source[] =
|
const char vertex_source[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"attribute highp vec4 vertex; \n"
|
"attribute highp vec4 vertex; \n"
|
||||||
"attribute highp vec2 v_texCoord; \n"
|
"attribute highp vec2 v_texCoord; \n"
|
||||||
"uniform highp mat4 projection_matrix; \n"
|
"uniform highp mat4 projection_matrix; \n"
|
||||||
|
|
@ -341,7 +341,7 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer)
|
||||||
//Fragment source code
|
//Fragment source code
|
||||||
const char fragment_source[] =
|
const char fragment_source[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"varying highp vec2 f_texCoord; \n"
|
"varying highp vec2 f_texCoord; \n"
|
||||||
"uniform sampler2D texture; \n"
|
"uniform sampler2D texture; \n"
|
||||||
"void main(void) \n"
|
"void main(void) \n"
|
||||||
|
|
|
||||||
|
|
@ -519,13 +519,13 @@ struct Scene_c3t3_item_priv {
|
||||||
std::set<Tr::Cell_handle> intersected_cells;
|
std::set<Tr::Cell_handle> intersected_cells;
|
||||||
QSlider* tet_Slider;
|
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);
|
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);
|
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;
|
PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced;
|
||||||
//!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor.
|
//!Allows OpenGL 2.0 context to get access to glVertexAttribDivisor.
|
||||||
PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor;
|
PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor;
|
||||||
|
|
||||||
mutable std::size_t positions_poly_size;
|
mutable std::size_t positions_poly_size;
|
||||||
|
|
|
||||||
|
|
@ -505,7 +505,6 @@ void Scene_image_item_priv::compile_shaders()
|
||||||
//Vertex source code
|
//Vertex source code
|
||||||
const char vertex_source[] =
|
const char vertex_source[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
|
||||||
"attribute highp vec4 vertex;\n"
|
"attribute highp vec4 vertex;\n"
|
||||||
"attribute highp vec3 normal;\n"
|
"attribute highp vec3 normal;\n"
|
||||||
"attribute highp vec4 inColor;\n"
|
"attribute highp vec4 inColor;\n"
|
||||||
|
|
@ -519,14 +518,18 @@ void Scene_image_item_priv::compile_shaders()
|
||||||
"{\n"
|
"{\n"
|
||||||
" color=inColor; \n"
|
" color=inColor; \n"
|
||||||
" fP = mv_matrix * vertex; \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"
|
" gl_Position = mvp_matrix * vertex; \n"
|
||||||
"}"
|
"}"
|
||||||
};
|
};
|
||||||
//Fragment source code
|
//Fragment source code
|
||||||
const char fragment_source[] =
|
const char fragment_source[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"varying highp vec4 fP; \n"
|
"varying highp vec4 fP; \n"
|
||||||
"varying highp vec3 fN; \n"
|
"varying highp vec3 fN; \n"
|
||||||
"varying highp vec4 color; \n"
|
"varying highp vec4 color; \n"
|
||||||
|
|
|
||||||
|
|
@ -794,7 +794,7 @@ void Scene_points_with_normal_item::drawPoints(CGAL::Three::Viewer_interface* vi
|
||||||
d->initializeBuffers(viewer);
|
d->initializeBuffers(viewer);
|
||||||
GLfloat point_size;
|
GLfloat point_size;
|
||||||
viewer->glGetFloatv(GL_POINT_SIZE, &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;
|
double ratio_displayed = 1.0;
|
||||||
if ((viewer->inFastDrawing () || d->isPointSliderMoving())
|
if ((viewer->inFastDrawing () || d->isPointSliderMoving())
|
||||||
&&((d->nb_points )/3 > limit_fast_drawing)) // arbitrary large value
|
&&((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
|
else
|
||||||
vaos[Scene_points_with_normal_item_priv::Selected_points]->release();
|
vaos[Scene_points_with_normal_item_priv::Selected_points]->release();
|
||||||
d->program->release();
|
d->program->release();
|
||||||
// viewer->glPointSize(point_size);
|
viewer->setGlPointSize(point_size);
|
||||||
}
|
}
|
||||||
// Gets wrapped point set
|
// Gets wrapped point set
|
||||||
Point_set* Scene_points_with_normal_item::point_set()
|
Point_set* Scene_points_with_normal_item::point_set()
|
||||||
|
|
|
||||||
|
|
@ -719,11 +719,11 @@ void Scene_polyhedron_selection_item::drawEdges(CGAL::Three::Viewer_interface* v
|
||||||
{
|
{
|
||||||
d->program = getShaderProgram(PROGRAM_SOLID_WIREFRAME);
|
d->program = getShaderProgram(PROGRAM_SOLID_WIREFRAME);
|
||||||
attribBuffers(viewer,PROGRAM_SOLID_WIREFRAME);
|
attribBuffers(viewer,PROGRAM_SOLID_WIREFRAME);
|
||||||
|
d->program->bind();
|
||||||
d->program->setUniformValue("viewport", vp);
|
d->program->setUniformValue("viewport", vp);
|
||||||
d->program->setUniformValue("width", 3.0f);
|
d->program->setUniformValue("width", 3.0f);
|
||||||
d->program->setUniformValue("near", (GLfloat)viewer->camera()->zNear());
|
d->program->setUniformValue("near", (GLfloat)viewer->camera()->zNear());
|
||||||
d->program->setUniformValue("far" , (GLfloat)viewer->camera()->zFar());
|
d->program->setUniformValue("far" , (GLfloat)viewer->camera()->zFar());
|
||||||
d->program->bind();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
d->program->setAttributeValue("colors",QColor(255,153,51));
|
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<GLsizei>(d->nb_temp_lines/3));
|
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->nb_temp_lines/3));
|
||||||
d->program->release();
|
d->program->release();
|
||||||
vaos[Scene_polyhedron_selection_item_priv::TempEdges]->release();
|
vaos[Scene_polyhedron_selection_item_priv::TempEdges]->release();
|
||||||
viewer->glLineWidth(3.0f);
|
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
d->computeElements();
|
d->computeElements();
|
||||||
|
|
@ -772,6 +772,7 @@ void Scene_polyhedron_selection_item::drawEdges(CGAL::Three::Viewer_interface* v
|
||||||
d->program = getShaderProgram(PROGRAM_NO_SELECTION);
|
d->program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attribBuffers(viewer,PROGRAM_NO_SELECTION);
|
attribBuffers(viewer,PROGRAM_NO_SELECTION);
|
||||||
d->program->bind();
|
d->program->bind();
|
||||||
|
viewer->glLineWidth(3.0f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public:
|
||||||
QString message;
|
QString message;
|
||||||
bool _displayMessage;
|
bool _displayMessage;
|
||||||
QTimer messageTimer;
|
QTimer messageTimer;
|
||||||
QOpenGLFunctions_4_3_Compatibility* _recentFunctions;
|
QOpenGLFunctions_4_3_Core* _recentFunctions;
|
||||||
bool is_2d_selection_mode;
|
bool is_2d_selection_mode;
|
||||||
|
|
||||||
// D e p t h P e e l i n g
|
// D e p t h P e e l i n g
|
||||||
|
|
@ -208,6 +208,7 @@ void Viewer::fastDraw()
|
||||||
|
|
||||||
void Viewer::init()
|
void Viewer::init()
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!isOpenGL_4_3())
|
if(!isOpenGL_4_3())
|
||||||
{
|
{
|
||||||
std::cerr<<"The openGL context initialization failed "
|
std::cerr<<"The openGL context initialization failed "
|
||||||
|
|
@ -215,16 +216,16 @@ void Viewer::init()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d->_recentFunctions = new QOpenGLFunctions_4_3_Compatibility();
|
d->_recentFunctions = new QOpenGLFunctions_4_3_Core();
|
||||||
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->initializeOpenGLFunctions();
|
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");
|
glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDARBPROC)this->context()->getProcAddress("glDrawArraysInstancedARB");
|
||||||
if(!glDrawArraysInstanced)
|
if(!glDrawArraysInstanced)
|
||||||
{
|
{
|
||||||
|
|
@ -255,7 +256,7 @@ void Viewer::init()
|
||||||
//Vertex source code
|
//Vertex source code
|
||||||
const char vertex_source_dist[] =
|
const char vertex_source_dist[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"attribute highp vec4 vertex;\n"
|
"attribute highp vec4 vertex;\n"
|
||||||
"uniform highp mat4 mvp_matrix;\n"
|
"uniform highp mat4 mvp_matrix;\n"
|
||||||
"uniform highp float point_size;\n"
|
"uniform highp float point_size;\n"
|
||||||
|
|
@ -269,7 +270,7 @@ void Viewer::init()
|
||||||
//Fragment source code
|
//Fragment source code
|
||||||
const char fragment_source_dist[] =
|
const char fragment_source_dist[] =
|
||||||
{
|
{
|
||||||
"#version 120 \n"
|
"//#version 100 \n"
|
||||||
"void main(void) { \n"
|
"void main(void) { \n"
|
||||||
"gl_FragColor = vec4(0.0,0.0,0.0,1.0); \n"
|
"gl_FragColor = vec4(0.0,0.0,0.0,1.0); \n"
|
||||||
"} \n"
|
"} \n"
|
||||||
|
|
@ -1186,7 +1187,7 @@ void Viewer::enableClippingBox(QVector4D box[6])
|
||||||
d->clipbox[i] = box[i];
|
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; }
|
void Viewer::set2DSelectionMode(bool b) { d->is_2d_selection_mode = b; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ protected:
|
||||||
double prev_radius;
|
double prev_radius;
|
||||||
|
|
||||||
public:
|
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 setCurrentPass(int pass) Q_DECL_OVERRIDE;
|
||||||
void setDepthWriting(bool writing_depth) Q_DECL_OVERRIDE;
|
void setDepthWriting(bool writing_depth) Q_DECL_OVERRIDE;
|
||||||
void setDepthPeelingFbo(QOpenGLFramebufferObject *fbo) Q_DECL_OVERRIDE;
|
void setDepthPeelingFbo(QOpenGLFramebufferObject *fbo) Q_DECL_OVERRIDE;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#version 120
|
//#version 100
|
||||||
attribute highp vec4 vertex;
|
attribute highp vec4 vertex;
|
||||||
attribute highp vec3 normals;
|
attribute highp vec3 normals;
|
||||||
attribute highp vec3 colors;
|
attribute highp vec3 colors;
|
||||||
|
|
@ -16,7 +16,13 @@ void main(void)
|
||||||
gl_PointSize = point_size;
|
gl_PointSize = point_size;
|
||||||
color = vec4(colors, vertex.x * cutplane.x + vertex.y * cutplane.y + vertex.z * cutplane.z + cutplane.w);
|
color = vec4(colors, vertex.x * cutplane.x + vertex.y * cutplane.y + vertex.z * cutplane.z + cutplane.w);
|
||||||
fP = mv_matrix * vertex;
|
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
|
highp mat4 transOB = mat4(1, 0, 0, 0, // first column
|
||||||
0, 1, 0, 0, // second column
|
0, 1, 0, 0, // second column
|
||||||
0, 0, 1, 0, // third column
|
0, 0, 1, 0, // third column
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#version 120
|
//#version 100
|
||||||
attribute highp vec4 vertex;
|
attribute highp vec4 vertex;
|
||||||
attribute highp vec3 colors;
|
attribute highp vec3 colors;
|
||||||
uniform highp mat4 mvp_matrix;
|
uniform highp mat4 mvp_matrix;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#version 120
|
//#version 100
|
||||||
attribute highp vec4 vertex;
|
attribute highp vec4 vertex;
|
||||||
attribute highp vec3 normals;
|
attribute highp vec3 normals;
|
||||||
attribute highp vec3 colors;
|
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);
|
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) ;
|
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;
|
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;
|
gl_Position = mvp_matrix * my_vertex;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ out VS_OUT
|
||||||
uniform mat4 mvp_matrix;
|
uniform mat4 mvp_matrix;
|
||||||
uniform mat4 mv_matrix;
|
uniform mat4 mv_matrix;
|
||||||
uniform bool is_clipbox_on;
|
uniform bool is_clipbox_on;
|
||||||
uniform highp mat4x4 clipbox1;
|
uniform highp mat4 clipbox1;
|
||||||
uniform highp mat4x4 clipbox2;
|
uniform highp mat4 clipbox2;
|
||||||
uniform highp float point_size;
|
uniform highp float point_size;
|
||||||
|
|
||||||
void compute_distances(void)
|
void compute_distances(void)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#version 120
|
//#version 100
|
||||||
attribute highp vec4 vertex;
|
attribute highp vec4 vertex;
|
||||||
attribute highp vec3 normals;
|
attribute highp vec3 normals;
|
||||||
attribute highp vec3 colors;
|
attribute highp vec3 colors;
|
||||||
|
|
@ -14,9 +14,13 @@ uniform highp float point_size;
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
gl_PointSize = point_size;
|
gl_PointSize = point_size;
|
||||||
color = vec4(colors, 1.0);
|
color = vec4(colors, 1.0);
|
||||||
vec4 my_vertex = vec4(vertex.x + center.x, vertex.y + center.y, vertex.z + center.z, 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;
|
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;
|
gl_Position = mvp_matrix * my_vertex;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#version 120
|
//#version 100
|
||||||
attribute highp vec4 vertex;
|
attribute highp vec4 vertex;
|
||||||
attribute highp vec3 normals;
|
attribute highp vec3 normals;
|
||||||
attribute highp vec3 colors;
|
attribute highp vec3 colors;
|
||||||
|
|
@ -16,10 +16,14 @@ void main(void)
|
||||||
{
|
{
|
||||||
gl_PointSize = point_size;
|
gl_PointSize = point_size;
|
||||||
for(int i=0; i<6; ++i)
|
for(int i=0; i<6; ++i)
|
||||||
dist[i] = 1;
|
dist[i] = 1.0;
|
||||||
color = vec4(colors, 1.0);
|
color = vec4(colors, 1.0);
|
||||||
fP = mv_matrix * vertex;
|
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 *
|
gl_Position = mvp_matrix *
|
||||||
vec4(radius*vertex.x + center.x, radius* vertex.y + center.y, radius*vertex.z + center.z, 1.0) ;
|
vec4(radius*vertex.x + center.x, radius* vertex.y + center.y, radius*vertex.z + center.z, 1.0) ;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#version 120
|
//#version 100
|
||||||
attribute highp vec4 vertex;
|
attribute highp vec4 vertex;
|
||||||
attribute highp vec3 normals;
|
attribute highp vec3 normals;
|
||||||
attribute highp vec4 colors;
|
attribute highp vec4 colors;
|
||||||
|
|
@ -9,8 +9,8 @@ varying highp vec3 fN;
|
||||||
varying highp vec4 color;
|
varying highp vec4 color;
|
||||||
varying highp float dist[6];
|
varying highp float dist[6];
|
||||||
uniform bool is_clipbox_on;
|
uniform bool is_clipbox_on;
|
||||||
uniform highp mat4x4 clipbox1;
|
uniform highp mat4 clipbox1;
|
||||||
uniform highp mat4x4 clipbox2;
|
uniform highp mat4 clipbox2;
|
||||||
uniform highp float point_size;
|
uniform highp float point_size;
|
||||||
|
|
||||||
void compute_distances(void)
|
void compute_distances(void)
|
||||||
|
|
@ -39,6 +39,10 @@ void main(void)
|
||||||
if(is_clipbox_on)
|
if(is_clipbox_on)
|
||||||
compute_distances();
|
compute_distances();
|
||||||
fP = mv_matrix * vertex;
|
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;
|
gl_Position = mvp_matrix * vertex;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#version 120
|
//#version 100
|
||||||
attribute highp vec4 vertex;
|
attribute highp vec4 vertex;
|
||||||
attribute highp vec3 normal;
|
attribute highp vec3 normal;
|
||||||
attribute highp vec2 v_texCoord;
|
attribute highp vec2 v_texCoord;
|
||||||
|
|
@ -20,7 +20,11 @@ void main(void)
|
||||||
{
|
{
|
||||||
gl_PointSize = point_size;
|
gl_PointSize = point_size;
|
||||||
vec4 P = mv_matrix * vertex;
|
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;
|
vec3 L = light_pos.xyz - P.xyz;
|
||||||
N = normalize(N);
|
N = normalize(N);
|
||||||
L = normalize(L);
|
L = normalize(L);
|
||||||
|
|
@ -30,6 +34,6 @@ void main(void)
|
||||||
else
|
else
|
||||||
diffuse = max(dot(N,L), 0.0) * light_diff.xyz;
|
diffuse = max(dot(N,L), 0.0) * light_diff.xyz;
|
||||||
f_texCoord = v_texCoord;
|
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;
|
gl_Position = mvp_matrix * f_matrix * vertex;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#version 120
|
//#version 100
|
||||||
attribute highp vec4 vertex;
|
attribute highp vec4 vertex;
|
||||||
attribute highp vec2 v_texCoord;
|
attribute highp vec2 v_texCoord;
|
||||||
uniform highp vec3 color_lines;
|
uniform highp vec3 color_lines;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#version 120
|
//#version 100
|
||||||
attribute highp vec4 vertex;
|
attribute highp vec4 vertex;
|
||||||
attribute highp vec3 colors;
|
attribute highp vec3 colors;
|
||||||
uniform highp mat4 mvp_matrix;
|
uniform highp mat4 mvp_matrix;
|
||||||
|
|
@ -6,8 +6,8 @@ uniform highp mat4 f_matrix;
|
||||||
varying highp vec4 color;
|
varying highp vec4 color;
|
||||||
varying highp float dist[6];
|
varying highp float dist[6];
|
||||||
uniform bool is_clipbox_on;
|
uniform bool is_clipbox_on;
|
||||||
uniform highp mat4x4 clipbox1;
|
uniform highp mat4 clipbox1;
|
||||||
uniform highp mat4x4 clipbox2;
|
uniform highp mat4 clipbox2;
|
||||||
uniform highp float point_size;
|
uniform highp float point_size;
|
||||||
|
|
||||||
void compute_distances(void)
|
void compute_distances(void)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#version 150
|
#version 430
|
||||||
|
|
||||||
in GS_OUT
|
in GS_OUT
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#version 150
|
#version 430
|
||||||
|
|
||||||
layout (lines) in;
|
layout (lines) in;
|
||||||
layout (triangle_strip, max_vertices = 4) out;
|
layout (triangle_strip, max_vertices = 4) out;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#version 150
|
#version 430
|
||||||
|
|
||||||
in vec4 vertex;
|
in vec4 vertex;
|
||||||
in vec4 colors;
|
in vec4 colors;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QOpenGLFunctions>
|
#include <QOpenGLFunctions>
|
||||||
#include <QOpenGLFunctions_4_3_Compatibility>
|
#include <QOpenGLFunctions_4_3_Core>
|
||||||
#include <CGAL/Qt/CreateOpenGLContext.h>
|
#include <CGAL/Qt/CreateOpenGLContext.h>
|
||||||
// forward declarations
|
// forward declarations
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
@ -104,7 +104,7 @@ public:
|
||||||
virtual bool hasText() const { return false; }
|
virtual bool hasText() const { return false; }
|
||||||
//! \brief Constructor
|
//! \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.
|
//! \param parent the parent widget. It usually is the MainWindow.
|
||||||
Viewer_interface(QWidget* parent) : CGAL::QGLViewer(parent) {}
|
Viewer_interface(QWidget* parent) : CGAL::QGLViewer(parent) {}
|
||||||
virtual ~Viewer_interface() {}
|
virtual ~Viewer_interface() {}
|
||||||
|
|
@ -175,11 +175,11 @@ public:
|
||||||
//! The textRenderer uses the painter to display 2D text over the 3D Scene.
|
//! The textRenderer uses the painter to display 2D text over the 3D Scene.
|
||||||
//! \returns the viewer's TextRender
|
//! \returns the viewer's TextRender
|
||||||
virtual TextRenderer* textRenderer() = 0;
|
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);
|
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);
|
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);
|
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint target, GLuint attachment, GLuint textarget, GLuint texture, GLint level);
|
||||||
|
|
||||||
PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced;
|
PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced;
|
||||||
|
|
@ -257,9 +257,9 @@ public:
|
||||||
|
|
||||||
//! Gives acces to recent openGL(4.3) features, allowing use of things like
|
//! Gives acces to recent openGL(4.3) features, allowing use of things like
|
||||||
//! Geometry Shaders or Depth Textures.
|
//! 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`
|
//! @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;
|
//! getter for point size under old openGL context;
|
||||||
virtual const GLfloat& getGlPointSize()const = 0;
|
virtual const GLfloat& getGlPointSize()const = 0;
|
||||||
//! setter for point size under old openGL context;
|
//! setter for point size under old openGL context;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue