Example of running OSG correctly

Source: Internet
Author: User

OSG provides many useful examples for us. How can we run these examples correctly? I want to help you with some of my experiences.
1. How to Find the command line parameters?
Main function as Program Many command line parameters are processed here. Many OSG examples require parameters. Otherwise, the default file needs to be called. Note: If you run the OSG directly, it may be a flash, but it is normal. Don't be alarmed. You only need to analyze what command line parameters are needed to run them correctly.
In osgviewer, let's look at the related processing functions:
Arguments. getapplicationusage ()-> setapplicationname (arguments. getapplicationname (); // set the program name
Arguments. getapplicationusage ()-> setdescription (arguments. getapplicationname () + "is the standard openscenegraph example which loads and visualises 3D models."); // simple description
Arguments. getapplicationusage ()-> setcommandlineusage (arguments. getapplicationname () + "[Options] filename..."); // how to use the example
Arguments. getapplicationusage ()-> addcommandlineoption ("-- image <FILENAME>", "load an image and render it on a quad"); // Parameter
... (Omitted)
Here we can read what the program is doing, the specific usage, and the usage of some parameters.
After determining the parameter to be passed, you can directly enter the command in the "command line" (if you are familiar with it). The other method is in the "property page" of the project, select "debug" and "Command Parameters" to add the required commands. This allows most examples to run.
2. Make sure that your environment variables are correct.
Sometimes, even if you set the command line parameters, some files still cannot be found. Note that the OSG example requires some files to execute, and you can find the files required by these examples here (http://www.openscenegraph.org/projects/osg/wiki/Downloads/SampleDatasets.
After downloading, decompress the package and place it. For example, if I put it in E: \ OSG \ openscenegraph-data, I also need to set environment variables (how to set Baidu ). Add an environment variable named osg_file_path with the value of E: \ OSG \ openscenegraph-data. In this way, most examples can work without providing additional files.
In addition, if some warnings are reported, the corresponding plug-in may not be found. Set the location of your OSG plug-in correctly in the PATH environment variable.
3. If I still don't work?
What should I do if the above information is correct or does not work? Confirm that your video card supports the correct example. In some advanced examples, you need to update the video card support. For example, examples osggeometryshaders requires dx10 series graphics cards to work correctly. Generally, if an error occurs, the console outputs the corresponding information. Some graphics cards may not support certain extensions, which can also be known Based on the console output.
After confirming the above three points, most examples can still run successfully. Of course, if you are lucky, please follow up Source code , Find the cause, then you will have a better understanding of OSG.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.