Using gridgeometry to render planetmesh

This commit is contained in:
Karl Bladin
2016-04-01 13:27:11 -04:00
parent 0c86cf07ff
commit 6a03d89861
2 changed files with 11 additions and 2 deletions

View File

@@ -51,6 +51,7 @@ namespace openspace {
PlanetMesh::PlanetMesh(const ghoul::Dictionary& dictionary)
: DistanceSwitch()
, _programObject(nullptr)
, _grid(10, 10, Geometry::Positions::Yes, Geometry::TextureCoordinates::No, Geometry::Normals::No)
, _rotation("rotation", "Rotation", 0, 0, 360)
{
std::string name;
@@ -67,6 +68,9 @@ namespace openspace {
// Mainly for debugging purposes @AA
addProperty(_rotation);
_grid.initialize();
/*
// Create a simple triangle for testing the geometry
std::vector<unsigned int> triangleElements;
std::vector<glm::vec4> trianglePositions;
@@ -87,6 +91,7 @@ namespace openspace {
_testGeometry->setVertexPositions(trianglePositions);
_testGeometry->initialize();
*/
}
PlanetMesh::~PlanetMesh() {
@@ -157,7 +162,8 @@ namespace openspace {
glCullFace(GL_BACK);
// render
_testGeometry->drawUsingActiveProgram();
// _testGeometry->drawUsingActiveProgram();
_grid.drawUsingActiveProgram();
// disable shader
_programObject->deactivate();

View File

@@ -32,6 +32,7 @@
#include <openspace/util/updatestructures.h>
#include <modules/planetbrowsing/rendering/geometry.h>
#include <modules/planetbrowsing/rendering/gridgeometry.h>
#include <modules/planetbrowsing/rendering/distanceswitch.h>
#include <modules/planetbrowsing/rendering/planetmesh.h>
@@ -59,7 +60,9 @@ namespace openspace {
private:
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
std::unique_ptr<Geometry> _testGeometry;
//std::unique_ptr<Geometry> _testGeometry;
GridGeometry _grid;
properties::IntProperty _rotation;