File: example1.cpp

package info (click to toggle)
openscenegraph 1.2.0-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 26,924 kB
  • ctags: 25,229
  • sloc: cpp: 239,326; ansic: 2,178; sh: 1,990; yacc: 548; perl: 237; makefile: 227; lex: 151
file content (33 lines) | stat: -rw-r--r-- 1,239 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//C++ source file - Open Producer - Copyright (C) 2002 Don Burns
//Distributed under the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE (LGPL)
//as published by the Free Software Foundation.

// Simple example of use of Producer::Camera
// The MySceneHandler class is a simple sample of a Camera::SceneHandler

#include <Producer/Camera>
#include "MySceneHandler"

int main(int argc, char **argv)
{
    // Declare the camera
    Producer::ref_ptr<Producer::Camera> camera = new Producer::Camera;

    // Optional.  Configure the size of the camera's render
    // surface.  Without these lines, the RenderSurface would
    // fill the whole screen and have no border
    Producer::ref_ptr<Producer::RenderSurface> rs = camera->getRenderSurface();
    rs->setWindowRectangle( 100, 100, 640, 480 );
    rs->setWindowName( "Producer Example using Camera" );

    // Tell the camera about the Scene Handler.  See notes in MySceneHandler
    camera->setSceneHandler( new MySceneHandler );

    // Main loop.  Note that the while() statement comes after camera->frame()
    // because the RenderSurface is not realized until the first call to camera->frame().
    do {
        camera->frame();
    } while( rs->isRealized() );

    return 0;
}