newseventscompanycareerscontactsitemap
homesolutionsproductsservicessupporttraining
     

contacts

request form

software center
multigen creator
vega
openflight
unsupported tools document center
multigen creator
vega
openflight

faqmultigen creator
vega

The following is a list of additional samples available for Vega Prime that can be used to illustrate how to achieve various techniques and functionality using the VSG™ and Vega Prime API. Using the "Find" function in your browser will allow you to search on key words for specific topics. Additional information regarding each sample can be found in its associated README file included in the .zip archive containing the samples.

Maintained customers can request the .zip archive containing these samples by contacting vegaprime@multigen-paradigm.com.

These samples are solely for use by an authorized licensee of the applicable MultiGen-Paradigm Product(s), and use of these tools is subject to the terms of any such license. These samples are provided "as is" without warranty of any kind. To the full extent permitted under applicable law, MultiGen-Paradigm, Inc. disclaims all liability arising from or related to any use of these samples.

 

vp_binoculars

This sample illustrates how to make a simple binocular view in Vega Prime. This is also a good example of how to use the stencil buffer to mask out areas of the screen in vpChannel EVENT_PRE_DRAW and EVENT_POST_DRAW subscribers.

Relevant Keywords: setLODVisibilityRangeScale, GL_DEPTH_TEST, GL_STENCIL_BUFFER_BIT, GL_TRIANGLE_FAN

 

vp_bump_map

This sample illustrates how to do a DOT3 bump map in Vega Prime. The BumMapper is the key class which loads the specified base and normal map textures. The internal bump mapping approach is based on the DOT3 bump mapping using OpenGL texture environment extensions that are similar in functionality to register combiners.

Relevant Keywords: vsGeometry, vrState, vrGeometry, vrRenderStrategy, vrMultiTexture, light vector, tangent and binormal vectors, vtxprg_regcomb_setup

 

vp_channel_bin_ogl

This sample illustrates how to use channel bins to perform generic rendering during the draw. This sample defines the class myApp, which is derived from vpApp, and draws a reticle using OpenGL by defining a vsChannelBin and overriding the draw bin processor to perform the rendering.

Relevant Keywords: vsChannelProxy, BinProcessor, DrawProcessor

 

vp_color_mask

This sample illustrates the use of the glColorMask in Vega Prime to selectively render to only certain color bands of the frame buffer. It uses EVENT_PRE_DRAW and EVENT_POST_DRAW vpChannel subscribers to set the color mask so that the channel can be rendered as monochrome green.

Relevant Keywords: getVrChannel, setClearColor

 

vp_color_table

This sample uses geometry representations to create an alternate representation of the esprit model that uses a separate color array and allows the selection of which color array to use at run time. The color tracking is enabled so that our material diffuse colors are overridden by our vertex colors. To do this we'll enable the "All Geometries Lit" and "Use Material Diffuse Color" options in the "Geometry Configuration" tab of the "Objects" LynX Prime panel.

Relevant Keywords: vpObject, registerRepresentation, setRepresentationIndex

 

vp_flight_path

This sample illustrates how to draw geometry to simulate the flight path of an object. It uses a vsRenderStrategyFrameGeometry to create dynamic path geometry for a c130 flying around town. The sample also creates "ghost" objects, which are copies of the c130, at the start of each new segment of the path to indicate the exact position and orientation of the c130 at that moment in time.

Relevant Keywords: vpObject, setCopySource, vrGeometry, vrAlphaBlend, vrPolygon

 

vp_flt_subscriber_extend

This sample illustrates how to retrieve OpenFlight information in Vega Prime application via the subscriber mechanism by extending the scene graph with a custom vrGeometry-derived class. The sample also shows how to store custom classes in the Vega Scene Graph Binary format (VSB) and reconstitute the VSB description.

Relevant Keywords: vpObject, vpGeometryPageable, vpIsector, vsNodeLoader_flt

 

vp_flt_subscriber_user_data

This sample illustrates how to retrieve OpenFlight information in Vega Prime application via the subscriber mechanism and store it in the user data list of a loader-created vrGeometry. It also shows how to reconstitute the VSB description to store the class along with the user data in VSB format.

Relevant Keywords: vuUserDataList, vpObject, vpGeometryPageable, vpIsector, vsNodeLoader_flt

 

vp_frame_buffer_read

This sample illustrates the use a vsChannel post draw subscriber to read the frame buffer and write the image to disk. This sample defines the class myApp, which is derived from vpApp, and allows the user to capture desired frames of the simulation as an sgi image.

Relevant Keywords: vuImage, vuImageFactory, vuImageUserBuffer, glReadPixels

 

vp_logo

This sample illustrates the use a vsChannel post draw subscriber to draw an OpenGL transparent polygon overlay in Vega Prime.

