mirror of https://github.com/CGAL/cgal
commit
278a28016a
|
|
@ -16,7 +16,6 @@
|
|||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
#include <CGAL/Subdivision_method_3.h>
|
||||
|
||||
#include <QOpenGLFunctions_3_3_Core>
|
||||
#include <QOpenGLShader>
|
||||
#include <QDebug>
|
||||
#include "Viewer.h"
|
||||
|
|
@ -92,9 +91,8 @@ void Scene::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
// "#version 330 \n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
// "uniform highp mat4 ortho_matrix;\n"
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 f_matrix;\n"
|
||||
"void main(void)\n"
|
||||
|
|
@ -105,7 +103,7 @@ void Scene::compile_shaders()
|
|||
//Vertex source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
//"#version 330 \n"
|
||||
"#version 120 \n"
|
||||
"uniform highp vec4 color; \n"
|
||||
"void main(void) { \n"
|
||||
"gl_FragColor = color; \n"
|
||||
|
|
@ -141,7 +139,7 @@ void Scene::compile_shaders()
|
|||
//Vertex source code
|
||||
const char tex_vertex_source[] =
|
||||
{
|
||||
// "#version 330 \n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec2 tex_coord; \n"
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
|
|
@ -156,7 +154,7 @@ void Scene::compile_shaders()
|
|||
//Vertex source code
|
||||
const char tex_fragment_source[] =
|
||||
{
|
||||
//"#version 330 \n"
|
||||
"#version 120 \n"
|
||||
"uniform sampler2D texture;\n"
|
||||
"varying highp vec2 texc;\n"
|
||||
"void main(void) { \n"
|
||||
|
|
@ -1318,7 +1316,7 @@ void Scene::deactivate_cutting_plane()
|
|||
}
|
||||
void Scene::initGL(Viewer * /* viewer */)
|
||||
{
|
||||
gl = new QOpenGLFunctions_3_3_Core();
|
||||
gl = new QOpenGLFunctions_2_1();
|
||||
if(!gl->initializeOpenGLFunctions())
|
||||
{
|
||||
qFatal("ERROR : OpenGL Functions not initialized. Check your OpenGL Verison (should be >=3.3)");
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#include <QtCore/qglobal.h>
|
||||
#include <QGLViewer/manipulatedFrame.h>
|
||||
#include <QGLViewer/qglviewer.h>
|
||||
#include <QOpenGLFunctions_3_3_Core>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QOpenGLBuffer>
|
||||
#include <QOpenGLShaderProgram>
|
||||
|
|
@ -86,7 +86,7 @@ public:
|
|||
|
||||
private:
|
||||
// member data
|
||||
QOpenGLFunctions_3_3_Core *gl;
|
||||
QOpenGLFunctions_2_1 *gl;
|
||||
Bbox m_bbox;
|
||||
Polyhedron *m_pPolyhedron;
|
||||
std::list<Point> m_points;
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ void Viewer::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"in highp vec3 normal;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec3 normal;\n"
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 mv_matrix; \n"
|
||||
"out highp vec4 fP; \n"
|
||||
"out highp vec3 fN; \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" fP = mv_matrix * vertex; \n"
|
||||
|
|
@ -44,12 +44,12 @@ void Viewer::compile_shaders()
|
|||
" gl_Position = mvp_matrix * vertex;\n"
|
||||
"}"
|
||||
};
|
||||
//Vertex source code
|
||||
//Fragment source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 fP; \n"
|
||||
"in highp vec3 fN; \n"
|
||||
"#version 120 \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"uniform highp vec4 color; \n"
|
||||
"uniform vec4 light_pos; \n"
|
||||
"uniform vec4 light_diff; \n"
|
||||
|
|
@ -105,8 +105,8 @@ rendering_program.bind();
|
|||
//Vertex source code
|
||||
const char vertex_source_points[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"void main(void)\n"
|
||||
|
|
@ -117,7 +117,7 @@ const char vertex_source_points[] =
|
|||
//Vertex source code
|
||||
const char fragment_source_points[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"#version 120 \n"
|
||||
"uniform highp vec4 color; \n"
|
||||
|
||||
"void main(void) { \n"
|
||||
|
|
@ -325,6 +325,7 @@ void Viewer::compute_elements()
|
|||
void
|
||||
Viewer::draw()
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
if(!are_buffers_initialized)
|
||||
initialize_buffers();
|
||||
QColor color;
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
|
||||
#include "typedefs.h"
|
||||
#include <QGLViewer/qglviewer.h>
|
||||
#include <QOpenGLFunctions_3_3_Core>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QOpenGLBuffer>
|
||||
#include <QOpenGLShaderProgram>
|
||||
|
||||
|
||||
class Viewer : public QGLViewer, protected QOpenGLFunctions_3_3_Core{
|
||||
class Viewer : public QGLViewer, protected QOpenGLFunctions_2_1{
|
||||
Q_OBJECT
|
||||
|
||||
CGAL::Timer timer;
|
||||
|
|
|
|||
|
|
@ -4,9 +4,12 @@
|
|||
#include <CGAL/Exact_spherical_kernel_3.h>
|
||||
#include <vector>
|
||||
#include <CGAL/Qt/CreateOpenGLContext.h>
|
||||
|
||||
|
||||
Viewer::Viewer(QWidget* parent )
|
||||
: QGLViewer(CGAL::Qt::createOpenGLContext(),parent)
|
||||
{
|
||||
extension_is_found = false;
|
||||
}
|
||||
|
||||
void Viewer::compile_shaders()
|
||||
|
|
@ -29,16 +32,16 @@ void Viewer::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"in highp vec3 normal;\n"
|
||||
"in highp vec4 center;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec3 normal;\n"
|
||||
"attribute highp vec4 center;\n"
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 mv_matrix; \n"
|
||||
|
||||
"out highp vec4 fP; \n"
|
||||
"out highp vec3 fN; \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" fP = mv_matrix * vertex; \n"
|
||||
|
|
@ -49,9 +52,9 @@ void Viewer::compile_shaders()
|
|||
//Vertex source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 fP; \n"
|
||||
"in highp vec3 fN; \n"
|
||||
"#version 120 \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"uniform highp vec4 color; \n"
|
||||
"uniform vec4 light_pos; \n"
|
||||
"uniform vec4 light_diff; \n"
|
||||
|
|
@ -101,6 +104,59 @@ void Viewer::compile_shaders()
|
|||
std::cerr<<"linking Program FAILED"<<std::endl;
|
||||
}
|
||||
rendering_program.bind();
|
||||
if(!extension_is_found)
|
||||
{
|
||||
|
||||
|
||||
//Vertex source code
|
||||
const char vertex_source_no_ext[] =
|
||||
{
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" gl_Position = mvp_matrix * vertex;\n"
|
||||
"}"
|
||||
};
|
||||
//Vertex source code
|
||||
const char fragment_source_no_ext[] =
|
||||
{
|
||||
"#version 120 \n"
|
||||
"uniform highp vec4 color; \n"
|
||||
"void main(void) { \n"
|
||||
"gl_FragColor = color; \n"
|
||||
"} \n"
|
||||
"\n"
|
||||
};
|
||||
vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
|
||||
if(!vertex_shader->compileSourceCode(vertex_source_no_ext))
|
||||
{
|
||||
std::cerr<<"Compiling vertex source FAILED"<<std::endl;
|
||||
}
|
||||
|
||||
fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
|
||||
if(!fragment_shader->compileSourceCode(fragment_source_no_ext))
|
||||
{
|
||||
std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
|
||||
}
|
||||
|
||||
if(!rendering_program_no_ext.addShader(vertex_shader))
|
||||
{
|
||||
std::cerr<<"adding vertex shader FAILED"<<std::endl;
|
||||
}
|
||||
if(!rendering_program_no_ext.addShader(fragment_shader))
|
||||
{
|
||||
std::cerr<<"adding fragment shader FAILED"<<std::endl;
|
||||
}
|
||||
if(!rendering_program_no_ext.link())
|
||||
{
|
||||
std::cerr<<"linking Program FAILED"<<std::endl;
|
||||
}
|
||||
rendering_program_no_ext.bind();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -135,8 +191,12 @@ void Viewer::initialize_buffers()
|
|||
rendering_program.enableAttributeArray(trivialCenterLocation);
|
||||
rendering_program.setAttributeBuffer(trivialCenterLocation,GL_FLOAT,0,3);
|
||||
buffers[2].release();
|
||||
if(extension_is_found)
|
||||
{
|
||||
|
||||
glVertexAttribDivisor(trivialCenterLocation, 1);
|
||||
glVertexAttribDivisor(normalsLocation[0], 0);
|
||||
}
|
||||
vao[0].release();
|
||||
|
||||
//The circles
|
||||
|
|
@ -168,15 +228,20 @@ void Viewer::initialize_buffers()
|
|||
rendering_program.enableAttributeArray(trivialCenterLocation);
|
||||
rendering_program.setAttributeBuffer(trivialCenterLocation,GL_FLOAT,0,3);
|
||||
buffers[5].release();
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(trivialCenterLocation, 1);
|
||||
glVertexAttribDivisor(normalsLocation[0], 0);
|
||||
}
|
||||
rendering_program.release();
|
||||
|
||||
vao[1].release();
|
||||
|
||||
//The little green spheres
|
||||
vao[2].bind();
|
||||
//points of the sphere
|
||||
if(extension_is_found)
|
||||
{
|
||||
//points of the spheres
|
||||
buffers[6].bind();
|
||||
buffers[6].allocate(pos_sphere_inter.data(),
|
||||
static_cast<int>(pos_sphere_inter.size()*sizeof(float)));
|
||||
|
|
@ -203,8 +268,21 @@ void Viewer::initialize_buffers()
|
|||
rendering_program.enableAttributeArray(centerLocation);
|
||||
rendering_program.setAttributeBuffer(centerLocation,GL_FLOAT,0,3);
|
||||
buffers[8].release();
|
||||
|
||||
glVertexAttribDivisor(centerLocation, 1);
|
||||
glVertexAttribDivisor(normalsLocation[1], 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
//points of the sphere
|
||||
buffers[6].bind();
|
||||
buffers[6].allocate(pos_points.data(),
|
||||
static_cast<int>(pos_points.size()*sizeof(float)));
|
||||
rendering_program_no_ext.bind();
|
||||
rendering_program_no_ext.enableAttributeArray("vertex");
|
||||
rendering_program_no_ext.setAttributeBuffer("vertex",GL_FLOAT,0,3);
|
||||
buffers[6].release();
|
||||
}
|
||||
vao[2].release();
|
||||
|
||||
|
||||
|
|
@ -693,13 +771,20 @@ void Viewer::attrib_buffers(QGLViewer* viewer)
|
|||
rendering_program.setUniformValue(mvpLocation, mvpMatrix);
|
||||
rendering_program.setUniformValue(mvLocation, mvMatrix);
|
||||
|
||||
|
||||
rendering_program.release();
|
||||
if(!extension_is_found)
|
||||
{
|
||||
rendering_program_no_ext.bind();
|
||||
rendering_program_no_ext.setUniformValue("mvp_matrix", mvpMatrix);
|
||||
rendering_program_no_ext.release();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Viewer::draw()
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
QColor color;
|
||||
|
||||
//sphere
|
||||
|
|
@ -708,18 +793,34 @@ void Viewer::draw()
|
|||
rendering_program.bind();
|
||||
color.setRgbF(1.0f, 1.0f, 1.0f);
|
||||
rendering_program.setUniformValue(colorLocation, color);
|
||||
if(extension_is_found)
|
||||
glDrawArraysInstanced(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_sphere.size()/3), 1);
|
||||
else
|
||||
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_sphere.size()/3));
|
||||
rendering_program.release();
|
||||
vao[0].release();
|
||||
|
||||
//intersection
|
||||
vao[2].bind();
|
||||
attrib_buffers(this);
|
||||
rendering_program.bind();
|
||||
color.setRgbF(0.0f, 1.0f, 0.0f);
|
||||
if(extension_is_found)
|
||||
{
|
||||
rendering_program.bind();
|
||||
rendering_program.setUniformValue(colorLocation, color);
|
||||
glDrawArraysInstanced(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_sphere_inter.size()/3), static_cast<GLsizei>(pos_points.size()/3));
|
||||
rendering_program.release();
|
||||
}
|
||||
else
|
||||
{
|
||||
glPointSize(4.0f);
|
||||
rendering_program_no_ext.bind();
|
||||
rendering_program_no_ext.setUniformValue(colorLocation, color);
|
||||
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
|
||||
rendering_program_no_ext.release();
|
||||
glPointSize(1.0f);
|
||||
}
|
||||
|
||||
vao[2].release();
|
||||
|
||||
//circles
|
||||
|
|
@ -738,6 +839,24 @@ void Viewer::draw()
|
|||
|
||||
void Viewer::init()
|
||||
{
|
||||
|
||||
glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDARBPROC)this->context()->getProcAddress("glDrawArraysInstancedARB");
|
||||
if(!glDrawArraysInstanced)
|
||||
{
|
||||
qDebug()<<"glDrawArraysInstancedARB : extension not found. Spheres will be displayed as points.";
|
||||
extension_is_found = false;
|
||||
}
|
||||
else
|
||||
extension_is_found = true;
|
||||
|
||||
glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORARBPROC)this->context()->getProcAddress("glVertexAttribDivisorARB");
|
||||
if(!glDrawArraysInstanced)
|
||||
{
|
||||
qDebug()<<"glVertexAttribDivisorARB : extension not found. Spheres will be displayed as points.";
|
||||
extension_is_found = false;
|
||||
}
|
||||
else
|
||||
extension_is_found = true;
|
||||
compile_shaders();
|
||||
compute_elements();
|
||||
initialize_buffers();
|
||||
|
|
@ -748,6 +867,7 @@ void Viewer::init()
|
|||
glEnable(GL_POINT_SMOOTH);
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
|
||||
|
||||
}
|
||||
|
||||
template<class Output_iterator>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
#include <QGLViewer/qglviewer.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
#include <QOpenGLFunctions_3_3_Core>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QOpenGLBuffer>
|
||||
#include <QOpenGLShaderProgram>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel EPIC;
|
||||
|
||||
class Viewer : public QGLViewer, QOpenGLFunctions_3_3_Core
|
||||
class Viewer : public QGLViewer, QOpenGLFunctions_2_1
|
||||
{
|
||||
public:
|
||||
Viewer(QWidget* parent = 0);
|
||||
|
|
@ -29,7 +29,7 @@ private:
|
|||
int mvLocation;
|
||||
int colorLocation;
|
||||
int lightLocation[5];
|
||||
|
||||
bool extension_is_found;
|
||||
|
||||
std::vector<float> pos_points;
|
||||
std::vector<float> pos_lines;
|
||||
|
|
@ -43,6 +43,11 @@ private:
|
|||
QOpenGLBuffer buffers[9];
|
||||
QOpenGLVertexArrayObject vao[3];
|
||||
QOpenGLShaderProgram rendering_program;
|
||||
QOpenGLShaderProgram rendering_program_no_ext;
|
||||
typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
|
||||
PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced;
|
||||
PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor;
|
||||
|
||||
void initialize_buffers();
|
||||
void compute_elements();
|
||||
|
|
|
|||
|
|
@ -423,7 +423,8 @@ it from <A HREF="http://qt-project.org/">`http://qt-project.org/`</A>.
|
|||
Older demos of \cgal use libCGAL_Qt3 and \sc{Qt}3, while newer and newly
|
||||
developed demos require libCGAL_Qt5 and \sc{Qt}5.
|
||||
The exhaustive list of \sc{Qt}5 components used in demos is:
|
||||
`Core`, `Gui`, `Help`, `OpenGL`, `Script`, `ScriptTools`, `Svg`, `Widgets` and `Xml`.
|
||||
`Core`, `Gui`, `Help`, `OpenGL`, `Script`, `ScriptTools`, `Svg`, `Widgets`,
|
||||
`qcollectiongenerator` (with `sqlite` driver plugin) and `Xml`.
|
||||
|
||||
Having \sc{Qt}5 version 5.3.0 is recommended.
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ inline QGLContext* createOpenGLContext()
|
|||
{
|
||||
QOpenGLContext *context = new QOpenGLContext();
|
||||
QSurfaceFormat format;
|
||||
format.setVersion(3,3);
|
||||
format.setVersion(2,1);
|
||||
format.setProfile(QSurfaceFormat::CompatibilityProfile);
|
||||
context->setFormat(format);
|
||||
return QGLContext::fromOpenGLContext(context);
|
||||
|
|
|
|||
|
|
@ -232,32 +232,32 @@ void Viewer::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 140 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"in highp vec3 normal;\n"
|
||||
"in highp vec4 color;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec3 normal;\n"
|
||||
"attribute highp vec3 color;\n"
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 mv_matrix; \n"
|
||||
|
||||
"out highp vec4 fP; \n"
|
||||
"out highp vec3 fN; \n"
|
||||
"out highp vec4 fColor; \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"varying highp vec4 fColor; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" fP = mv_matrix * vertex; \n"
|
||||
" fN = mat3(mv_matrix)* normal; \n"
|
||||
" fColor = color; \n"
|
||||
" fColor = vec4(color, 1.0); \n"
|
||||
" gl_Position = mvp_matrix * vertex;\n"
|
||||
"}"
|
||||
};
|
||||
//Vertex source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 140 \n"
|
||||
"in highp vec4 fP; \n"
|
||||
"in highp vec3 fN; \n"
|
||||
"in highp vec4 fColor; \n"
|
||||
"#version 120 \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"varying highp vec4 fColor; \n"
|
||||
"uniform vec4 light_pos; \n"
|
||||
"uniform vec4 light_diff; \n"
|
||||
"uniform vec4 light_spec; \n"
|
||||
|
|
@ -310,8 +310,8 @@ void Viewer::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source_p_l[] =
|
||||
{
|
||||
"#version 140 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
|
|
@ -321,7 +321,7 @@ void Viewer::compile_shaders()
|
|||
//Vertex source code
|
||||
const char fragment_source_p_l[] =
|
||||
{
|
||||
"#version 140 \n"
|
||||
"#version 120 \n"
|
||||
"uniform highp vec4 color; \n"
|
||||
"void main(void) { \n"
|
||||
"gl_FragColor = color; \n"
|
||||
|
|
@ -657,20 +657,20 @@ void Viewer::attrib_buffers(QGLViewer* viewer)
|
|||
void
|
||||
Viewer::sceneChanged()
|
||||
{
|
||||
|
||||
compute_elements();
|
||||
this->camera()->setSceneBoundingBox(qglviewer::Vec(bb.xmin(),
|
||||
bb.ymin(),
|
||||
bb.zmin()),
|
||||
qglviewer::Vec(bb.xmax(),
|
||||
bb.ymax(),
|
||||
bb.zmax()));
|
||||
compute_elements();
|
||||
are_buffers_initialized = false;
|
||||
this->showEntireScene();
|
||||
}
|
||||
|
||||
void Viewer::draw()
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
if(!are_buffers_initialized)
|
||||
initialize_buffers();
|
||||
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@
|
|||
#include <QGLViewer/qglviewer.h>
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include <QOpenGLFunctions_3_3_Core>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QGLBuffer>
|
||||
#include <QOpenGLShaderProgram>
|
||||
class Viewer : public QGLViewer, QOpenGLFunctions_3_3_Core
|
||||
class Viewer : public QGLViewer, QOpenGLFunctions_2_1
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
|||
|
|
@ -51,16 +51,16 @@ void Scene_c3t3_item::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"in highp vec3 normal;\n"
|
||||
"in highp vec3 inColor; \n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec3 normal;\n"
|
||||
"attribute highp vec3 inColor; \n"
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 mv_matrix; \n"
|
||||
"out highp vec4 fP; \n"
|
||||
"out highp vec3 fN; \n"
|
||||
"out highp vec4 color; \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"varying highp vec4 color; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" color = vec4(inColor, 1.0); \n"
|
||||
|
|
@ -73,9 +73,9 @@ void Scene_c3t3_item::compile_shaders()
|
|||
const char fragment_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 fP; \n"
|
||||
"in highp vec3 fN; \n"
|
||||
"in vec4 color; \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"varying vec4 color; \n"
|
||||
"uniform highp vec4 light_pos; \n"
|
||||
"uniform highp vec4 light_diff; \n"
|
||||
"uniform highp vec4 light_spec; \n"
|
||||
|
|
@ -130,8 +130,8 @@ void Scene_c3t3_item::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source_grid[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 f_matrix; \n"
|
||||
|
|
@ -143,7 +143,7 @@ void Scene_c3t3_item::compile_shaders()
|
|||
//Fragment source code
|
||||
const char fragment_source_grid[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"#version 120 \n"
|
||||
"uniform vec4 color; \n"
|
||||
"void main(void) { \n"
|
||||
"gl_FragColor = color; \n"
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ void Scene_implicit_function_item::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"void main(void)\n"
|
||||
|
|
@ -80,7 +80,7 @@ void Scene_implicit_function_item::compile_shaders()
|
|||
//Fragment source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"#version 120 \n"
|
||||
"uniform vec4 color; \n"
|
||||
"void main(void) { \n"
|
||||
"gl_FragColor = color; \n"
|
||||
|
|
@ -115,24 +115,24 @@ void Scene_implicit_function_item::compile_shaders()
|
|||
//Vertex source code
|
||||
const char tex_vertex_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"in highp vec2 tex_coord; \n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec2 tex_coord; \n"
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 f_matrix;\n"
|
||||
"out highp vec2 texc;\n"
|
||||
"varying highp vec2 texc;\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" gl_Position = mvp_matrix * f_matrix * vertex;\n"
|
||||
" texc = tex_coord;\n"
|
||||
"}"
|
||||
};
|
||||
//Vertex source code
|
||||
//Fragment source code
|
||||
const char tex_fragment_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"#version 120 \n"
|
||||
"uniform sampler2D texture;\n"
|
||||
"in highp vec2 texc;\n"
|
||||
"varying highp vec2 texc;\n"
|
||||
"void main(void) { \n"
|
||||
"gl_FragColor = texture2D(texture, texc.st);\n"
|
||||
"} \n"
|
||||
|
|
|
|||
|
|
@ -125,14 +125,14 @@ void Scene_polygon_soup::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"in highp vec3 normal;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec3 normal;\n"
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 mv_matrix; \n"
|
||||
"out highp vec4 fP; \n"
|
||||
"out highp vec3 fN; \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" fP = mv_matrix * vertex; \n"
|
||||
|
|
@ -143,9 +143,9 @@ void Scene_polygon_soup::compile_shaders()
|
|||
//Fragment source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 fP; \n"
|
||||
"in highp vec3 fN; \n"
|
||||
"#version 120 \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"uniform vec4 color; \n"
|
||||
"uniform bool is_two_side; \n"
|
||||
"uniform highp vec4 light_pos; \n"
|
||||
|
|
|
|||
|
|
@ -54,14 +54,14 @@ void Scene_polyhedron_item::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"in highp vec3 normal;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec3 normal;\n"
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 mv_matrix; \n"
|
||||
"out highp vec4 fP; \n"
|
||||
"out highp vec3 fN; \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" fP = mv_matrix * vertex; \n"
|
||||
|
|
@ -72,9 +72,9 @@ void Scene_polyhedron_item::compile_shaders()
|
|||
//Fragment source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 fP; \n"
|
||||
"in highp vec3 fN; \n"
|
||||
"#version 120 \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"uniform vec4 color; \n"
|
||||
"uniform bool is_two_side; \n"
|
||||
"uniform highp vec4 light_pos; \n"
|
||||
|
|
|
|||
|
|
@ -497,16 +497,16 @@ void Scene_segmented_image_item::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"in highp vec3 normal;\n"
|
||||
"in highp vec4 inColor;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec3 normal;\n"
|
||||
"attribute highp vec4 inColor;\n"
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 mv_matrix; \n"
|
||||
"out highp vec4 fP; \n"
|
||||
"out highp vec3 fN; \n"
|
||||
"out highp vec4 color; \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"varying highp vec4 color; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" color=inColor; \n"
|
||||
|
|
@ -518,10 +518,10 @@ void Scene_segmented_image_item::compile_shaders()
|
|||
//Fragment source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 fP; \n"
|
||||
"in highp vec3 fN; \n"
|
||||
"in highp vec4 color; \n"
|
||||
"#version 120 \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"varying highp vec4 color; \n"
|
||||
"uniform bool is_two_side; \n"
|
||||
"uniform highp vec4 light_pos; \n"
|
||||
"uniform highp vec4 light_diff; \n"
|
||||
|
|
|
|||
|
|
@ -423,9 +423,6 @@ void Volume_plane<T>::init() {
|
|||
|
||||
template<typename T>
|
||||
void Volume_plane<T>::initShaders() {
|
||||
program.create();
|
||||
|
||||
|
||||
QOpenGLShader *vertex = new QOpenGLShader(QOpenGLShader::Vertex);
|
||||
|
||||
vertex->compileSourceCode(vertexShader_source);
|
||||
|
|
@ -436,7 +433,6 @@ void Volume_plane<T>::initShaders() {
|
|||
program.link();
|
||||
|
||||
|
||||
program_bordures.create();
|
||||
QOpenGLShader *vertex_bordures = new QOpenGLShader(QOpenGLShader::Vertex);
|
||||
|
||||
vertex_bordures->compileSourceCode(vertexShader_bordures_source);
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ void Volume_plane_intersection::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 f_matrix; \n"
|
||||
"void main(void)\n"
|
||||
|
|
@ -28,7 +28,7 @@ void Volume_plane_intersection::compile_shaders()
|
|||
//Fragment source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"#version 120 \n"
|
||||
"void main(void) { \n"
|
||||
"gl_FragColor = vec4(1.0,0.0,0.0,1.0); \n"
|
||||
"} \n"
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@
|
|||
#include <CGAL_demo/Viewer_config.h>
|
||||
#include <QGLViewer/qglviewer.h>
|
||||
#include <QPoint>
|
||||
#include <QOpenGLFunctions_3_3_Core>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
|
||||
// forward declarations
|
||||
class QWidget;
|
||||
class Scene_draw_interface;
|
||||
|
||||
class VIEWER_EXPORT Viewer : public QGLViewer, public QOpenGLFunctions_3_3_Core {
|
||||
class VIEWER_EXPORT Viewer : public QGLViewer, public QOpenGLFunctions_2_1 {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ void Viewer::initializeGL()
|
|||
void Viewer::draw_aux(bool with_names)
|
||||
{
|
||||
QGLViewer::draw();
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
if(scene == 0)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ void Scene::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
|
|
@ -45,7 +45,7 @@ void Scene::compile_shaders()
|
|||
//Fragment source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"#version 120 \n"
|
||||
"uniform highp vec4 color; \n"
|
||||
"void main(void) { \n"
|
||||
"gl_FragColor = color; \n"
|
||||
|
|
@ -82,15 +82,15 @@ void Scene::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source_spheres[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"in highp vec3 normal;\n"
|
||||
"in highp vec4 center;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec3 normal;\n"
|
||||
"attribute highp vec4 center;\n"
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 mv_matrix; \n"
|
||||
"out highp vec4 fP; \n"
|
||||
"out highp vec3 fN; \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" fP = mv_matrix * vertex; \n"
|
||||
|
|
@ -101,9 +101,9 @@ void Scene::compile_shaders()
|
|||
//Fragment source code
|
||||
const char fragment_source_spheres[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 fP; \n"
|
||||
"in highp vec3 fN; \n"
|
||||
"#version 120 \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"uniform highp vec4 light_pos; \n"
|
||||
"uniform highp vec4 light_diff; \n"
|
||||
"uniform highp vec4 light_spec; \n"
|
||||
|
|
@ -159,18 +159,18 @@ void Scene::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source_cylinders[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"in highp vec3 normal;\n"
|
||||
"in highp vec4 transfo1;\n"
|
||||
"in highp vec4 transfo2;\n"
|
||||
"in highp vec4 transfo3;\n"
|
||||
"in highp vec4 transfo4;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec3 normal;\n"
|
||||
"attribute highp vec4 transfo1;\n"
|
||||
"attribute highp vec4 transfo2;\n"
|
||||
"attribute highp vec4 transfo3;\n"
|
||||
"attribute highp vec4 transfo4;\n"
|
||||
"mat4 transfo = mat4(transfo1, transfo2, transfo3, transfo4); \n"
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 mv_matrix; \n"
|
||||
"out highp vec4 fP; \n"
|
||||
"out highp vec3 fN; \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" fP = mv_matrix * vertex; \n"
|
||||
|
|
@ -488,8 +488,11 @@ void Scene::initialize_buffers()
|
|||
rendering_program_spheres.enableAttributeArray(centerLocation[0]);
|
||||
rendering_program_spheres.setAttributeBuffer(centerLocation[0],GL_FLOAT,0,3);
|
||||
buffers[0].release();
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[0],1);
|
||||
glVertexAttribDivisor(normalsLocation[0],0);
|
||||
}
|
||||
vao[3].release();
|
||||
rendering_program_spheres.release();
|
||||
|
||||
|
|
@ -538,13 +541,15 @@ void Scene::initialize_buffers()
|
|||
rendering_program_cylinders.setAttributeBuffer(centerLocation[4],GL_FLOAT,0,4);
|
||||
buffers[13].release();
|
||||
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[1],1);
|
||||
glVertexAttribDivisor(centerLocation[2],1);
|
||||
glVertexAttribDivisor(centerLocation[3],1);
|
||||
glVertexAttribDivisor(centerLocation[4],1);
|
||||
|
||||
glVertexAttribDivisor(normalsLocation[1],0);
|
||||
}
|
||||
|
||||
vao[8].release();
|
||||
vao[9].bind();
|
||||
|
|
@ -590,13 +595,15 @@ void Scene::initialize_buffers()
|
|||
rendering_program_cylinders.setAttributeBuffer(centerLocation[4],GL_FLOAT,0,4);
|
||||
buffers[18].release();
|
||||
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[1],1);
|
||||
glVertexAttribDivisor(centerLocation[2],1);
|
||||
glVertexAttribDivisor(centerLocation[3],1);
|
||||
glVertexAttribDivisor(centerLocation[4],1);
|
||||
|
||||
glVertexAttribDivisor(normalsLocation[1],0);
|
||||
}
|
||||
|
||||
vao[9].release();
|
||||
|
||||
|
|
@ -642,14 +649,15 @@ void Scene::initialize_buffers()
|
|||
rendering_program_cylinders.setAttributeBuffer(centerLocation[4],GL_FLOAT,0,4);
|
||||
buffers[22].release();
|
||||
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[1],1);
|
||||
glVertexAttribDivisor(centerLocation[2],1);
|
||||
glVertexAttribDivisor(centerLocation[3],1);
|
||||
glVertexAttribDivisor(centerLocation[4],1);
|
||||
|
||||
glVertexAttribDivisor(normalsLocation[1],0);
|
||||
|
||||
}
|
||||
vao[10].release();
|
||||
|
||||
rendering_program_cylinders.release();
|
||||
|
|
@ -727,6 +735,25 @@ void Scene::init() {
|
|||
// undo from QGLViewer internal initializeGL function
|
||||
// glDisable(GL_COLOR_MATERIAL);
|
||||
initializeOpenGLFunctions();
|
||||
glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDARBPROC)ui->viewer->context()->getProcAddress("glDrawArraysInstancedARB");
|
||||
if(!glDrawArraysInstanced)
|
||||
{
|
||||
qDebug()<<"glDrawArraysInstancedARB : extension not found. Wireframe mode will be forced.";
|
||||
extension_is_found = false;
|
||||
}
|
||||
else
|
||||
extension_is_found = true;
|
||||
|
||||
glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORARBPROC)ui->viewer->context()->getProcAddress("glVertexAttribDivisorARB");
|
||||
if(!glDrawArraysInstanced)
|
||||
{
|
||||
qDebug()<<"glVertexAttribDivisorARB : extension not found. Wireframe mode will be forced.";
|
||||
extension_is_found = false;
|
||||
}
|
||||
else
|
||||
extension_is_found = true;
|
||||
|
||||
wireframe = !extension_is_found;
|
||||
// camera
|
||||
// only 2.7 gets an 'f' as VC++ warns if we don't
|
||||
ui->viewer->camera()->setPosition(Vec(0.5,0.5,2.7f));
|
||||
|
|
@ -753,6 +780,7 @@ void Scene::init() {
|
|||
|
||||
// Draws the triangulation
|
||||
void Scene::draw() {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
if(!are_buffers_initialized)
|
||||
initialize_buffers();
|
||||
gl_draw_location();
|
||||
|
|
@ -971,8 +999,11 @@ void Scene::update_position()
|
|||
rendering_program_spheres.enableAttributeArray(centerLocation[0]);
|
||||
rendering_program_spheres.setAttributeBuffer(centerLocation[0],GL_FLOAT,0,3);
|
||||
buffers[5].release();
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[0],1);
|
||||
glVertexAttribDivisor(normalsLocation[1],0);
|
||||
}
|
||||
vao[7].release();
|
||||
|
||||
ui->viewer->update();
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@
|
|||
#include <fstream>
|
||||
#include <QObject>
|
||||
#include <QFileDialog>
|
||||
#include <QOpenGLFunctions_3_3_Core>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QOpenGLBuffer>
|
||||
#include <QOpenGLShaderProgram>
|
||||
|
||||
class Scene : public QObject, QOpenGLFunctions_3_3_Core
|
||||
class Scene : public QObject, QOpenGLFunctions_2_1
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ public Q_SLOTS:
|
|||
ui->viewer->update();
|
||||
}
|
||||
void toggle_wireframe(bool on) {
|
||||
wireframe = on;
|
||||
wireframe = !(!on && extension_is_found);
|
||||
( on ? glDisable(GL_LIGHTING) : glEnable(GL_LIGHTING) );
|
||||
changed();
|
||||
}
|
||||
|
|
@ -287,11 +287,16 @@ private:
|
|||
std::vector<float> transfo4_square;
|
||||
|
||||
bool are_buffers_initialized;
|
||||
bool extension_is_found;
|
||||
QOpenGLBuffer buffers[24];
|
||||
QOpenGLVertexArrayObject vao[12];
|
||||
QOpenGLShaderProgram rendering_program;
|
||||
QOpenGLShaderProgram rendering_program_spheres;
|
||||
QOpenGLShaderProgram rendering_program_cylinders;
|
||||
typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
|
||||
PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced;
|
||||
PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor;
|
||||
void initialize_buffers();
|
||||
void compute_elements();
|
||||
void attrib_buffers(QGLViewer*);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ Viewer::sceneChanged()
|
|||
void
|
||||
Viewer::draw()
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
if(!are_buffers_initialized)
|
||||
initialize_buffers();
|
||||
QColor color;
|
||||
|
|
@ -265,8 +266,8 @@ void Viewer::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
|
|
@ -276,7 +277,7 @@ void Viewer::compile_shaders()
|
|||
//Fragment source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"#version 120 \n"
|
||||
"uniform highp vec4 color; \n"
|
||||
"void main(void) { \n"
|
||||
"gl_FragColor = color; \n"
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
#include "Scene.h"
|
||||
#include <QGLViewer/qglviewer.h>
|
||||
#include <QOpenGLFunctions_3_3_Core>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QOpenGLBuffer>
|
||||
#include <QOpenGLShaderProgram>
|
||||
#include <CGAL/Qt/CreateOpenGLContext.h>
|
||||
|
||||
|
||||
class Viewer : public QGLViewer, QOpenGLFunctions_3_3_Core {
|
||||
class Viewer : public QGLViewer, QOpenGLFunctions_2_1 {
|
||||
|
||||
typedef qglviewer::Vec Vec;
|
||||
|
||||
|
|
|
|||
|
|
@ -2175,6 +2175,7 @@ Periodic_3_triangulation_3<GT,TDS>::periodic_insert(
|
|||
|
||||
// This only holds for Delaunay
|
||||
CGAL_triangulation_assertion(lt != VERTEX);
|
||||
CGAL_USE(lt);
|
||||
|
||||
// Choose the periodic copy of tester.point() that is inside c.
|
||||
Offset current_off = get_location_offset(tester, c);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <QGLViewer/qglviewer.h>
|
||||
#include <QWidget>
|
||||
#include <QPoint>
|
||||
#include <QOpenGLFunctions_3_3_Core>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
#include <CGAL/Qt/CreateOpenGLContext.h>
|
||||
// forward declarations
|
||||
class QWidget;
|
||||
|
|
@ -14,7 +14,7 @@ class QKeyEvent;
|
|||
|
||||
#include "../Viewer_config.h" // for VIEWER_EXPORT
|
||||
|
||||
class VIEWER_EXPORT Viewer_interface : public QGLViewer, public QOpenGLFunctions_3_3_Core {
|
||||
class VIEWER_EXPORT Viewer_interface : public QGLViewer, public QOpenGLFunctions_2_1 {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
|
|
@ -30,6 +30,11 @@ public:
|
|||
static QString dumpFrame(const qglviewer::Frame&);
|
||||
|
||||
virtual bool inFastDrawing() const = 0;
|
||||
typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
|
||||
PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced;
|
||||
PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor;
|
||||
bool extension_is_found;
|
||||
GLfloat pickMatrix_[16];
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
@ -47,6 +52,7 @@ public Q_SLOTS:
|
|||
virtual QString dumpCameraCoordinates() = 0;
|
||||
virtual bool moveCameraToCoordinates(QString,
|
||||
float animation_duration = 0.5f) = 0;
|
||||
|
||||
}; // end class Viewer_interface
|
||||
|
||||
#endif // VIEWER_INTERFACE_H
|
||||
|
|
|
|||
|
|
@ -959,7 +959,7 @@ QList<int> MainWindow::getSelectedSceneItemIndices() const
|
|||
|
||||
void MainWindow::selectionChanged()
|
||||
{
|
||||
scene->setSelectedItem(getSelectedSceneItemIndex());
|
||||
scene->setSelectedItemIndex(getSelectedSceneItemIndex());
|
||||
scene->setSelectedItemsList(getSelectedSceneItemIndices());
|
||||
Scene_item* item = scene->item(getSelectedSceneItemIndex());
|
||||
if(item != NULL && item->manipulatable()) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>30.000000000000000</double>
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "Kernel_type.h"
|
||||
|
||||
#include <boost/function_output_iterator.hpp>
|
||||
#include <QMap>
|
||||
|
||||
// Class for visualizing holes in a polyhedron
|
||||
// provides mouse selection functionality
|
||||
|
|
@ -307,13 +308,7 @@ public:
|
|||
void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface* m);
|
||||
|
||||
Scene_hole_visualizer* get_hole_visualizer(Scene_polyhedron_item* poly_item) {
|
||||
// did not use a map to assoc Scene_polyhedron_item with Scene_hole_visualizer to prevent crowded code
|
||||
for(Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i) {
|
||||
Scene_hole_visualizer* hole_visualizer = qobject_cast<Scene_hole_visualizer*>(scene->item(i));
|
||||
if(hole_visualizer && hole_visualizer->poly_item == poly_item)
|
||||
{ return hole_visualizer; }
|
||||
}
|
||||
return NULL;
|
||||
return visualizers[poly_item];
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
|
|
@ -353,6 +348,9 @@ private:
|
|||
QDockWidget* dock_widget;
|
||||
Ui::HoleFilling ui_widget;
|
||||
|
||||
//Maintains a reference between all the visualizers and their poly_item
|
||||
// to ease the management of the visualizers
|
||||
QMap<Scene_polyhedron_item*, Scene_hole_visualizer*> visualizers;
|
||||
// hold created facet for accept reject functionality
|
||||
std::vector<Polyhedron::Facet_handle> new_facets;
|
||||
Scene_polyhedron_item* last_active_item; // always keep it NULL while not active-reject state
|
||||
|
|
@ -427,11 +425,18 @@ void Polyhedron_demo_hole_filling_plugin::item_about_to_be_destroyed(Scene_item*
|
|||
if(poly_item) {
|
||||
// erase assoc polylines item
|
||||
scene->erase( scene->item_id( get_hole_visualizer(poly_item) ) );
|
||||
visualizers.remove(poly_item);
|
||||
// close accept-reject dialog if it is open
|
||||
if(last_active_item == poly_item) {
|
||||
on_Accept_button();
|
||||
}
|
||||
}
|
||||
else {
|
||||
Scene_hole_visualizer* visu_item = qobject_cast<Scene_hole_visualizer*>(scene_item);
|
||||
if(visu_item) {
|
||||
visualizers.remove(visu_item->poly_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
// removes Scene_hole_visualizer items
|
||||
void Polyhedron_demo_hole_filling_plugin::dock_widget_closed() {
|
||||
|
|
@ -460,10 +465,12 @@ void Polyhedron_demo_hole_filling_plugin::on_Visualize_holes_button() {
|
|||
}
|
||||
|
||||
Scene_hole_visualizer* hole_visualizer = new Scene_hole_visualizer(poly_item, mw);
|
||||
visualizers[poly_item] = hole_visualizer;
|
||||
connect(hole_visualizer, SIGNAL(itemChanged()), this, SLOT(hole_visualizer_changed()));
|
||||
|
||||
if(hole_visualizer->polyline_data_list.empty()) {
|
||||
print_message("There is no hole in selected polyhedron item!");
|
||||
visualizers.remove(poly_item);
|
||||
delete hole_visualizer;
|
||||
return;
|
||||
}
|
||||
|
|
@ -590,6 +597,7 @@ void Polyhedron_demo_hole_filling_plugin::hole_visualizer_changed() {
|
|||
Scene_hole_visualizer* hole_visualizer = qobject_cast<Scene_hole_visualizer*>(this->sender());
|
||||
if(hole_visualizer && hole_visualizer->polyline_data_list.empty()) {
|
||||
scene->erase( scene->item_id(hole_visualizer));
|
||||
visualizers.remove(hole_visualizer->poly_item);
|
||||
}
|
||||
}
|
||||
// helper function for filling holes
|
||||
|
|
|
|||
|
|
@ -155,6 +155,9 @@ public:
|
|||
connect(ui->pushButton_segment, SIGNAL(clicked()),
|
||||
this, SLOT(on_actionSegment()));
|
||||
|
||||
QObject* scene_object = dynamic_cast<QObject*>(scene);
|
||||
connect(scene_object, SIGNAL(itemAboutToBeDestroyed(Scene_item*)),
|
||||
this, SLOT(on_actionItemAboutToBeDestroyed(Scene_item*)));
|
||||
}
|
||||
|
||||
QList<QAction*> actions() const {
|
||||
|
|
@ -719,10 +722,6 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionRun()
|
|||
delete temp;
|
||||
}
|
||||
|
||||
QObject* scene_object = dynamic_cast<QObject*>(scene);
|
||||
connect(scene_object, SIGNAL(itemAboutToBeDestroyed(Scene_item*)),
|
||||
this, SLOT(on_actionItemAboutToBeDestroyed(Scene_item*)));
|
||||
|
||||
//#define DRAW_NON_FIXED_POINTS
|
||||
#ifdef DRAW_NON_FIXED_POINTS
|
||||
// draw non-fixed points
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
#include "Polyhedron_demo_io_plugin_interface.h"
|
||||
#include <fstream>
|
||||
|
||||
#include <CGAL/IO/File_scanner_OFF.h>
|
||||
#include <QMessageBox>
|
||||
|
||||
class Polyhedron_demo_off_plugin :
|
||||
public QObject,
|
||||
public Polyhedron_demo_io_plugin_interface
|
||||
|
|
@ -38,6 +41,11 @@ Polyhedron_demo_off_plugin::load(QFileInfo fileinfo) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// to detect isolated vertices
|
||||
CGAL::File_scanner_OFF scanner( in, false);
|
||||
std::size_t total_nb_of_vertices = scanner.size_of_vertices();
|
||||
in.seekg(0);
|
||||
|
||||
// Try to read .off in a polyhedron
|
||||
Scene_polyhedron_item* item = new Scene_polyhedron_item();
|
||||
item->setName(fileinfo.baseName());
|
||||
|
|
@ -56,6 +64,14 @@ Polyhedron_demo_off_plugin::load(QFileInfo fileinfo) {
|
|||
}
|
||||
return soup_item;
|
||||
}
|
||||
else
|
||||
if( total_nb_of_vertices!= item->polyhedron()->size_of_vertices())
|
||||
{
|
||||
QMessageBox::warning((QWidget*)NULL,
|
||||
tr("Isolated vertices found"),
|
||||
tr("%1 isolated vertices ignored")
|
||||
.arg(total_nb_of_vertices-item->polyhedron()->size_of_vertices()));
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@ void Polyhedron_demo_polyhedron_slicer_plugin::on_Generate_button_clicked()
|
|||
get_base_1_2(bases); // no need to check since we call on_Update_plane_button_clicked
|
||||
Epic_kernel::Vector_3 base_1(bases[0], bases[1], bases[2]);
|
||||
Epic_kernel::Vector_3 base_2(bases[3], bases[4], bases[5]);
|
||||
const Epic_kernel::Vector_3 normal = CGAL::cross_product(base_1, base_2);
|
||||
|
||||
// get distance between planes
|
||||
bool to_double_ok = true;
|
||||
|
|
@ -255,7 +256,7 @@ void Polyhedron_demo_polyhedron_slicer_plugin::on_Generate_button_clicked()
|
|||
|
||||
//Epic_kernel::Plane_3 plane(n[0], n[1], n[2], - n * new_pos);
|
||||
Epic_kernel::Point_3 new_pos_cgal(new_pos[0], new_pos[1], new_pos[2]);
|
||||
Epic_kernel::Plane_3 plane(new_pos_cgal, new_pos_cgal + base_1, new_pos_cgal + base_2);
|
||||
Epic_kernel::Plane_3 plane(new_pos_cgal, normal);
|
||||
|
||||
if(!CGAL::do_intersect(cgal_bbox, plane)) {
|
||||
if(dir == -1) { break; }
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ Scene::draw_aux(bool with_names, Viewer_interface* viewer)
|
|||
::glPopName();
|
||||
}
|
||||
}
|
||||
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
// Wireframe OpenGL drawing
|
||||
for(int index = 0; index < m_entries.size(); ++index)
|
||||
{
|
||||
|
|
@ -353,6 +353,7 @@ Scene::draw_aux(bool with_names, Viewer_interface* viewer)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Points OpenGL drawing
|
||||
for(int index = 0; index < m_entries.size(); ++index)
|
||||
{
|
||||
|
|
@ -381,6 +382,8 @@ Scene::draw_aux(bool with_names, Viewer_interface* viewer)
|
|||
::glPopName();
|
||||
}
|
||||
}
|
||||
glDepthFunc(GL_LESS);
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -115,6 +115,11 @@ public Q_SLOTS:
|
|||
void itemChanged(int i);
|
||||
void itemChanged(Scene_item*);
|
||||
|
||||
void setSelectedItemIndex(int i)
|
||||
{
|
||||
selected_item = i;
|
||||
}
|
||||
|
||||
void setSelectedItem(int i )
|
||||
{
|
||||
selected_item = i;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ Scene_edit_polyhedron_item::Scene_edit_polyhedron_item
|
|||
|
||||
const char vertex_shader_source_bbox[] =
|
||||
{
|
||||
|
||||
"#version 120 \n"
|
||||
"attribute highp vec3 vertex; \n"
|
||||
"attribute highp vec3 colors; \n"
|
||||
|
||||
|
|
@ -92,6 +92,7 @@ Scene_edit_polyhedron_item::Scene_edit_polyhedron_item
|
|||
};
|
||||
const char fragment_shader_source[]=
|
||||
{
|
||||
"#version 120 \n"
|
||||
"varying vec3 fColors; \n"
|
||||
" \n"
|
||||
"void main(void) \n"
|
||||
|
|
@ -214,8 +215,11 @@ void Scene_edit_polyhedron_item::initialize_buffers(Viewer_interface *viewer =0)
|
|||
program->setAttributeBuffer("center",GL_DOUBLE,0,3);
|
||||
buffers[8].release();
|
||||
|
||||
if(viewer->extension_is_found)
|
||||
{
|
||||
viewer->glVertexAttribDivisor(program->attributeLocation("center"), 1);
|
||||
viewer->glVertexAttribDivisor(program->attributeLocation("colors"), 1);
|
||||
}
|
||||
vaos[3]->release();
|
||||
}
|
||||
//vao for the BBOX
|
||||
|
|
@ -292,8 +296,11 @@ void Scene_edit_polyhedron_item::initialize_buffers(Viewer_interface *viewer =0)
|
|||
program->setAttributeBuffer("center",GL_DOUBLE,0,3);
|
||||
buffers[16].release();
|
||||
|
||||
if(viewer->extension_is_found)
|
||||
{
|
||||
viewer->glVertexAttribDivisor(program->attributeLocation("center"), 1);
|
||||
viewer->glVertexAttribDivisor(program->attributeLocation("colors"), 1);
|
||||
}
|
||||
vaos[6]->release();
|
||||
}
|
||||
//vao for the axis
|
||||
|
|
@ -501,7 +508,7 @@ void Scene_edit_polyhedron_item::draw_ROI_and_control_vertices(Viewer_interface*
|
|||
color.set_rgb_color(0, 1.f, 0);
|
||||
if(ui_widget->ShowROICheckBox->isChecked()) {
|
||||
|
||||
if(!ui_widget->ShowAsSphereCheckBox->isChecked()) {
|
||||
if(!ui_widget->ShowAsSphereCheckBox->isChecked() || !viewer->extension_is_found) {
|
||||
|
||||
vaos[1]->bind();
|
||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||
|
|
@ -524,7 +531,7 @@ void Scene_edit_polyhedron_item::draw_ROI_and_control_vertices(Viewer_interface*
|
|||
}
|
||||
}
|
||||
|
||||
if(!ui_widget->ShowAsSphereCheckBox->isChecked()) {
|
||||
if(!ui_widget->ShowAsSphereCheckBox->isChecked() || !viewer->extension_is_found) {
|
||||
vaos[5]->bind();
|
||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||
attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ Scene_polylines_item::initialize_buffers(Viewer_interface *viewer = 0) const
|
|||
program->release();
|
||||
}
|
||||
//vao for the spheres
|
||||
{
|
||||
if(viewer->extension_is_found)
|
||||
{
|
||||
program = getShaderProgram(PROGRAM_INSTANCED, viewer);
|
||||
program->bind();
|
||||
|
|
@ -85,12 +87,35 @@ Scene_polylines_item::initialize_buffers(Viewer_interface *viewer = 0) const
|
|||
|
||||
viewer->glVertexAttribDivisor(program->attributeLocation("center"), 1);
|
||||
viewer->glVertexAttribDivisor(program->attributeLocation("colors"), 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
|
||||
program->bind();
|
||||
|
||||
vaos[1]->bind();
|
||||
buffers[1].bind();
|
||||
buffers[1].allocate(positions_center.data(),
|
||||
static_cast<int>(positions_center.size()*sizeof(float)));
|
||||
program->enableAttributeArray("vertex");
|
||||
program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
|
||||
buffers[1].release();
|
||||
|
||||
buffers[2].bind();
|
||||
buffers[2].allocate(color_spheres.data(),
|
||||
static_cast<int>(color_spheres.size()*sizeof(float)));
|
||||
program->enableAttributeArray("colors");
|
||||
program->setAttributeBuffer("colors",GL_FLOAT,0,3);
|
||||
buffers[2].release();
|
||||
}
|
||||
vaos[1]->release();
|
||||
|
||||
program->release();
|
||||
}
|
||||
|
||||
//vao for the wired spheres
|
||||
{
|
||||
if(viewer->extension_is_found)
|
||||
{
|
||||
program = getShaderProgram(PROGRAM_INSTANCED_WIRE, viewer);
|
||||
program->bind();
|
||||
|
|
@ -102,10 +127,17 @@ Scene_polylines_item::initialize_buffers(Viewer_interface *viewer = 0) const
|
|||
program->enableAttributeArray("vertex");
|
||||
program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
|
||||
buffers[5].release();
|
||||
QColor temp = this->color();
|
||||
program->setAttributeValue("colors", temp);
|
||||
|
||||
program->setAttributeValue("normals",QVector3D(0.0,0.0,0.0));
|
||||
|
||||
buffers[3].bind();
|
||||
program->enableAttributeArray("colors");
|
||||
program->setAttributeBuffer("colors",GL_FLOAT,0,3);
|
||||
buffers[3].release();
|
||||
|
||||
buffers[2].bind();
|
||||
program->enableAttributeArray("normals");
|
||||
program->setAttributeBuffer("normals",GL_FLOAT,0,3);
|
||||
buffers[2].release();
|
||||
|
||||
buffers[6].bind();
|
||||
buffers[6].allocate(color_spheres.data(),
|
||||
|
|
@ -121,11 +153,14 @@ Scene_polylines_item::initialize_buffers(Viewer_interface *viewer = 0) const
|
|||
program->setAttributeBuffer("center",GL_FLOAT,0,3);
|
||||
buffers[7].release();
|
||||
|
||||
|
||||
viewer->glVertexAttribDivisor(program->attributeLocation("center"), 1);
|
||||
viewer->glVertexAttribDivisor(program->attributeLocation("colors"), 1);
|
||||
|
||||
vaos[2]->release();
|
||||
program->release();
|
||||
}
|
||||
}
|
||||
|
||||
are_buffers_filled = true;
|
||||
|
||||
|
|
@ -283,7 +318,7 @@ Scene_polylines_item::Scene_polylines_item()
|
|||
,d(new Scene_polylines_item_private())
|
||||
,nbSpheres(0)
|
||||
{
|
||||
setRenderingMode(Flat);
|
||||
setRenderingMode(FlatPlusEdges);
|
||||
changed();
|
||||
|
||||
}
|
||||
|
|
@ -363,8 +398,7 @@ Scene_polylines_item::toolTip() const {
|
|||
bool
|
||||
Scene_polylines_item::supportsRenderingMode(RenderingMode m) const {
|
||||
return (m == Wireframe ||
|
||||
m == Flat ||
|
||||
m == Flat ||
|
||||
m == FlatPlusEdges ||
|
||||
m == Points);
|
||||
}
|
||||
|
||||
|
|
@ -375,6 +409,8 @@ Scene_polylines_item::draw(Viewer_interface* viewer) const {
|
|||
if(!are_buffers_filled)
|
||||
initialize_buffers(viewer);
|
||||
if(d->draw_extremities)
|
||||
{
|
||||
if(viewer->extension_is_found)
|
||||
{
|
||||
vaos[1]->bind();
|
||||
program = getShaderProgram(PROGRAM_INSTANCED);
|
||||
|
|
@ -385,17 +421,19 @@ Scene_polylines_item::draw(Viewer_interface* viewer) const {
|
|||
program->release();
|
||||
vaos[1]->release();
|
||||
}
|
||||
if(renderingMode() == Flat)
|
||||
else
|
||||
{
|
||||
vaos[0]->bind();
|
||||
attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
||||
vaos[1]->bind();
|
||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||
attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
||||
glPointSize(8.0f);
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
program->bind();
|
||||
QColor temp = this->color();
|
||||
program->setAttributeValue("colors", temp);
|
||||
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/4));
|
||||
viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(positions_center.size()/3));
|
||||
glDisable(GL_POINT_SMOOTH);
|
||||
program->release();
|
||||
vaos[0]->release();
|
||||
vaos[1]->release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -409,12 +447,13 @@ Scene_polylines_item::draw_edges(Viewer_interface* viewer) const {
|
|||
attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||
program->bind();
|
||||
QColor temp = this->color();
|
||||
program->setAttributeValue("colors", temp);
|
||||
program->setAttributeValue("colors", this->color());
|
||||
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/4));
|
||||
program->release();
|
||||
vaos[0]->release();
|
||||
if(d->draw_extremities)
|
||||
{
|
||||
if(viewer->extension_is_found)
|
||||
{
|
||||
vaos[2]->bind();
|
||||
attrib_buffers(viewer, PROGRAM_INSTANCED_WIRE);
|
||||
|
|
@ -425,6 +464,7 @@ Scene_polylines_item::draw_edges(Viewer_interface* viewer) const {
|
|||
program->release();
|
||||
vaos[2]->release();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,6 +105,25 @@ void Viewer::initializeGL()
|
|||
{
|
||||
QGLViewer::initializeGL();
|
||||
initializeOpenGLFunctions();
|
||||
glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDARBPROC)this->context()->getProcAddress("glDrawArraysInstancedARB");
|
||||
if(!glDrawArraysInstanced)
|
||||
{
|
||||
qDebug()<<"glDrawArraysInstancedARB : extension not found. Spheres will be displayed as points.";
|
||||
extension_is_found = false;
|
||||
}
|
||||
else
|
||||
extension_is_found = true;
|
||||
|
||||
glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORARBPROC)this->context()->getProcAddress("glVertexAttribDivisorARB");
|
||||
if(!glDrawArraysInstanced)
|
||||
{
|
||||
qDebug()<<"glVertexAttribDivisorARB : extension not found. Spheres will be displayed as points.";
|
||||
extension_is_found = false;
|
||||
}
|
||||
else
|
||||
extension_is_found = true;
|
||||
|
||||
|
||||
setBackgroundColor(::Qt::white);
|
||||
d->scene->initializeGL();
|
||||
|
||||
|
|
@ -202,6 +221,8 @@ void Viewer_impl::draw_aux(bool with_names, Viewer* viewer)
|
|||
scene->drawWithNames(viewer);
|
||||
else
|
||||
scene->draw(viewer);
|
||||
::glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
||||
}
|
||||
|
||||
void Viewer::drawWithNames()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 330
|
||||
#version 120
|
||||
attribute highp vec4 vertex;
|
||||
attribute highp vec3 normals;
|
||||
attribute highp vec3 colors;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 330
|
||||
#version 120
|
||||
varying highp vec4 color;
|
||||
varying highp vec4 fP;
|
||||
varying highp vec3 fN;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 330
|
||||
#version 120
|
||||
attribute highp vec4 vertex;
|
||||
attribute highp vec3 normals;
|
||||
attribute highp vec3 colors;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 330
|
||||
#version 120
|
||||
varying highp vec3 fColors;
|
||||
varying highp vec2 f_texCoord;
|
||||
uniform sampler2D s_texture;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 330
|
||||
#version 120
|
||||
attribute highp vec4 vertex;
|
||||
attribute highp vec3 normal;
|
||||
attribute highp vec3 color_facets;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 330
|
||||
#version 120
|
||||
varying highp vec3 fColors;
|
||||
varying highp vec2 f_texCoord;
|
||||
uniform highp sampler2D s_texture;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 330
|
||||
#version 120
|
||||
attribute highp vec4 vertex;
|
||||
attribute highp vec2 v_texCoord;
|
||||
uniform highp vec3 color_lines;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 330
|
||||
#version 120
|
||||
varying highp vec4 color;
|
||||
void main(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#version 330
|
||||
attribute highp vec4 vertex;
|
||||
attribute highp vec3 colors;
|
||||
uniform highp mat4 mvp_matrix;
|
||||
uniform highp mat4 f_matrix;
|
||||
varying highp vec4 color;
|
||||
void main(void)
|
||||
{
|
||||
#version 120
|
||||
attribute highp vec4 vertex;
|
||||
attribute highp vec3 colors;
|
||||
uniform highp mat4 mvp_matrix;
|
||||
uniform highp mat4 f_matrix;
|
||||
varying highp vec4 color;
|
||||
void main(void)
|
||||
{
|
||||
color = vec4(colors, 1.0);
|
||||
gl_Position = mvp_matrix * f_matrix * vertex;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,25 @@ using namespace std;
|
|||
void Viewer::init()
|
||||
{
|
||||
initializeOpenGLFunctions();
|
||||
glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDARBPROC)this->context()->getProcAddress("glDrawArraysInstancedARB");
|
||||
if(!glDrawArraysInstanced)
|
||||
{
|
||||
qDebug()<<"glDrawArraysInstancedARB : extension not found. Spheres will be displayed as points.";
|
||||
extension_is_found = false;
|
||||
}
|
||||
else
|
||||
extension_is_found = true;
|
||||
|
||||
glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORARBPROC)this->context()->getProcAddress("glVertexAttribDivisorARB");
|
||||
if(!glDrawArraysInstanced)
|
||||
{
|
||||
qDebug()<<"glVertexAttribDivisorARB : extension not found. Spheres will be displayed as points.";
|
||||
extension_is_found = false;
|
||||
}
|
||||
else
|
||||
extension_is_found = true;
|
||||
// extension_is_found = false;
|
||||
|
||||
/* Initial timer for playing incremental construction */
|
||||
m_pTimer = new QTimer(this);
|
||||
connect(m_pTimer, SIGNAL(timeout()), this, SLOT(incremental_insert()));
|
||||
|
|
@ -162,8 +181,8 @@ void Viewer::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
|
|
@ -173,7 +192,7 @@ void Viewer::compile_shaders()
|
|||
//Fragment source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"#version 120 \n"
|
||||
"uniform highp vec4 color; \n"
|
||||
"void main(void) { \n"
|
||||
"gl_FragColor = color; \n"
|
||||
|
|
@ -210,15 +229,15 @@ void Viewer::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source_spheres[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"in highp vec3 normal;\n"
|
||||
"in highp vec4 center;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec3 normal;\n"
|
||||
"attribute highp vec4 center;\n"
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 mv_matrix; \n"
|
||||
"out highp vec4 fP; \n"
|
||||
"out highp vec3 fN; \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" fP = mv_matrix * vertex; \n"
|
||||
|
|
@ -229,9 +248,9 @@ void Viewer::compile_shaders()
|
|||
//Fragment source code
|
||||
const char fragment_source_spheres[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 fP; \n"
|
||||
"in highp vec3 fN; \n"
|
||||
"#version 120 \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"uniform vec4 color; \n"
|
||||
"uniform highp vec4 light_pos; \n"
|
||||
"uniform highp vec4 light_diff; \n"
|
||||
|
|
@ -288,18 +307,18 @@ void Viewer::compile_shaders()
|
|||
//Vertex source code
|
||||
const char vertex_source_cylinders[] =
|
||||
{
|
||||
"#version 330 \n"
|
||||
"in highp vec4 vertex;\n"
|
||||
"in highp vec3 normal;\n"
|
||||
"in highp vec4 transfo1;\n"
|
||||
"in highp vec4 transfo2;\n"
|
||||
"in highp vec4 transfo3;\n"
|
||||
"in highp vec4 transfo4;\n"
|
||||
"#version 120 \n"
|
||||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec3 normal;\n"
|
||||
"attribute highp vec4 transfo1;\n"
|
||||
"attribute highp vec4 transfo2;\n"
|
||||
"attribute highp vec4 transfo3;\n"
|
||||
"attribute highp vec4 transfo4;\n"
|
||||
"mat4 transfo = mat4(transfo1, transfo2, transfo3, transfo4); \n"
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 mv_matrix; \n"
|
||||
"out highp vec4 fP; \n"
|
||||
"out highp vec3 fN; \n"
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" fP = mv_matrix * vertex; \n"
|
||||
|
|
@ -714,19 +733,24 @@ void Viewer::initialize_buffers()
|
|||
rendering_program_spheres.setAttributeBuffer(poly_vertexLocation[1],GL_FLOAT,0,3);
|
||||
buffers[13].release();
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[0],1);
|
||||
glVertexAttribDivisor(normalsLocation[0],0);
|
||||
}
|
||||
vao[11].release();
|
||||
|
||||
//Empty Sphere
|
||||
vao[12].bind();
|
||||
if(extension_is_found)
|
||||
{
|
||||
buffers[14].bind();
|
||||
buffers[14].allocate(pos_emptySphere->data(), pos_emptySphere->size()*sizeof(float));
|
||||
centerLocation[0] = rendering_program_spheres.attributeLocation("center");
|
||||
rendering_program_spheres.enableAttributeArray(centerLocation[0]);
|
||||
rendering_program_spheres.setAttributeBuffer(centerLocation[0],GL_FLOAT,0,3);
|
||||
buffers[14].release();
|
||||
|
||||
}
|
||||
buffers[32].bind();
|
||||
buffers[32].allocate(normals_emptySphere->data(), normals_emptySphere->size()*sizeof(float));
|
||||
normalsLocation[0] = rendering_program_spheres.attributeLocation("normal");
|
||||
|
|
@ -741,8 +765,11 @@ void Viewer::initialize_buffers()
|
|||
rendering_program_spheres.setAttributeBuffer(poly_vertexLocation[1],GL_FLOAT,0,3);
|
||||
buffers[16].release();
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[0],1);
|
||||
glVertexAttribDivisor(normalsLocation[0],0);
|
||||
}
|
||||
vao[12].release();
|
||||
|
||||
//Vertex Sphere
|
||||
|
|
@ -767,8 +794,11 @@ void Viewer::initialize_buffers()
|
|||
rendering_program_spheres.setAttributeBuffer(poly_vertexLocation[1],GL_FLOAT,0,3);
|
||||
buffers[17].release();
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[0],1);
|
||||
glVertexAttribDivisor(normalsLocation[0],0);
|
||||
}
|
||||
vao[13].release();
|
||||
|
||||
//New point Sphere
|
||||
|
|
@ -791,8 +821,11 @@ void Viewer::initialize_buffers()
|
|||
rendering_program_spheres.setAttributeBuffer(poly_vertexLocation[1],GL_FLOAT,0,3);
|
||||
buffers[17].release();
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[0],1);
|
||||
glVertexAttribDivisor(normalsLocation[0],0);
|
||||
}
|
||||
vao[14].release();
|
||||
|
||||
//Selected point Sphere
|
||||
|
|
@ -815,8 +848,11 @@ void Viewer::initialize_buffers()
|
|||
rendering_program_spheres.setAttributeBuffer(poly_vertexLocation[1],GL_FLOAT,0,3);
|
||||
buffers[17].release();
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[0],1);
|
||||
glVertexAttribDivisor(normalsLocation[0],0);
|
||||
}
|
||||
vao[15].release();
|
||||
|
||||
//Moving point Sphere
|
||||
|
|
@ -839,8 +875,11 @@ void Viewer::initialize_buffers()
|
|||
rendering_program_spheres.setAttributeBuffer(poly_vertexLocation[1],GL_FLOAT,0,3);
|
||||
buffers[17].release();
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[0],1);
|
||||
glVertexAttribDivisor(normalsLocation[0],0);
|
||||
}
|
||||
vao[16].release();
|
||||
|
||||
//Querry point Sphere
|
||||
|
|
@ -863,8 +902,11 @@ void Viewer::initialize_buffers()
|
|||
rendering_program_spheres.setAttributeBuffer(poly_vertexLocation[1],GL_FLOAT,0,3);
|
||||
buffers[17].release();
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[0],1);
|
||||
glVertexAttribDivisor(normalsLocation[0],0);
|
||||
}
|
||||
vao[17].release();
|
||||
|
||||
//Nearest neighbor Sphere
|
||||
|
|
@ -887,8 +929,11 @@ void Viewer::initialize_buffers()
|
|||
rendering_program_spheres.setAttributeBuffer(poly_vertexLocation[1],GL_FLOAT,0,3);
|
||||
buffers[17].release();
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[0],1);
|
||||
glVertexAttribDivisor(normalsLocation[0],0);
|
||||
}
|
||||
vao[18].release();
|
||||
|
||||
//incremental list
|
||||
|
|
@ -910,8 +955,11 @@ void Viewer::initialize_buffers()
|
|||
rendering_program_spheres.setAttributeBuffer(poly_vertexLocation[1],GL_FLOAT,0,3);
|
||||
buffers[17].release();
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[0],1);
|
||||
glVertexAttribDivisor(normalsLocation[0],0);
|
||||
}
|
||||
vao[25].release();
|
||||
|
||||
//incremental next point
|
||||
|
|
@ -933,8 +981,11 @@ void Viewer::initialize_buffers()
|
|||
rendering_program_spheres.setAttributeBuffer(poly_vertexLocation[1],GL_FLOAT,0,3);
|
||||
buffers[17].release();
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[0],1);
|
||||
glVertexAttribDivisor(normalsLocation[0],0);
|
||||
}
|
||||
vao[26].release();
|
||||
|
||||
}
|
||||
|
|
@ -985,12 +1036,14 @@ void Viewer::initialize_buffers()
|
|||
rendering_program_cylinders.setAttributeBuffer(centerLocation[4],GL_FLOAT,0,4);
|
||||
buffers[23].release();
|
||||
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[1],1);
|
||||
glVertexAttribDivisor(centerLocation[2],1);
|
||||
glVertexAttribDivisor(centerLocation[3],1);
|
||||
glVertexAttribDivisor(centerLocation[4],1);
|
||||
glVertexAttribDivisor(normalsLocation[1],0);
|
||||
}
|
||||
|
||||
vao[19].release();
|
||||
|
||||
|
|
@ -1035,13 +1088,14 @@ void Viewer::initialize_buffers()
|
|||
rendering_program_cylinders.enableAttributeArray(centerLocation[4]);
|
||||
rendering_program_cylinders.setAttributeBuffer(centerLocation[4],GL_FLOAT,0,4);
|
||||
buffers[27].release();
|
||||
|
||||
|
||||
if(extension_is_found)
|
||||
{
|
||||
glVertexAttribDivisor(centerLocation[1],1);
|
||||
glVertexAttribDivisor(centerLocation[2],1);
|
||||
glVertexAttribDivisor(centerLocation[3],1);
|
||||
glVertexAttribDivisor(centerLocation[4],1);
|
||||
glVertexAttribDivisor(normalsLocation[1],0);
|
||||
}
|
||||
|
||||
vao[20].release();
|
||||
}
|
||||
|
|
@ -1139,11 +1193,12 @@ void Viewer::attrib_buffers(QGLViewer* viewer)
|
|||
|
||||
void Viewer::draw()
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
if(!are_buffers_initialized)
|
||||
initialize_buffers();
|
||||
QFont fontPrompt("Arial", 8);
|
||||
attrib_buffers(this);
|
||||
if(m_isFlat)
|
||||
if(m_isFlat || !extension_is_found)
|
||||
{
|
||||
|
||||
if(m_showVertex)
|
||||
|
|
@ -1564,7 +1619,10 @@ void Viewer::draw()
|
|||
rendering_program_spheres.bind();
|
||||
vao[11].bind();
|
||||
rendering_program_spheres.setUniformValue(colorLocation[1], m_colorTrackball);
|
||||
if(extension_is_found)
|
||||
glDrawArraysInstanced(GL_TRIANGLES, 0, points_trackBall->size()/3, 1);
|
||||
else
|
||||
glDrawArrays(GL_TRIANGLES, 0, points_trackBall->size()/3);
|
||||
vao[11].release();
|
||||
rendering_program_spheres.release();
|
||||
}
|
||||
|
|
@ -1573,7 +1631,13 @@ void Viewer::draw()
|
|||
rendering_program_spheres.bind();
|
||||
vao[12].bind();
|
||||
rendering_program_spheres.setUniformValue(colorLocation[1], m_colorEmptySphere);
|
||||
if(extension_is_found)
|
||||
glDrawArraysInstanced(GL_TRIANGLES, 0, points_emptySphere->size()/3, pos_emptySphere->size()/3);
|
||||
else if(pos_emptySphere->size()>0)
|
||||
{
|
||||
rendering_program_spheres.setAttributeValue("center", QVector4D(pos_emptySphere->at(0), pos_emptySphere->at(1), pos_emptySphere->at(2), 1.0));
|
||||
glDrawArrays(GL_TRIANGLES, 0, points_emptySphere->size()/3);
|
||||
}
|
||||
vao[12].release();
|
||||
rendering_program_spheres.release();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include <QSettings>
|
||||
#include "PreferenceDlg.h"
|
||||
|
||||
#include <QOpenGLFunctions_3_3_Core>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QOpenGLBuffer>
|
||||
#include <QOpenGLShaderProgram>
|
||||
|
|
@ -18,7 +18,7 @@ using namespace qglviewer;
|
|||
|
||||
class MainWindow;
|
||||
|
||||
class Viewer : public QGLViewer, QOpenGLFunctions_3_3_Core {
|
||||
class Viewer : public QGLViewer, QOpenGLFunctions_2_1 {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
|
|
@ -345,6 +345,8 @@ private:
|
|||
int lightLocation[5*2];
|
||||
|
||||
bool are_buffers_initialized;
|
||||
bool extension_is_found;
|
||||
|
||||
std::vector<float> *pos_emptyFacet;
|
||||
std::vector<float> *pos_emptySphere;
|
||||
std::vector<float> *points_emptySphere;
|
||||
|
|
@ -385,6 +387,10 @@ private:
|
|||
QOpenGLShaderProgram rendering_program;
|
||||
QOpenGLShaderProgram rendering_program_spheres;
|
||||
QOpenGLShaderProgram rendering_program_cylinders;
|
||||
typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
|
||||
PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced;
|
||||
PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor;
|
||||
void initialize_buffers();
|
||||
void compute_elements();
|
||||
void attrib_buffers(QGLViewer*);
|
||||
|
|
|
|||
Loading…
Reference in New Issue