Ejemplo Glsl Con Osg
#include
#include
#include
#include
#include
#include
//----------------4----------------------
#include
#include
//--------------------------------------//---------------7--------------
#include
#include
#include
#include
#include
#include
#include
#include
//----------------------------
int main(int, char **)
{
// Apuntadores alprograma y shaders
//----------------2----------------------
osg::Program *shaderProgram;
osg::Shader *VertObj;
osg::Shader *FragObj;
//--------------------------------------//----------------5----------------------
osg::Program *illuProgram;
osg::Shader *illuVertObj;
osg::Shader *illuFragObj;
//-------------------------------------//----------------7----------------------
osg::Program *silProgram;
osg::Shader *silVertObj;
osg::Shader *silFragObj;
//-------------------------------------
osgViewer::Viewer *viewer = new osgViewer::Viewer();osg::Group *root = new osg::Group();
// Creacion de un cubo
osg::Box *mBox = new osg::Box(osg::Vec3(0.0, 0.0, 0.0), 4.0f);
osg::ShapeDrawable *boxD = new osg::ShapeDrawable(mBox);osg::Geode *mGeode = new osg::Geode();
mGeode->addDrawable(boxD);
//root->addChild(mGeode);
//----------------4----------------------
// Carga del modeloosg::PositionAttitudeTransform *modelXForm = new osg::PositionAttitudeTransform();
osg::Group *auxGroup1 = new osg::Group();
osg::Node *modelNode = osgDB::readNodeFile("nanase.obj");
auxGroup1->addChild(modelNode);//--------------------------------------
//----------------6----------------------
osg::Group *auxGroup2 = new osg::Group();
auxGroup2->addChild(modelNode);//-------------------------------------
// Construccion del grafo de escena
modelXForm->addChild(auxGroup1);
modelXForm->addChild(auxGroup2);
root->addChild(modelXForm);
root->addChild(mGeode);...
Regístrate para leer el documento completo.