Relevant Keywords: vrState, vrTexture, vrTextureBlend, vrAlphaBlend, vrDrawContext, pushElements, setElement, setState

 

vp_mfc

This sample illustrates how to add a Vega Prime window to an MFC app. It shws how to reparent a Vega Prime window, resize a Vega Prime window based on its parent, set the focus to the Vega Prime window so Vega Prime will receive keyboard messages, and use a timer to update the Vega Prime frame in a way that keeps the user interface responsive.

Relevant Keywords: vpWindow, setParent, setBorderEnable, setFullScreenEnable, CView, CDocument, CWinApp, CFrameWnd

 

vp_mirror

This sample illustrates how to create a mirror in Vega Prime. The application has two observers and two channels, one set for the driver's side mirror and the other set for the driver. The mirror channel is rendered first from the perspective of the mirror, then the output of the mirror channel is copied to a texture which is mapped to the driver's side mirror that is visible in the second channel.

Relevant Keywords: vpGeometry, const_iterator_texture, vrTexture, vpWindow, getDrawArea, getCoordinates, glCopyTexSubImage2D

 

vp_mirror_channel

This sample illustrates how to create a mirrored channel in Vega Prime. It defines two channels, one which contains the normal view, and a second which is just a mirror of the first. The output of the main channel is copied to a texture which is mapped to a quad that is rendered over the second channel.

Relevant Keywords: vrTexture, setFormat, setDimensions, setImageLevel, vrTextureProcessorDefault, generateMipMaps, vrTextureBlend

 

vp_monochrome_copy_texture

This sample illustrates how to render a monochrome channel in Vega Prime. The application defines two channels, one that contains the normal view, and a second that is just a monochrome image of the first. By default the output of the main channel is copied to an intensity texture which is then mapped to a quad that is rendered over the second channel.

Relevant Keywords: vrTexture, setFormat, setDimensions, setImageLevel, vrShaderFactory, Cg, glCopyTexSubImage2D, vrDepthTest:, vrTransform

 

vp_monochrome_pixel_buffer

This sample illustrates how to render a monochrome channel in Vega Prime. The application defines two windows, one that contains the normal view, and a second which is just a monochrome image of the first. The output of the first window is rendered to a pixel buffer that acts as a dynamic texture. The texture is mapped to a quad that is rendered over the channel of the second window. A shader is used to average the color values from the dynamic texture to produce a monochrome result.

Relevant Keywords: vrShader, vrShaderFactory

 

vp_movie_recorder

This sample illustrates how to capture video from a Vega Prime application directly to a number of common video formats. This sample depends on the Windows Multimedia SDK, which will automatically take advantage of any installed video codecs. Because the Windows Multimedia SDK is used, the sample currently only functions properly on Windows.

Relevant Keywords: AVIFileInit, AVISTREAMINFO, AVIFileCreateStream

 

vp_movie_texture

This sample illustrates how to configure a texture to render an AVI Video Stream in Vega Prime. The sample uses a vpKernel subscriber for the vpKernel::EVENT_PRE_PROCESS_NON_LATENCY_CRITICAL event for obtaining a frame of video from the stream. A channel subscriber for the vsChannel::EVENT_POST_DRAW event is used for texture subloading.

Relevant Keywords: FrameData, subloadLevel, AVIFileInit, AVISTREAMINFO, AVIStreamOpenFromFile

 

vp_net

This sample illustrates how to add a Vega Prime window to a .NET application. The Visual Studio New Project Wizard was used to create a .NET Console Application, and then the Vega Prime code was added as required. The vpApp class was used to provide the default behavior of the application with the exception that the vpApp::onKeyInput() method was overridden to force the user to exit the application through the GUI.

Relevant Keywords: vpWindow, setParent, Application, Timer, EventHandler, resource.h, mscorlib.dll, System.dll

 

vp_no_visual

This sample illustrates how to create a Vega Prime application that doesn't provide any visuals. It loads an acf file that does not define a pipeline, a window or a channel. Therefore, this app has no visuals (and no keyboard or mouse input as a result). The application loop simply repositions the transformation node along a circle for a given number of frames. The output contains current observer position and intersection point. The application automatically exits after 1000 frames.

Relevant Keywords: setTranslate, getHit, getXYZHPR

 

vp_object_construction

This sample shows how to manually construct a vpObject and how to remove and replace a node in the scene graph. First, the "crane" model is displayed. Nodes of the crane model can be removed by pressing F1 - F12 keys. By pressing 'r' key, the node "cab" will be replaced by the "tower" model.

Relevant Keywords: vpObject, vpGeometryPageable, begin_named, vsNode, vsNodeFactory, vsGeometryBase, vsClean, vsFlatten

 

vp_picking

This sample illustrates picking, render strategies, and traversals. This sample defines the class myApp, which is derived from vpApp, which allows the user to pick nodes or objects to highlight in the scene. Using the ACF vp_picking_ortho.acf demonstrates the use of picking when using orthographic channels.

