46
edits
(Short introduction to od_gauge) |
|||
| Line 45: | Line 45: | ||
osgDB::writeImageFile(*shot,"image_file.png"); | osgDB::writeImageFile(*shot,"image_file.png"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==FlightGear code== | |||
FlighGear already has an "Owner Drawn instrument" in flightgear/src/Instrumentation/od_gauge.cxx and .hxx. It already sets up a pre-render camera and a texture for it, and has a visitor to replace model's texture with the custom texture. | |||
Using it would be something like this: | |||
- Create a custom instrument which inherits od_gauge. class CameraInstrument : public FGODGauge { ... } | |||
- Implement the init and update functions, whatever instrument manager requires. | |||
- In init set up proper texture sizes and call allocRT(). | |||
- In update function update camera position according to viewer->getAbsolutePosition(...). | |||
- Add the custom instrument to instrument_mgr.cxx. | |||
=Part 2: Getting that texture into an instrument= | =Part 2: Getting that texture into an instrument= | ||
edits