|
楼主 |
发表于 2014-2-28 18:07:26
|
显示全部楼层
谢谢!能不能更详细一点?
具体情况是这样的:
代码是:
static const char* vertSource={
"attribute vec2 pos ;\n"
"void main()\n"
"{\n"
"vec2 pos = vec2(gl_Vertex.x,gl_Vertex.y);\n"
"gl_Position = ftransform();\n"
"}\n"
};
应用程序里是这样的:
osg::ref<osg::Geometry > geometry = new osg::Geometry ;
osg::ref<osg::Geode> geode = new osg::Geode ;
osg::ref_ptr<osg::Shader> vertShader = new osg::Shader(osg::Shader::VERTEX,vertSource);
osg::ref_ptr<osg:rogram> program = new osg::Program ;
osg::StateSet = *(geode->getOrCreatSet()) ;
program->addShader(vertShader) ;
//geometry->setVertexAttribArray(); ??????????
//program->addBindAttribLocation("pos",0); ??????????
ss.setAttributeAndModes(program) ;
}
想要在应用程序里使用着色语言里定义的pos,怎样使用呢? |
|