Relevant Keywords: vpInputMouse, vpIsectorLOS, vsNode, begin_parent, vrRenderStrategy, vrDrawFunc::Data, vuRad2Deg, vuArcTan

 

vp_point_at

This sample demonstrates how to orient a transformation node to point in the direction of any other node in the scene graph. You can utilize this algorithm to make a part of an object (i.e. a weapon) point in the direction of another object. This sample illustrates such functionality by attaching an observer to a transformation node named attachmentParent and mimicking observer's LookAt behavior by orienting that transform in the direction of the Target plane.

Relevant Keywords: vpPositionable::Strategy, StateVector, vpKernel, EVENT_POST_UPDATE_TRAVERSAL, vsTraversalLocate

 

vp_point_in

This sample demonstrates how to orient a transformation node to point in a given direction in world space. You can utilize this algorithm to make a part of an object (i.e. a weapon) track a given direction. It uses the vsTraversalLocate class to obtain an absolute location of the parent node of a transformation node that performs tracking (m_turret). The locate traversal collects the model matrix stack of the parents as it marches up the scene graph.

Relevant Keywords: vpPositionable::Strategy, setStrategy, compute, StateVector, vsNode, EVENT_UPDATE

 

vp_post_cull

This sample illustrates the use of a vsChannel pre cull and vsNode post cull subscribers to determine when something is in the field of view. This sample defines the class myApp, which is derived from vpApp, and uses these subscribers to maintain a list of objects that are currently in the field of view.

Relevant Keywords: vpChannel, EVENT_PRE_CULL, vsNode, EVENT_POST_CULL

 

vp_postdraw_3d

This sample illustrates the use a channel post draw subscriber in Vega Prime to draw 3D geometry out in the scene, as opposed to 2D geometry in an orthographic view. This sample defines the class myApp, which is derived from vpApp, and draws the coordinate axes of a c130 object as it flys around town.

Relevant Keywords: vpObject, setTranslate, setRotate, vrElement, begin_context(),vrDrawContext, pushElement, vuMatrixTruncate

 

vp_postdraw_3d_grid

This sample illustrates the use a channel post draw subscriber in Vega Prime to draw a 3D grid. This sample defines the class myApp, which is derived from vpApp. The '>' and '<' keys can be used to increase/decrease the grid cell size by 0.1 database units.

Relevant Keywords: vrGeometry, setColors, setFormat, setDislayListEnable, setPrimitive, setNumPrimitives, setVertices, setColors, modelview matrix, inverse of the view matrix, offset matrix

 

vp_recorder

This sample illustrates how to perform simple recording and playback of object positions in Vega Prime. This sample defines the class myApp, which is derived from vpApp. In record mode, it queries the object position and writes it to the file.

Relevant Keywords: endFrame, vpObject, getAbsolutePosition, setTranslate, setRotate

 

vp_screen_capture

This sample illustrates how to capture a frame for a particular channel into an image file. This sample defines the class myApp, which is derived from vpApp and vsChannel::Subscriber. The post draw subscriber performs the screen capture and saves the image to a file.

Relevant Keywords: vpChannel, EVENT_POST_DRAW, glReadPixels, vuImageUserBuffer, setPixelType

 

vp_specular_map

This sample illustrates how to do a specular (or gloss) map in Vega Prime. This sample defines the class myApp, which is derived from vpApp, which allows the user to view a simple model of the earth. The application defines a render strategy that performs a multi-pass rendering of an earth model that uses a specular map to provide specular highlights only over the water.

Relevant Keywords: vsGeometry, vrRenderStrategy, vrState, vrTexture, vrTextureBlend, setColorMode, glMaterialfv, vrDrawFunc

 

vp_statistics_advanced

This sample demonstrates how to utilize the vuStat framework to collect statistics to disk. The AllocTracerHistogram class monitors the dynamics of memory allocations and deallocations for each memory block size requested by the application. The vsStatistician class manages statistics from multiple sources. The results are stored as ASCII files, where each data stream is identified by the file header.

Relevant Keywords: vuAllocTracer, vsServiceMgr, RecycleBin, collectSceneGraphStats, IgorPro

 

vp_stereo

This sample illustrates how to do stereo in Vega Prime. The application defines the class myApp, which is derived from vpApp, and renders two channels who have offsets in the x direction to simulate the distance between the eyes and uses channel pre draw subscribers to select rendering to either the left or right frame buffer.

Relevant Keywords: vpChannel, glDrawBuffer, GL_BACK_LEFT, GL_BACK_RIGHT

 

vp_targeting

This sample illustrates picking and rendering textured 3D geometry during post-draw. This sample defines the class Picker, derived from vsChannel::Subscriber, which allows the user to select a point on the screen (via the left mouse button) and draws textured geometry at the collision point if a collision is detected. The geometry is automatically rotated to match the collision surface. Every 30th frame the texture is switched to demonstrate how texture assignment is performed.

