Use OpenGL 2.0 shaders for the layer height rendering.

Use OpenGL 2.0 shaders for the print path rendering for performance reasons.
This commit is contained in:
bubnikv 2017-03-20 12:05:20 +01:00
parent 56f845f3c1
commit 045de596e2
10 changed files with 403 additions and 324 deletions

View file

@ -189,10 +189,7 @@ public:
selected(false),
hover(false),
qverts_range(0, size_t(-1)),
tverts_range(0, size_t(-1)),
name_vertex_buffer(0),
name_normal_buffer(0),
name_index_buffer(0)
tverts_range(0, size_t(-1))
{
color[0] = r;
color[1] = g;
@ -238,12 +235,6 @@ public:
// Offset into qverts & tverts, or offsets into indices stored into an OpenGL name_index_buffer.
std::vector<size_t> offsets;
// OpenGL buffers for vertices and their normals.
int name_vertex_buffer;
int name_normal_buffer;
// OpenGL buffer of the indices.
int name_index_buffer;
int object_idx() const { return this->composite_id / 1000000; }
int volume_idx() const { return (this->composite_id / 1000) % 1000; }
int instance_idx() const { return this->composite_id % 1000; }
@ -296,8 +287,12 @@ public:
const std::vector<int> &instance_idxs,
const std::string &color_by,
const std::string &select_by,
const std::string &drag_by);
const std::string &drag_by,
bool use_VBOs);
// Render the volumes by OpenGL.
void render_VBOs() const;
void render_legacy() const;
// Release the geometry data assigned to the volumes.
// If OpenGL VBOs were allocated, an OpenGL context has to be active to release them.
void release_geometry() { for (auto *v : volumes) v->release_geometry(); }