mirror of https://github.com/CGAL/cgal
Fix basic_viewer
This commit is contained in:
parent
09d7625e67
commit
b68f63e508
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <CGAL/Qt/qglviewer.h>
|
||||
#include <QKeyEvent>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QGLBuffer>
|
||||
#include <QOpenGLShaderProgram>
|
||||
|
|
@ -61,11 +61,14 @@ const char vertex_source_color[] =
|
|||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"varying highp vec4 fColor; \n"
|
||||
|
||||
"uniform highp float point_size; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" fP = mv_matrix * vertex; \n"
|
||||
" fN = mat3(mv_matrix)* normal; \n"
|
||||
" fColor = vec4(color, 1.0); \n"
|
||||
" gl_PointSize = point_size;\n"
|
||||
" gl_Position = mvp_matrix * vertex;\n"
|
||||
"}"
|
||||
};
|
||||
|
|
@ -107,8 +110,10 @@ const char vertex_source_p_l[] =
|
|||
"attribute highp vec3 color;\n"
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"varying highp vec4 fColor; \n"
|
||||
"uniform highp float point_size; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" gl_PointSize = point_size;\n"
|
||||
" fColor = vec4(color, 1.0); \n"
|
||||
" gl_Position = mvp_matrix * vertex;\n"
|
||||
"}"
|
||||
|
|
@ -627,7 +632,7 @@ protected:
|
|||
(double)m_vertices_mono_color.green()/(double)255,
|
||||
(double)m_vertices_mono_color.blue()/(double)255);
|
||||
rendering_program_p_l.setAttributeValue("color",color);
|
||||
glPointSize(m_size_points);
|
||||
rendering_program_p_l.setUniformValue("point_size", GLfloat(m_size_points));
|
||||
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(arrays[POS_MONO_POINTS].size()/3));
|
||||
vao[VAO_MONO_POINTS].release();
|
||||
|
||||
|
|
@ -644,7 +649,7 @@ protected:
|
|||
{
|
||||
rendering_program_p_l.enableAttributeArray("color");
|
||||
}
|
||||
glPointSize(m_size_points);
|
||||
rendering_program_p_l.setUniformValue("point_size", GLfloat(m_size_points));
|
||||
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(arrays[POS_COLORED_POINTS].size()/3));
|
||||
vao[VAO_COLORED_POINTS].release();
|
||||
|
||||
|
|
@ -747,14 +752,9 @@ protected:
|
|||
|
||||
// Light default parameters
|
||||
glLineWidth(m_size_edges);
|
||||
glPointSize(m_size_points);
|
||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(1.f,1.f);
|
||||
glClearColor(1.0f,1.0f,1.0f,0.0f);
|
||||
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
||||
glEnable(GL_LIGHTING);
|
||||
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
|
||||
glShadeModel(GL_FLAT);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
glDisable(GL_POLYGON_SMOOTH_HINT);
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ void CGAL::QGLViewer::initializeGL() {
|
|||
//Vertex source code
|
||||
const char v_s[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec4 vertex;\n"
|
||||
"uniform mat4 mvp_matrix;\n"
|
||||
"void main(void)\n"
|
||||
|
|
@ -279,7 +279,7 @@ void CGAL::QGLViewer::initializeGL() {
|
|||
//Fragment source code
|
||||
const char f_s[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"uniform vec4 color; \n"
|
||||
"out vec4 out_color; \n"
|
||||
"void main(void) { \n"
|
||||
|
|
@ -344,7 +344,7 @@ void CGAL::QGLViewer::initializeGL() {
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec4 vertex;\n"
|
||||
"in vec3 normal;\n"
|
||||
"in vec4 colors;\n"
|
||||
|
|
@ -390,7 +390,7 @@ void CGAL::QGLViewer::initializeGL() {
|
|||
//Fragment source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec4 color; \n"
|
||||
"in vec4 fP; \n"
|
||||
"in vec3 fN; \n"
|
||||
|
|
|
|||
|
|
@ -562,7 +562,7 @@ public:
|
|||
//Vertex source code
|
||||
const char tex_vertex_source[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec4 vertex;\n"
|
||||
"in vec2 tex_coord; \n"
|
||||
"uniform mat4 mvp_matrix;\n"
|
||||
|
|
@ -591,7 +591,7 @@ public:
|
|||
//Vertex source code
|
||||
const char tex_fragment_source[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"uniform sampler2D texture;\n"
|
||||
"in vec2 texc;\n"
|
||||
"out vec4 out_color; \n"
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ private:
|
|||
|
||||
template<typename T>
|
||||
const char* Volume_plane<T>::vertexShader_source =
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec4 vertex; \n"
|
||||
"in float color; \n"
|
||||
"uniform mat4 mvp_matrix; \n"
|
||||
|
|
@ -401,7 +401,7 @@ const char* Volume_plane<T>::vertexShader_source_comp =
|
|||
|
||||
template<typename T>
|
||||
const char* Volume_plane<T>::fragmentShader_source =
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec4 fullColor; \n"
|
||||
"out vec4 out_color; \n"
|
||||
"void main() { out_color = fullColor; } \n";
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ struct Scene_edit_box_item_priv{
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec4 vertex; "
|
||||
"in vec3 normals; "
|
||||
"in vec4 colors; "
|
||||
|
|
@ -268,7 +268,7 @@ struct Scene_edit_box_item_priv{
|
|||
//Fragment source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec4 color;"
|
||||
"in vec4 fP; "
|
||||
"in vec3 fN; "
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ Scene_alpha_shape_item::Scene_alpha_shape_item(Scene_points_with_normal_item *po
|
|||
}
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec4 vertex;\n"
|
||||
"in vec3 colors;\n"
|
||||
"uniform mat4 mvp_matrix;\n"
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ void Scene_edit_polyhedron_item_priv::init_values()
|
|||
|
||||
const char vertex_shader_source_bbox[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec3 vertex; \n"
|
||||
"in vec3 colors; \n"
|
||||
|
||||
|
|
@ -343,7 +343,7 @@ void Scene_edit_polyhedron_item_priv::init_values()
|
|||
};
|
||||
const char fragment_shader_source[]=
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec3 fColors; \n"
|
||||
"out vec4 out_color; \n"
|
||||
"void main(void) \n"
|
||||
|
|
@ -375,7 +375,7 @@ void Scene_edit_polyhedron_item_priv::init_values()
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec4 vertex; \n"
|
||||
"in vec4 colors; \n"
|
||||
"uniform mat4 mvp_matrix; \n"
|
||||
|
|
@ -453,7 +453,7 @@ void Scene_edit_polyhedron_item_priv::init_values()
|
|||
//Fragment source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec4 color; \n"
|
||||
"in float dist[6]; \n"
|
||||
"uniform bool is_clipbox_on; \n"
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer)
|
|||
//Vertex source code
|
||||
const char vertex_source[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec4 vertex; \n"
|
||||
"in vec2 v_texCoord; \n"
|
||||
"uniform mat4 projection_matrix; \n"
|
||||
|
|
@ -355,7 +355,7 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer)
|
|||
//Fragment source code
|
||||
const char fragment_source[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec2 f_texCoord; \n"
|
||||
"out vec4 out_color ; \n"
|
||||
"uniform sampler2D texture; \n"
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ void Viewer::init()
|
|||
//Vertex source code
|
||||
const char vertex_source_dist[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"in vec4 vertex;\n"
|
||||
"uniform mat4 mvp_matrix;\n"
|
||||
"uniform float point_size;\n"
|
||||
|
|
@ -282,7 +282,7 @@ void Viewer::init()
|
|||
//Fragment source code
|
||||
const char fragment_source_dist[] =
|
||||
{
|
||||
"#version 430 \n"
|
||||
"#version 430 core \n"
|
||||
"out vec4 out_color; \n"
|
||||
"void main(void) { \n"
|
||||
"out_color = vec4(0.0,0.0,0.0,1.0); \n"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 color;
|
||||
in vec4 fP;
|
||||
in vec3 fN;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 vertex;
|
||||
in vec3 normals;
|
||||
in vec3 colors;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 color;
|
||||
out vec4 out_color;
|
||||
void main(void)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 vertex;
|
||||
in vec3 colors;
|
||||
uniform mat4 mvp_matrix;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 vertex;
|
||||
in vec3 normals;
|
||||
in vec3 colors;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 vertex;
|
||||
in vec3 normals;
|
||||
in vec3 colors;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 color;
|
||||
in float dist[6];
|
||||
uniform bool is_clipbox_on;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 color;
|
||||
in vec4 fP;
|
||||
uniform vec4 light_pos;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 color;
|
||||
uniform vec3 dirView;
|
||||
uniform vec3 plane_normal;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 vertex;
|
||||
in vec3 normals;
|
||||
in vec3 colors;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 color;
|
||||
in vec4 fP;
|
||||
in vec3 fN;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 vertex;
|
||||
in vec3 normals;
|
||||
in vec4 colors;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec3 fColors;
|
||||
in vec2 f_texCoord;
|
||||
uniform sampler2D s_texture;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 vertex;
|
||||
in vec3 normal;
|
||||
in vec2 v_texCoord;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec3 fColors;
|
||||
in vec2 f_texCoord;
|
||||
uniform sampler2D s_texture;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 vertex;
|
||||
in vec2 v_texCoord;
|
||||
uniform vec3 color_lines;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 color;
|
||||
in float dist[6];
|
||||
uniform bool is_selected;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
in vec4 vertex;
|
||||
in vec3 colors;
|
||||
uniform mat4 mvp_matrix;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
|
||||
in GS_OUT
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 430
|
||||
#version 430 core
|
||||
|
||||
in vec4 vertex;
|
||||
in vec4 colors;
|
||||
|
|
|
|||
Loading…
Reference in New Issue