Relevant Keywords: vrTextureFactory, vrTextureBlend, setColorMode, vpIsectorLOS, vrGeometry

 

vp_texture_animation

This sample illustrates how to do texture animation in Vega Prime. The application defines a render strategy which modifies the texture matrix for a geometry based upon the speed of the objects motion model. The sample attaches to the tread geometry for a tank and simulates motion of the treads while the tank drives around.

Relevant Keywords: vpObject, begin_named, vpMotionDrive, vrDrawFunc, vrTransform::ElementTexture

 

vp_tree_halo

This sample illustrates the how to modify the alpha test reference value via a user defined traversal in order to reduce the appearance of "halos" around semi-transparent objects. The application loads a simple tree model which illustrates the halo problem and allows the user to modify the alpha test reference value in real time see the effect on the visual artifact.

Relevant Keywords: vsTraversalUser, vrState, vsTraversalLookUpNodeId, vrAlphaTest::MODE_GREATER

 

vp_user_geometry_attribute

This sample illustrates the use of geometry attributes. Geometry attributes allow users to extend the data stored w/ vpGeometry derived classes such as vpObject and vpFx, and to provide additional methods to manipulate this data. The application creates a user defined attribute which allows for run time control of light point intensity and state on an object.

Relevant Keywords: vpGeometry::Attribute, preLoad(), getRootNode(), vsLightPoint, setRenderMask, vrGeometryBase, begin_geometry()

 

vp_user_isector

This sample illustrates how to create user defined isectors in Vega Prime. In this case, the user defined isector class defines intersection segments that align w/ the edges of a user specified box. The application allows the user to drive a hummer w/ a user defined "box isector" around town. A user defined position strategy is used in conjunction w/ the isector to perform simple colision detection and force the hummer to stop when it runs into something.

Relevant Keywords: vpIsector, vpIsectorUser, vpGroundClamp, vpPositionable, getHit, setTarget, setRenderEnable

 

vp_user_module

This sample illustrates how to create a user-defined module and integreate it into Vega Prime application. The sample defines a vpTank module that includes a GUI configuration file for LynX Prime vpTank panel, an XML shema file for parsing vpTank instances in ACF, and a vpTank library that facilitates the vpModule interface (initialize, configure, unconfigure, and shutdown).

Relevant Keywords: registerInstance, syncWithMasterClone, initializeClass, shutdownClass

 

vp_user_node_loader

This sample shows how to use the user-defined node loader interface to implement a new loader for the file of its format (in this case, the Yale Star Format).

Relevant Keywords: vsNode, vsNodeLoader, vsNodeFactory, vuSearchPath, vuFile, vuFileIOMgr, vsLightPoint

 

vp_vertex_buffer_object

The sample also shows how to build Vertex Buffer Objects using Vertex Buffer Object builder class and use the vrVertexBufferObject (VBO) iterator API. The API makes it simpler to work with vertex attributes stored in a VBO.

Relevant Keywords: vsBuildVertexBufferObjects, test_vertex_buffer_object_iterators, getGeometryBase, vrVertexBufferObject::Element::Id

 

vp_volume_contains

This sample illustrates how to determine whether a vpObject is contained within a generic volume. The application defines a template class which uses a vsTraversalUser to determine which objects are contained within a user specified volume. The user can select different volumes to use and move the volumes around the scene so that the volumes include different objects.

Relevant Keywords: vuBox, vuFrustum, vuSphere, vuVolume, vuMatrixStack, vsTransform, getMatrixAffine, vpScene

 

vp_world_to_screen

This sample illustrates how to transform a point in world coordinates to screen coordinates. The application defines the class myApp, which is derived from vpApp and vsChannel::Subscriber. A post draw subscriber is used to draw text in the lower left corner giving the (x,y) screen position of the center of the target object, as well as the (x, y, z) world space coordinates.

Relevant Keywords: vrFont, vrFontFactory, vrMode, vsChannel, getViewPort, getWorldToScreenMatrix, displayStringAt, vuString

 

vpdebug_postdraw

This sample illustrates how the user can insert their own debug calls into the DebugDraw output stream and view the results in the DebugDraw GUI tool. The sample renders a reticle in a channel post draw subscriber and shows how to save the state of the vrDrawContext and the reticle geometry to the file. The Elements that comprise the current state at the time the post draw subscriber was called can be examined in the GUI tool.

Relevant Keywords: vrGeometry, vrDrawContext::Debug, changedState, vrDebugDraw, drawGeometry

 

vpenv_user_celestial

This sample illustrates the creation of a user defined environment effect for use with the environment module in Vega Prime. In this case, the effect is a simple sun model which positions the sun directly overhead at noon and at the opposite end of the earth at midnight. The sample loads town.flt and allows the user to modify environment parameters.

