From Mourad Boufarguine, "When compiling the example on VS9, the compiler complain about undefined GL_DEPTH_COMPONENT32F and GL_DEPTH_COMPONENT32F_NV. So I added them to include/osg/FrameBufferObject. The example builds fine and is working for me without crashs unless it is ran whithout argument. I added couple of lines to check for arguments number and print the example usage when needed."

This commit is contained in:
Robert Osfield 2010-04-21 16:37:28 +00:00
parent 6b9bbc7ca9
commit a475da35e3
2 changed files with 16 additions and 4 deletions

View File

@ -917,11 +917,10 @@ int main(int argc, char **argv)
{ {
// use an ArgumentParser object to manage the program arguments. // use an ArgumentParser object to manage the program arguments.
ArgumentParser arguments(&argc,argv); ArgumentParser arguments(&argc,argv);
arguments.getApplicationUsage() arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()
->setDescription(arguments.getApplicationName()
+ " demonstrates using a floating point depth buffer.\nThe user can invert the depth buffer range and choose among available multi-sample configurations."); + " demonstrates using a floating point depth buffer.\nThe user can invert the depth buffer range and choose among available multi-sample configurations.");
arguments.getApplicationUsage() arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
->addCommandLineOption("--far <number>", "Set far plane value"); arguments.getApplicationUsage()->addCommandLineOption("--far <number>", "Set far plane value");
// if user request help write it out to cout. // if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help")) if (arguments.read("-h") || arguments.read("--help"))
{ {
@ -948,6 +947,11 @@ int main(int argc, char **argv)
const GraphicsContext::Traits* traits = gc->getTraits(); const GraphicsContext::Traits* traits = gc->getTraits();
width = traits->width; width = traits->width;
height = traits->height; height = traits->height;
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
ref_ptr<Node> loadedModel = osgDB::readNodeFiles(arguments); ref_ptr<Node> loadedModel = osgDB::readNodeFiles(arguments);
if (!loadedModel) { if (!loadedModel) {
cerr << "couldn't load " << argv[1] << "\n"; cerr << "couldn't load " << argv[1] << "\n";

View File

@ -118,6 +118,14 @@
#define GL_DEPTH_COMPONENT32 0x81A7 #define GL_DEPTH_COMPONENT32 0x81A7
#endif #endif
#ifndef GL_DEPTH_COMPONENT32F
#define GL_DEPTH_COMPONENT32F 0x8CAC
#endif
#ifndef GL_DEPTH_COMPONENT32F_NV
#define GL_DEPTH_COMPONENT32F_NV 0x8DAB
#endif
#ifndef GL_EXT_packed_depth_stencil #ifndef GL_EXT_packed_depth_stencil
#define GL_EXT_packed_depth_stencil 1 #define GL_EXT_packed_depth_stencil 1
#define GL_DEPTH_STENCIL_EXT 0x84F9 #define GL_DEPTH_STENCIL_EXT 0x84F9