SimpleFastOpenAtomicVisualiser
Loading...
Searching...
No Matches
atomRenderer.h
Go to the documentation of this file.
1#ifndef ATOMRENDERER_H
2#define ATOMRENDERER_H
3
4#include <memory>
5#include <vector>
6#include <map>
7#include <utility>
8#include <algorithm>
9
10#include <jGL/OpenGL/gl.h>
11#include <jGL/OpenGL/Shader/glShader.h>
12
14
15#include <glUtils.h>
16#include <atom.h>
17#include <camera.h>
18
27{
28public:
29
42 (
43 const std::vector<Atom> & atoms,
44 uint8_t levelOfDetail = 0,
45 glm::vec3 cameraPosition = glm::vec3(0),
47 float clipCorrection = 1.5f
48 )
49 {
50 meshShader = std::make_unique<jGL::GL::glShader>(meshVertexShader, meshFragmentShader);
51 imposterShader = std::make_unique<jGL::GL::glShader>(imposterVertexShader, imposterFragmentShader);
52 imposterShader->use();
53 imposterShader->setUniform<float>("clipCorrection", clipCorrection);
54 imposterShader->setUniform<glm::vec4>("lightColour", glm::vec4(1.0f,1.0f,1.0f,1.0f));
55 imposterShader->setUniform<float>("ambientLight", 0.1f);
56
57 meshShader->use();
58 meshShader->setUniform<glm::vec4>("lightColour", glm::vec4(1.0f,1.0f,1.0f,1.0f));
59 meshShader->setUniform<float>("ambientLight", 0.1f);
60
61 if (mesh == BASE_MESH::ANY)
62 {
63 std::vector<HierarchicalTriangularMesh<float>> htms;
64
65 // Non-regular triangular faces not yet supported.
67 {
69 htm.build(0);
70 htms.push_back(htm);
71 }
72
74 {
75 for (uint8_t i = 0; i < 7; i++)
76 {
78 htm.build(i);
79 htms.push_back(htm);
80 }
81 }
82
83 std::sort(htms.begin(), htms.end());
84
85 for (uint8_t i = 0; i < htms.size(); i++)
86 {
87 meshes.insert({i, {htms[i].vertices(), htms[i].vertexNormals()}});
88 triangleCounts.push_back(htms[i].triangles());
89 }
90 }
91 else
92 {
93 for (uint8_t i = 0; i < 7; i++)
94 {
96 htm.build(i);
97 meshes.insert({i, {htm.vertices(), htm.vertexNormals()}});
98 triangleCounts.push_back(htm.triangles());
99 }
100 }
101
102 buffer = std::make_unique<AtomBuffer>
103 (
104 meshes,
105 atoms.size(),
106 levelOfDetail,
107 cameraPosition
108 );
109
110 setLevelOfDetail(levelOfDetail);
111 this->cameraPosition = cameraPosition;
112 cameraDistances.resize(atoms.size());
113
114 updateAtoms(atoms);
115 setAtomScale(1.0f);
116 setGlobalAlpha(globalAlpha);
117
118 jGL::GL::glError("AtomRenderer::AtomRenderer");
119 }
120
127 uint32_t triangles(bool impostor = true) const
128 {
129 uint64_t triangles = 0;
130 if (impostor)
131 {
132 triangles += buffer->atomCount()*2;
133 }
134 else
135 {
136 triangles += buffer->atomCount()*triangleCounts[levelOfDetail];
137 }
138 return triangles;
139 }
140
146 void setLevelOfDetail(uint8_t lod){ levelOfDetail = std::min(lod, uint8_t(meshes.size()-1)); }
147
153 uint8_t getLevelOfDetail() const { return levelOfDetail; }
154
160 uint8_t maxLevelOfDetail() const { return meshes.size()-1; }
161
168 void updateAtoms(const std::vector<Atom> & atoms)
169 {
170 buffer->flip();
171 buffer->insert(atoms);
172 buffer->updateVertexArray();
173 }
174
180 void draw(bool imposters = true)
181 {
182 if (imposters)
183 {
184 imposterShader->use();
185 }
186 else
187 {
188 meshShader->use();
189 }
190 buffer->draw(imposters);
191 jGL::GL::glError("AtomRenderer::draw");
192 }
193
199 void setView(glm::mat4 v) { view = v; setProjectionView(); }
200
206 void setProjection(glm::mat4 p) { projection = p; setProjectionView(); }
207
216 (
217 glm::vec3 position,
218 glm::vec3 colour = {1.0f, 1.0f, 1.0f},
219 float ambient = 0.1f
220 )
221 {
222 cameraPosition = position;
223 meshShader->use();
224 meshShader->setUniform<glm::vec4>("lightPos", glm::vec4(position, 1.0f));
225 meshShader->setUniform<glm::vec4>("lightColour", glm::vec4(colour, 1.0f));
226 meshShader->setUniform<float>("ambientLight", ambient);
227 imposterShader->use();
228 imposterShader->setUniform<glm::vec4>("lightPos", glm::vec4(position, 1.0f));
229 imposterShader->setUniform<glm::vec4>("lightColour", glm::vec4(colour, 1.0f));
230 imposterShader->setUniform<float>("ambientLight", ambient);
231 }
232
238 void updateCamera(const Camera & camera)
239 {
240 cameraPosition = camera.position();
241 meshShader->use();
242 meshShader->setUniform<glm::vec4>("lightPos", glm::vec4(cameraPosition, 1.0f));
243 imposterShader->use();
244 imposterShader->setUniform<glm::vec4>("lightPos", glm::vec4(cameraPosition, 1.0f));
245 view = camera.getView();
246 projection = camera.getProjection();
247 setProjectionView();
248 buffer->updateCamera(cameraPosition);
249 }
250
256 void setAtomScale(float s)
257 {
258 meshShader->use();
259 meshShader->setUniform<float>("scaling", s);
260 imposterShader->use();
261 imposterShader->setUniform<float>("scaling", s);
262 }
263
269 void setTransparencySorting(bool sort) { buffer->setTransparencySorting(sort); }
270
277 void setGlobalAlpha(float alpha)
278 {
279 globalAlpha = std::max(0.0f, std::min(alpha, 1.0f));
280 meshShader->use();
281 meshShader->setUniform<float>("globalAlpha", globalAlpha);
282 imposterShader->use();
283 imposterShader->setUniform<float>("globalAlpha", globalAlpha);
284 }
285
286private:
287
288 std::unique_ptr<jGL::GL::glShader> meshShader, imposterShader;
289 glm::vec3 cameraPosition;
290 uint8_t levelOfDetail;
291
292 struct SphereMesh { std::vector<float> vertices; std::vector<float> normals; };
293
294 std::map<uint8_t, SphereMesh> meshes;
295
296 uint64_t atomCount = 0;
297 std::vector<uint32_t> triangleCounts;
298
299 std::vector<float> cameraDistances;
300
301 glm::mat4 view, projection;
302
303 float globalAlpha = 1.0f;
304
305 const char * meshVertexShader =
306 "#version " GLSL_VERSION "\n"
307 "precision lowp float; precision lowp int;\n"
308 "layout(location=0) in vec3 a_vertices;\n"
309 "layout(location=1) in vec3 a_normals;\n"
310 "layout(location=2) in vec4 a_positionsAndScales;\n"
311 "layout(location=3) in vec4 a_colours;\n"
312 "uniform mat4 proj;\n"
313 "uniform float scaling;\n"
314 "out vec4 o_colour;\n"
315 "out vec3 o_normal;\n"
316 "out vec3 fragPos;\n"
317 ""
318 "void main()\n"
319 "{\n"
320 " fragPos = vec3(a_vertices*a_positionsAndScales.w*scaling+a_positionsAndScales.xyz);\n"
321 " gl_Position = proj*vec4(fragPos.xyz, 1.0);\n"
322 " o_colour = a_colours;\n"
323 " o_normal = a_normals;\n"
324 "}";
325
326 const char * meshFragmentShader =
327 "#version " GLSL_VERSION "\n"
328 "precision lowp float; precision lowp int;\n"
329 "uniform vec4 lightPos;\n"
330 "uniform vec4 lightColour;\n"
331 "uniform float ambientLight;\n"
332 "uniform float globalAlpha;\n"
333 "in vec4 o_colour;\n"
334 "in vec3 o_normal;\n"
335 "in vec3 fragPos;\n"
336 "out vec4 colour;\n"
337 "void main()\n"
338 "{\n"
339 " vec3 lightDir = normalize(lightPos.xyz - fragPos);\n"
340 " float diff = max(dot(normalize(o_normal), lightDir), 0.0);\n"
341 " colour = vec4((ambientLight + diff)*lightColour.rgb * o_colour.rgb, o_colour.a*globalAlpha);\n"
342 "}";
343
344 const char * imposterVertexShader =
345 "#version " GLSL_VERSION "\n"
346 "precision lowp float; precision lowp int;\n"
347 "layout(location=0) in vec2 a_vertices;\n"
348 "layout(location=1) in vec4 a_positionsAndScales;\n"
349 "layout(location=2) in vec4 a_colours;\n"
350 "out vec2 billboard;\n"
351 "uniform mat4 view;\n"
352 "uniform mat4 proj;\n"
353 "uniform float clipCorrection;\n"
354 "uniform float scaling;\n"
355 "out vec4 atomPosScale;\n"
356 "out vec3 atomViewPos;\n"
357 "out vec4 o_colour;\n"
358 "void main()\n"
359 "{\n"
360 " billboard = a_vertices * clipCorrection;\n"
361 " atomViewPos = (view * vec4(a_positionsAndScales.xyz, 1.0)).xyz;"
362 " gl_Position = proj * (vec4(atomViewPos, 1.0)+vec4(scaling*a_positionsAndScales.w * a_vertices * clipCorrection, 0.0, 1.0));"
363 " atomPosScale = a_positionsAndScales;\n"
364 " atomPosScale.w *= scaling;\n"
365 " o_colour = a_colours;\n"
366 "}";
367
368 const char * imposterFragmentShader =
369 "#version " GLSL_VERSION "\n"
370 "precision lowp float; precision lowp int;\n"
371 "in vec2 billboard;\n"
372 "in vec3 atomViewPos;\n"
373 "in vec4 atomPosScale;\n"
374 "in vec4 o_colour;\n"
375 "out vec4 colour;\n"
376 "uniform mat4 view;\n"
377 "uniform mat4 proj;\n"
378 "uniform vec4 lightPos;\n"
379 "uniform vec4 lightColour;\n"
380 "uniform float ambientLight;\n"
381 "uniform float globalAlpha;\n"
382 "bool sphereHit(vec3 rayDirection, vec3 centre, float radius, out vec3 pos, out vec3 normal)\n"
383 "{\n"
384 " float b = 2.0 * dot(rayDirection, -centre);\n"
385 " float r2 = radius*radius;\n"
386 " float determinant = b * b - (4.0 * (dot(centre, centre) - r2));\n"
387 " if(determinant < 0.0) { return false; }\n"
388 " determinant = sqrt(determinant);\n"
389 " pos = rayDirection * min((-b+determinant)*0.5, (-b-determinant)*0.5);\n"
390 " normal = normalize(pos - centre);\n"
391 " return true;\n"
392 "}\n"
393 "void main()\n"
394 "{\n"
395 " if (o_colour.a == 0.0) { discard; }\n"
396 " vec3 lightViewPos = (view*lightPos).xyz;\n"
397 " vec3 rayDirection = normalize(vec3(billboard * atomPosScale.w, 0.0) + atomViewPos);"
398 " vec3 viewNormal; vec3 viewPos;\n"
399 " bool hit = sphereHit(rayDirection, atomViewPos, atomPosScale.w, viewPos, viewNormal);\n"
400 " if (!hit) { discard; }\n"
401 " vec4 clipPos = proj * vec4(viewPos, 1.0);\n"
402 " float ndcDepth = clipPos.z / clipPos.w;\n"
403 " gl_FragDepth = ((gl_DepthRange.diff * ndcDepth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0;\n"
404 " float diff = max(dot(normalize(viewNormal), normalize(lightViewPos-atomViewPos)), 0.0);\n"
405 " colour = vec4((ambientLight + diff)*lightColour.rgb * o_colour.rgb, o_colour.a*globalAlpha);\n"
406 "}";
407
408 void setProjectionView()
409 {
410 meshShader->setUniform<glm::mat4>("proj", projection*view);
411 imposterShader->setUniform<glm::mat4>("view", view);
412 imposterShader->setUniform<glm::mat4>("proj", projection);
413 }
414
420 struct AtomBuffer
421 {
428 AtomBuffer
429 (
430 std::map<uint8_t, SphereMesh> meshes,
431 uint32_t atoms,
432 uint8_t levelOfDetail,
433 glm::vec3 cameraPosition
434 )
435 : meshes(meshes),
436 size(atoms),
437 levelOfDetail(std::min(meshes.size()-1, size_t(levelOfDetail))),
438 cameraPosition(cameraPosition)
439 {
440 glGenVertexArrays(1, &vao_mesh);
441 glGenVertexArrays(1, &vao_imposter);
442 glGenBuffers(1, &a_quad);
443 glGenBuffers(1, &a_colours);
444 glGenBuffers(1, &a_positionsAndScales);
445
446 a_meshVertices = std::vector<GLuint>(meshes.size(), 0);
447 a_meshNormals = std::vector<GLuint>(meshes.size(), 0);
448 glGenBuffers(a_meshVertices.size(), a_meshVertices.data());
449 glGenBuffers(a_meshNormals.size(), a_meshNormals.data());
450
451 positionsAndScales.resize(size*4);
452 colours.resize(size*4);
453
454 glBindVertexArray(vao_mesh);
455
457 (
458 a_meshVertices[this->levelOfDetail],
459 meshes[this->levelOfDetail].vertices.data(),
460 meshes[this->levelOfDetail].vertices.size(),
461 GL_STATIC_DRAW,
462 0,
463 3,
464 0
465 );
466
468 (
469 a_meshNormals[this->levelOfDetail],
470 meshes[this->levelOfDetail].normals.data(),
471 meshes[this->levelOfDetail].normals.size(),
472 GL_STATIC_DRAW,
473 1,
474 3,
475 0
476 );
477
479 (
480 a_positionsAndScales,
481 positionsAndScales.data(),
482 positionsAndScales.size(),
483 GL_DYNAMIC_DRAW,
484 2,
485 4,
486 1
487 );
488
490 (
491 a_colours,
492 colours.data(),
493 colours.size(),
494 GL_DYNAMIC_DRAW,
495 3,
496 4,
497 1
498 );
499
500 glBindVertexArray(0);
501
502 glBindVertexArray(vao_imposter);
503
505 (
506 a_quad,
507 quad.data(),
508 quad.size(),
509 GL_STATIC_DRAW,
510 0,
511 2,
512 0
513 );
514
516 (
517 a_positionsAndScales,
518 1,
519 4,
520 1
521 );
522
524 (
525 a_colours,
526 2,
527 4,
528 1
529 );
530
531 glBindVertexArray(0);
532 }
533
534 ~AtomBuffer()
535 {
536 glDeleteBuffers(a_meshVertices.size(), a_meshVertices.data());
537 glDeleteBuffers(a_meshNormals.size(), a_meshNormals.data());
538 glDeleteBuffers(1, &a_colours);
539 glDeleteBuffers(1, &a_positionsAndScales);
540 glDeleteBuffers(1, &a_quad);
541 glDeleteVertexArrays(1, &vao_mesh);
542 glDeleteVertexArrays(1, &vao_imposter);
543 }
544
549 void flip() { index = 0; atoms = 0; }
550
556 void insert(const Atom & atom)
557 {
558 if (atom.colour.a == 0.0) { return; }
559 positionsAndScales[index] = atom.position.x;
560 positionsAndScales[index+1] = atom.position.y;
561 positionsAndScales[index+2] = atom.position.z;
562 positionsAndScales[index+3] = atom.scale;
563
564 colours[index] = atom.colour.r;
565 colours[index+1] = atom.colour.g;
566 colours[index+2] = atom.colour.b;
567 colours[index+3] = atom.colour.a;
568 index += 4;
569 atoms++;
570 }
571
577 uint32_t atomCount() const { return atoms; }
578
585 void draw(uint32_t count, bool imposters)
586 {
587 count = std::min(count, atoms);
588 if (count == 0) { return; }
589
590 glEnable(GL_BLEND);
591 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
592 glEnable(GL_DEPTH_TEST);
593 glEnable(GL_CULL_FACE);
594 glCullFace(GL_BACK);
595
596 if (imposters) {
597 glFrontFace(GL_CW);
598 glBindVertexArray(vao_imposter);
599
600 glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, count);
601
602 glBindVertexArray(0);
603 glFrontFace(GL_CCW);
604 }
605 else
606 {
607 glBindVertexArray(vao_mesh);
608
609 glDrawArraysInstanced(GL_TRIANGLES, 0, meshes[levelOfDetail].vertices.size(), count);
610
611 glBindVertexArray(0);
612 }
613 }
614
620 void setLevelOfDetail(uint8_t levelOfDetail)
621 {
622
623 this->levelOfDetail = std::min(size_t(levelOfDetail), meshes.size()-1);
624 glBindVertexArray(vao_mesh);
626 (
627 a_meshVertices[this->levelOfDetail],
628 meshes[this->levelOfDetail].vertices.data(),
629 meshes[this->levelOfDetail].vertices.size(),
630 GL_STATIC_DRAW,
631 0,
632 3,
633 0
634 );
635
637 (
638 a_meshNormals[this->levelOfDetail],
639 meshes[this->levelOfDetail].normals.data(),
640 meshes[this->levelOfDetail].normals.size(),
641 GL_STATIC_DRAW,
642 1,
643 3,
644 0
645 );
646 glBindVertexArray(0);
647 }
648
654 void draw(bool imposters = true) { draw(atoms, imposters); }
655
661 void insert(const std::vector<Atom> & atoms)
662 {
663 flip();
664 for (const Atom & atom : atoms) { insert(atom); }
665 }
666
671 void updateVertexArray()
672 {
673 depthSort();
674 glBindVertexArray(vao_mesh);
675
676 subFullBuffer(a_positionsAndScales, positionsAndScales.data(), positionsAndScales.size());
677 subFullBuffer(a_colours, colours.data(), colours.size());
678
679 glBindVertexArray(0);
680 }
681
688 void updateCamera(glm::vec3 position)
689 {
690 cameraPosition = position;
691 if (transparencySortingEnabled) { updateVertexArray(); };
692 }
693
699 void setTransparencySorting(bool sort)
700 {
701 transparencySortingEnabled = sort;
702 if (transparencySortingEnabled) { updateVertexArray(); };
703 }
704
705 private:
706
707 std::map<uint8_t, SphereMesh> meshes;
708 uint32_t size;
709 uint8_t levelOfDetail;
710 glm::vec3 cameraPosition;
711 GLuint vao_mesh, vao_imposter, a_quad, a_positionsAndScales, a_colours;
712 std::vector<GLuint> a_meshVertices, a_meshNormals;
713
714 std::vector<float> positionsAndScales;
715 std::vector<float> colours;
716
717 uint32_t index = 0;
718 uint32_t atoms = 0;
719 bool transparencySortingEnabled = true;
720
721 const std::array<float, 8> quad =
722 {
723 -1.0,-1.0,
724 -1.0,1.0,
725 1.0,-1.0,
726 1.0,1.0
727 };
728
729 void depthSort()
730 {
731 // CPU expensive.
732 if (!transparencySortingEnabled || atoms == 0) { return; }
733 // NB pushing to a vector and std::sort'ing it is an order
734 // of magnitude faster than pushing to an std::map.
735 // Checked with 1,000,000 atoms (10 fps vs. 1-2).
736 std::vector<std::pair<float, uint64_t>> order;
737 order.reserve(atoms);
738 for (uint64_t i = 0; i < atoms; i++)
739 {
740 float rx = positionsAndScales[i*4]-cameraPosition.x;
741 float ry = positionsAndScales[i*4+1]-cameraPosition.y;
742 float rz = positionsAndScales[i*4+2]-cameraPosition.z;
743 float d2 = rx*rx+ry*ry+rz*rz+positionsAndScales[i*4+3]*positionsAndScales[i*4+3];
744 order.push_back({d2, i});
745 }
746 std::sort
747 (
748 order.begin(),
749 order.end(),
750 []
751 (
752 const std::pair<float, uint64_t> & a,
753 const std::pair<float, uint64_t> & b
754 )
755 {
756 return a.first > b.first;
757 }
758 );
759 // Apply the re-ordering of the data.
760 index = 0;
761 std::vector<float> positionsAndScales_tmp = positionsAndScales;
762 std::vector<float> colours_tmp = colours;
763 for (auto iter = order.begin(); iter != order.end(); iter++)
764 {
765 positionsAndScales[index] = positionsAndScales_tmp[iter->second*4];
766 positionsAndScales[index+1] = positionsAndScales_tmp[iter->second*4+1];
767 positionsAndScales[index+2] = positionsAndScales_tmp[iter->second*4+2];
768 positionsAndScales[index+3] = positionsAndScales_tmp[iter->second*4+3];
769
770 colours[index] = colours_tmp[iter->second*4];
771 colours[index+1] = colours_tmp[iter->second*4+1];
772 colours[index+2] = colours_tmp[iter->second*4+2];
773 colours[index+3] = colours_tmp[iter->second*4+3];
774 index += 4;
775 }
776 }
777 };
778
779 std::unique_ptr<AtomBuffer> buffer;
780};
781
782#endif /* ATOMRENDERER_H */
glm::vec3 min(const std::vector< Atom > &atoms)
Calculate the minimum positions of some Atoms.
Definition atom.h:157
Render atoms as sphere meshes.
Definition atomRenderer.h:27
void updateAtoms(const std::vector< Atom > &atoms)
Update buffers with new Atom data.
Definition atomRenderer.h:168
void setGlobalAlpha(float alpha)
Set the global alpha multiplier.
Definition atomRenderer.h:277
void setProjection(glm::mat4 p)
Set the Projection matrix.
Definition atomRenderer.h:206
AtomRenderer(const std::vector< Atom > &atoms, uint8_t levelOfDetail=0, glm::vec3 cameraPosition=glm::vec3(0), BASE_MESH mesh=BASE_MESH::ANY, float clipCorrection=1.5f)
Construct a new AtomRenderer from a BASE_MESH type.
Definition atomRenderer.h:42
uint8_t maxLevelOfDetail() const
Get the maximum level of detail.
Definition atomRenderer.h:160
void updateCamera(const Camera &camera)
Update shaders from a Camera.
Definition atomRenderer.h:238
void setTransparencySorting(bool sort)
Set whether transparency sorting is performed.
Definition atomRenderer.h:269
void draw(bool imposters=true)
Draw the current Atoms.
Definition atomRenderer.h:180
void setView(glm::mat4 v)
Set the view matrix.
Definition atomRenderer.h:199
void setAtomScale(float s)
Set the global atom scaling factor.
Definition atomRenderer.h:256
uint32_t triangles(bool impostor=true) const
The number of triangles drawn.
Definition atomRenderer.h:127
uint8_t getLevelOfDetail() const
Get the current level of detail.
Definition atomRenderer.h:153
void setLevelOfDetail(uint8_t lod)
Set the current level of detail.
Definition atomRenderer.h:146
void setLighting(glm::vec3 position, glm::vec3 colour={1.0f, 1.0f, 1.0f}, float ambient=0.1f)
Set the lighting of the scene.
Definition atomRenderer.h:216
An atom structure.
Definition atom.h:20
glm::vec3 position
Definition atom.h:78
float scale
Definition atom.h:79
glm::vec4 colour
Definition atom.h:80
A 3D projective camera centered on a focus moving on a sphere.
Definition camera.h:30
glm::mat4 getProjection() const
Get the Projection matrix.
Definition camera.h:188
glm::mat4 getView() const
Get the View matrix.
Definition camera.h:202
glm::vec3 position(bool spherical=false) const
Return the cartesian position vector.
Definition camera.h:163
A refineable mesh of triangles.
Definition hierarchicalTriangularMesh.h:75
void build(uint32_t depth=0)
Refine the mesh to a give depth.
Definition hierarchicalTriangularMesh.h:146
std::vector< T > vertices() const
Get the vertices of the mesh.
Definition hierarchicalTriangularMesh.h:195
uint32_t triangles() const
Get the number of triangles at the largest refinement.
Definition hierarchicalTriangularMesh.h:139
std::vector< T > vertexNormals() const
Get the normal vectors for each triangle.
Definition hierarchicalTriangularMesh.h:219
void subFullBuffer(GLuint &buffer, float *data, GLuint size)
Substitute a GL_ARRAY_BUFFER fully.
Definition glUtils.h:15
void enableBuffer(GLuint &buffer, GLuint attribute, GLuint size, GLuint divisor)
Enable a GL_ARRAY_BUFFER.
Definition glUtils.h:37
void createBuffer(GLuint &buffer, const float *data, GLuint dataSize, int drawType, GLuint attribute, GLuint size, GLuint divisor)
Create a GL_ARRAY_BUFFER from data.
Definition glUtils.h:71
BASE_MESH
Base mesh types for refinement.
Definition hierarchicalTriangularMesh.h:25
void setTransparencySorting(const std::vector< Atom > &atoms, AtomRenderer &atomRenderer, BondRenderer &bondRenderer)
Enable of disable transparency sorting if there are transparent elements.
Definition main.h:342