Relevant Keywords: sun geometry, visibility range, time of day, vpEnvCelestial, twilight dip, radius, orbit, illumination

 

vpenv_user_cloud

This sample illustrates the creation of a user defined volumetric cloud for use with the environment module in Vega Prime. By deriving a class from vpEnvCloudVolume, you can override the automatic cloud generation algorithm to make your own clouds. The sample loads town.flt and allows the user to manipulate the cloud parameters.

Relevant Keywords: (intra-cloud) lightning severity, rain shaft, setMinBillboardingRange, Puff, insert_envfx

 

vpenv_user_envfx

This sample illustrates the creation of a user defined environment effect for use with the environment module in Vega Prime. In this case, the user defined effect is a simple ground fog plane which reduces the visibility when the eye point is below the ground fog plane, and renders a semi-transparent polygon representing the plane when the eye point is above it. The sample loads town.flt and allows the user to manipulate the ground fog parameters.

Relevant Keywords: vpEnvFx, vrGeometry, elevation, z-fighting, transition range, visibility range, vsCullRecordFactory, ObserverData

 

vpenv_user_precip

This sample illustrates the creation of a user created subclass of vpEnvPrecipitation as well as the manipulation of objects created from the built-in vpEnvPrecipitation and vpEnvRain classes. The user defined class overloads the default movement strategy and replaces it with sinusoidal motion in X and Y. The sample loads town.flt and allows the user to manipulate the precipitation objects.

Relevant Keywords: computeParticlePosition, EmitterBoxSize, GravitationalConstant, ParticleSize

 

vpfx_flamethrower

This sample illustrates how to use the setVelocitySource, getVelocitySource, setRelativeEmissionVelocity, getRelativeEmissionVelocity, setWindSource, and getWindSource methods of the vpFxParticleSystem class. They allow the manner in which the velocity and wind vectors get applied to the particles to be modified at run-time.

Relevant Keywords: setEnvironment, setWindSource, setVelocitySource, setRelativeEmissionVelocity, DOF, Turret, Barrel

 

vpfx_munition

This sample illustrates creating muntion effects in the Special Effects module in Vega Prime and attaching them to articulated geometry. The sample also illustrates how to create a simple tracer effect using a vsRenderStrategyFrameGeometry. The sample loads town.flt and allows the user to move the turret and barrel of the tank and fire the main gun and the machine gun to see the effects.

Relevant Keywords: setRenderStrategy, DOF, getSimulationTime, vsTraversalLocate, makeRotate, transformVector, setRenderMask

 

vpfx_user

This sample illustrates a user defined special effects in Vega Prime. This sample defines the class myApp, which is derived from vpApp. The application creates a user defined particle system snow effect through the ACF and a rain particle system effect by deriving a class from vpFxParticleSystem through code.

Relevant Keywords: copy, compare, setRepeatEnable, setTextureFile, setOverallDuration, setOverallColor, setTextureMode

 

vpinput_user

This sample shows how to implement a vpInput derived class for joystick device and how to associate it with various motion models. This sample consists of two main parts: vpinput_joystick.dll (based on DirectX 8.1) and vpinput_user.cpp.

Relevant Keywords: DirectX 8.1 SDK, dxguid.lib, dxerr8.lib, dinput8.lib, vpKernel::Subscriber, vpInput, dinput.h

 

vpladbm_paging_strategy_analyzer

This sample illustrates how to write an LADBM paging strategy analyzer. The analyzer class attaches to a given LADBM strategy as a subscriber and monitors paging activity generated by the strategy. The analyzer detects when a paging cycle begins and ends. An example of a paging cycle is a move of the paging center from one location to another. The analyzer tries to detect when a paging cycle is done completely, which includes several conditions throughout the framework.

Relevant Keywords: LADBMPagingStrategyAnalyzer, SceneGraphAnalyzer, getNumToBeCompleted, getMfGeometryGridDataset

 

vpladbm_vt_analyze

The sample loads MetaFlight-PaloAlto_Terrain+VT-1_0.mft, which contains a single simple, 3-level gridded dataset and associated virtual texture imagery from the Palo Alto area. The sample creates a paging strategy that is attached to the observer, which in turn can fly around the database using a UFO motion model.

Relevant Keywords: LADBM, VT, PaloAlto, analyze technique, zoom, VT level, analysis recording, vpVTTechniqueAnalyze

 

vpmotion_user

This sample illustrates a user defined motion model in Vega Prime. This sample defines the class myApp, which is derived from vpApp . The application creates a user define motion model which allows the user to rotate about a given point.

Relevant Keywords: vpInputComposite, vpInputKeyboard, SourceBoolean, compute, vpPositionable, StateVector

 

vpstat_user

