From a475da35e37193c9b560ca8a1f8bee5b067af633 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 21 Apr 2010 16:37:28 +0000 Subject: [PATCH] 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." --- examples/osgfpdepth/osgfpdepth.cpp | 12 ++++++++---- include/osg/FrameBufferObject | 8 ++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/examples/osgfpdepth/osgfpdepth.cpp b/examples/osgfpdepth/osgfpdepth.cpp index 2c32adc39..1bf22b9c6 100644 --- a/examples/osgfpdepth/osgfpdepth.cpp +++ b/examples/osgfpdepth/osgfpdepth.cpp @@ -917,11 +917,10 @@ int main(int argc, char **argv) { // use an ArgumentParser object to manage the program arguments. ArgumentParser arguments(&argc,argv); - arguments.getApplicationUsage() - ->setDescription(arguments.getApplicationName() + arguments.getApplicationUsage()->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."); - arguments.getApplicationUsage() - ->addCommandLineOption("--far ", "Set far plane value"); + arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); + arguments.getApplicationUsage()->addCommandLineOption("--far ", "Set far plane value"); // if user request help write it out to cout. if (arguments.read("-h") || arguments.read("--help")) { @@ -948,6 +947,11 @@ int main(int argc, char **argv) const GraphicsContext::Traits* traits = gc->getTraits(); width = traits->width; height = traits->height; + if (arguments.argc()<=1) + { + arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); + return 1; + } ref_ptr loadedModel = osgDB::readNodeFiles(arguments); if (!loadedModel) { cerr << "couldn't load " << argv[1] << "\n"; diff --git a/include/osg/FrameBufferObject b/include/osg/FrameBufferObject index cab0112fe..4843b78d2 100644 --- a/include/osg/FrameBufferObject +++ b/include/osg/FrameBufferObject @@ -118,6 +118,14 @@ #define GL_DEPTH_COMPONENT32 0x81A7 #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 #define GL_EXT_packed_depth_stencil 1 #define GL_DEPTH_STENCIL_EXT 0x84F9