This sample illustrates how to derive a custom class from the Vega Prime framework and instrument the new class with custom statistics items such that instances of the custom class type are able to provide statistical data, which can be displayed and collected via the Statistics Viewer Client. A channel post draw subscriber is used to draw text in the lower left corner giving the (x,y) screen position of the center of a target object, as well as the (x, y, z) world space coordinates.

Relevant Keywords: vrFont2D, getWorldToScreenMatrix, displayStringAt, getFrameNumber, VUSTAT_REGISTER_DEF, VUSTAT_REGISTER

 

vpvt_technique

This sample illustrates how to implement a Virtual Texture technique in Vega Prime. The Virtual texture imagery is mapped to the database, with a vpVTCenterIsector used to keep the highest detail imagery loaded nearest the eyepoint. The myVTTechniqueShader class implements a Virtual Texture technique that applies Virtual Texture via vertex and fragment shaders. The class overrides the key virtual methods that it inherits from vsVTTechnique. The shaders are implemented using the Cg language. They simply apply fog and lighting that is provided by the environment.

Relevant Keywords: vsVTTechnique, vpVTVirtualTextureDataset, vpVTVirtualTextureMgr, vrShaderFactory, getOnFirstDrawPalette

 

vsgn_flt_subscriber

This sample illustrates how to retrieve OpenFlight data such as comments and surface material codes (SMC) by using OpenFlight loader subscribers.

Relevant Keywords: vsgn_flt, vsgn_vsb, vrGeometry, fltGeometry, vsNodeLoader, resolveWriteSharing, writeInstance

 

vsgn_user_vsb

This sample illustrates how to extend the Vega Scene Graph by deriving a custom node, and how to extend the vsb loader infrastructure be able to read and write the newly derived node type. Additionally the sample demonstrates how to encrypt a scenegraph binary file by providing a validation request during the reading of the derived node type.

Relevant Keywords: credit card number, vuTime, vsgn_vsb, vsNodeFactory, vsNodeLoader, vsTextureFactory, vsNode

 

vsgn_vsb_socket

This sample illustrates how to use vuFile and vuSocketTCP to transmit a scene graph (in the form of a Vega Scene Graph Binary (vsb)) from one application to another. This functionality, in conjunction with that demonstrated in the vsgs paging service sample can be used to created distributed systems where scene graphs are loaded by the master, and transmitted to the slaves after they are loaded (which minimizes the amount of disk access necessary).

Relevant Keywords: vsApp, vsgn_vsb, vuSocketTCP, vuFile, getLoader, PROP_INLINE_TEXTURES, connect, write, read

 

vsgr_user_element

This sample illustrates the ability to create user defined elements for use with vrState and vrStateMgr. It defines the class myApp, which is derived from vrApp, and overrides the vrApp::onKeyInput() method to allow for the keyboard input described below. The sample creates a user defined element which encapsulates the glPolygonMode and D3DRS_FILLMODE functionality.

Relevant Keywords: glPolygonMode, GL_POLYGON_MODE, GL_CULL_FACE_MODE, vrDrawContext, PolygonFill

 

vsgr_user_geometry

This sample illustrates the ability to create user defined elements for use with vrState and vrStateMgr. It defines the class myApp, which is derived from vrApp, and overrides the vrApp::onKeyInput() method to allow for the keyboard input described below. The sample creates a user defined element which encapsulates the glPolygonMode and D3DRS_FILLMODE functionality.

Relevant Keywords: vuAllocArray, vrGeometryBase, makeCopy, vrState, resetElements, vrDrawContext

 

vsgs_fireworks

This sample illustrates how to generate and modify vrGeometry objects on the fly. In the sample the new geometry is used to render a custom particle system modeled after a fireworks display. Note that the particle positions and sizes are updated every frame through a subscriber. The sample allows the user to fly around the town database and renders a simple reticle overlay at the center of the screen.

Relevant Keywords: vsChannel, vrLightPoint, vsGeometry, vuImageBase, setNumPrimitives, setVertices, setColors, vsApp

 

vsgs_geometry_nodes

This sample illustrates how to create and use geometry nodes supported by VSG. The code creates a sample scene graph (refer to the ::createSceneGraph method). The app also demonstrates how to configure various multi-threading modes and how to re-initialize the VSG framework without quitting the running process.

Relevant Keywords: spinning motion, center of the scene, statistics, vsString, vsLOD, vrLightPointAppearance, vrLightPointAnimation

 

vsgs_isector_attachment

This sample demonstrates how to extend intersection traversal via isector hit attachments. An isector hit is an instance of type vsIsector::Hit. A hit contains the results of the intersection test for a given isector segment such as the intersection node, coordinates of the intersection point, etc. A hit attachment is an instance of a user defined class that is derived from vsIsector::Hit::Attachment that contains the additional data.

Relevant Keywords: vsTraversalIsect , getLocalToGlobalMatrix, vsIsector, vuMemBase, Factory, obtain, recycle, vsGeometry, LocalizedSegments

 

vsgs_overlay_ogl

This sample illustrates how to draw an overlay in VSG by subscribing to vsChannel post draw events. The sample illustrates how to do this with VSG rendering constructs, as well as the lower level graphics library constructs. The sample allows the user to fly around the town database and renders a simple reticle overlay at the center of the screen.

Relevant Keywords: vsApp, vsChannel, glDisable(GL_DEPTH_TEST), glMatrixMode, glPushMatrix, glLoadIdentity, gluOrtho2D, vrDrawContext

 

vsgs_overlay_vsg

This sample illustrates how to draw an overlay in VSG by subscribing to vsChannel post draw events and using VSG rendering constructs. The application defines the class myApp, which is derived from vsApp, and overrides the vsApp::onKeyInput() method to allow for the keyboard input specified below. The sample allows the user to fly around the town database and renders a simple reticle overlay at the center of the screen.

Relevant Keywords: vrTextureFactory, vrMode, vrGeometry, vsLight, vsNodeFactory, setPrimitive

 

vsgs_paging_service

This sample illustrates how to configure an asynchronous paging service. It complements the corresponding section of the "Extending Vega Scene Graph" paper. The sample also demonstrates how to implement an asynchronous recycle bin that is derived from vsServiceMgr::RecycleBin.

Relevant Keywords: breakFrameLoop, addPageRequest, setDesiredFrameRate, vsThread, resolveServiceMgr, setFrameStorage, m_cloneIndex, vuSema, obtainThreadBuffer, onFirstFrame

 

vsgs_qt

This sample illustrates how to embed a vsg window within a Qt application via a custom Qt widget. The sample requires Qt to be installed. It was tested with Qt 3.3.3 (Commercial). See The Trolltech Website for more information regarding Qt.

Relevant Keywords: vsApp, vrRenderStrategy, vrWindow::Mouse, vuString, QMainWindow, vsWindow, setParent, vrWindow::Window

 

vsgs_shader_anisotropic_cg

This sample illustrates how to add a Cg based vertex shader to VSG. The new vertex shader is created directly through a vrShaderFactory. The shader factory is provided a Cg program as input to generate the vrShader object. The shader uses a texture as a look-up table for anisotropic lighting values by storing pre-calculated diffuse values in the texture's RGB components and specular values in its alpha component.

Relevant Keywords: vsApp, vrShaderFactory, vrTextureFactory, vuParameter, obtain, eyePosition, lightDirection, setMinFilter, setWrap

 

vsgs_shader_flag_cg

This sample illustrates how to add Cg based vertex and fragment shaders to VSG. The new vertex and fragments shader created directly through a vrShaderFactory by providing it with a Cg program. The vertex shader modifies the position of vertices on the GPU in such a way as to create a waving flag motion on a rectangular mesh. The flag shader uses a vuParameter (currentAngle) which is automatically bound to the shader object.

Relevant Keywords: vrShader, vsGeometry, vuParameter, vsNode, vrShader::ElementVertex, setMainEntryPointName, setCGProfile

 

vsgs_sort_functor_opaque

This sample illustrates how to create and install sort functors on channel bins for user defined opaque sorting. The sample creates three spheres and allows the user to change the sorting algorithms to view the results. The various sorting algorithms include: no sorting, ordered sorting, and state sorting.

Relevant Keywords: vrTextureBlend, CompareState, vsChannelProxy, OpaqueSorter, stl::sort, vsCullRecord, vsDefaultProcessor, process

 

vsgs_sort_functor_transparent

This sample illustrates how to create and install sort functors on channel bins for user defined transparency sorting. The sample creates two semi-transparent spheres and allows the user to change the sorting algorithms to view the results. The various sorting algorithms include no sorting, back to front sorting, and front to back sorting.

Relevant Keywords: vrSphere, CompareFrontToBack, vsChannelProxy, TransparentSorter, stl::sort, vsDefaultProcessor, vrState, vsChannelBin

 

vsgs_statistics_advanced

This sample demonstrates how to utilize the vuStat framework to collect statistics to disk. The AllocTracerHistogram class monitors the dynamics of memory allocations and deallocations for each memory block size requested by the application. The implementation is based on a technique implemented by the vuAllocTracer class. The statistician class manages statistics from multiple sources, which include framework, pipeline, channel, and scene graph.

Relevant Keywords: IgorPro, wavemetrics, vuStat, vsTraversalUser, vuSet, stl::pair, vuAllocRaw, vuAllocRefBase, stl::map, MemBlocks

 

vsgs_texture_subload

This sample illustrates how to load and subload a texture. The texture loading part consists of loading an image file from disk, creating and configuring a vrTexture object. The sample schedules the texture for subloading with the vsTextureSubloadMgr class that is owned by the pipeline. The application also adds a subscriber to the subloading manager that notifies the application when subloading is done.

Relevant Keywords: getTextureSubloadMgr, setElement, setSubloadableEnable

 

vsgs_user_cull_record

This sample demonstrates how to derive a cull record class to extend scene graph rendering capabilities. The app renders a grid of spheres and uses the cull record class to dynamically change material properties using user defined material manager class. The myCullRecord class overrides the processDraw method by applying material obtained from the material manager myMaterialMgr at random before performing geometry rendering. As a result, the sphere colors change at random.

Relevant Keywords: vrSphere, vrGeometry, vsCullRecord, vrMaterial, setSpecularExponent, vsGeometryBase, setCullRecordFactory

 

vsgs_user_geometry

This sample extends VSG by adding a new node type derived from vsGeometryBase. The new node type simply acts as special scene graph node, which is specially designed to work with vrSphere geometries through two new methods called, setSphere and getSphere. Additionally, the node implements its own custom cull records, which allows the texture coordinates of a vrSphere to be scaled via a texture matrix.

Relevant Keywords: vsGeometryBase, CullRecord, copyPrivateData, vrSphere, VSNODE_SOURCE_INCLUDES_COMPOSITE

 

vsgs_user_node

This sample extends VSG by adding a new node type derived from vsNode. While the new node doesn't do anything graphically noticeable, it does provide a good starting place for those that want to create their own node types. This sample demonstrates how to create data members that support cloning which is necessary for new nodes that add data members that may need to be accessed by services like cull.

Relevant Keywords: vsNode, Reference, Value, copy, compare, syncWithMasterClone, copyPrivateData, vrGeometry, vsGeometry

 

vsgs_user_render_strategy

This sample illustrates how to use the render strategies in VSG. Render strategies can be used to render dynamic geometry, bounding spheres, normals, and is the method by which pre / post draw node callbacks are done in VSG. In this sample, a simple pre / post draw render strategy is created that will force geometry to be rendered with texture disabled.

Relevant Keywords: vrRenderStrategy, vsRenderStrategyFrameData, vrRenderStrategyBounds, vrRenderStrategyNormals, setRenderStrategy

 

vsgs_user_transform

This sample extends VSG by adding a new node type derived from vsNode. While the new node doesn't do anything graphically noticeable, it does provide a good starting place for those who want to derive a transformation node. The myTransform node is a simple uniform scaling transformation.

Relevant Keywords: vsNode, cull, isecto, locate, update, modifyBounds, VSNODE_HEADER_INCLUDES_COMPOSITE, syncWithMasterClone

 

vsgs_user_traversalUp

This sample illustrates how to write a user defined upward scene graph traversal in VSG using vsTraversalUpUser. It defines the class myApp, which is derived from vsApp. The sample generates a scene graph programmatically where a geometry node is multi-parented to two transformation nodes that share a parent (root) node.

Relevant Keywords: vsTraversalUpUser, visit, vsTransform, vsGeometry, vsTraversalLookUpClassType, vsParentLookupTraverseAll

 

vsgu_base

This sample illustrates how to derive classes from vuBase and use its functionality.

Relevant Keywords: vuBase, vuAllocTracer, isExactClassType, find, setName, vsgu::Options, VUMEMBASE_HEADER_INCLUDES, VUCLASSTYPE_HEADER_INCLUDES, VUBASE_HEADER_INCLUDES, VUBASE_HEADER_INCLUDES_COMPOSITE, initializeClass, shutdownClass

 

vsgu_mem_base

This sample illustrates how to derive classes from vuMemBase and use its functionality. The sample also demonstrates how to associate an instance of the vuClassType with a given class.

Relevant Keywords: vuMemBase, vuClassType, copy constructor, assignment operator, operator=, ref, unref, getClassType, getStaticClassType, isOfClassType

 

vsgu_notify_socket

This sample illustrates how to use vuFile and vuSocketTCP to transmit vuNotify debug statements from one application to another. Note that the applications don't have to be running on the same machine. This functionality can be used to remotely debug a running application.

Relevant Keywords: vuFile, vuSocketTCP, vuTime, vuNotify, setLevel, configureToListen, waitForSocketConnection, connect, read, close

 

vsgu_subscriber

This sample illustrates how to use subscribers to receive notification of events within VSG and how to define events for user defined classes.

Relevant Keywords: vuSubscriber, addSubscriber, vuBase, copy, compare, getOptionIndex, OPTION_IGNORE_BASE_CLASS, VUSUBSCRIBER_NOTIFY1, VUSUBSCRIBER_NOTIFY2R

 

vsgu_user_data_trait

This sample illustrates how to create a user data trait for a class derived from vuBase.

Relevant Keywords: vuAllocArray, vuAllocRaw, vuAllocTracer, vuUserData, vuUserDataList, vuUserDataType, vuUserDataTypeTraitMemBase