Link Search Menu Expand Document

Package OGL:3D Graphics: cve.render.ogl

Import instruction :

import cve.render.ogl

About :

OGL: A rendering Open GL Service

Table of content

What is it ?

OGL is a basic rendering service based on modern openGL version >1.3 It is dedicated to create the cveogl viewer but can be used alon to create visualisation application.

A OGL application

The following code decribes the basics of an application definition:

app = ogl.OGLApp(False,sys.argv,nb_slave=0)
app.add_keyboard_ogl_node_focuss()
app.add_keyboard_ogl_shortcut()
app.add_keyboard_callback(on_keyboard)
app.add_interaction_callback(on_interaction)
app.add_mouse_callback(on_mouse,True) # True means picking is expected
window=ogl.OGLWindow(name='Oglwindow', size=(700,700), pos=(400,400),at_init=at_init,app=app)
app.main_loop()
  • An OGLApp must be created first. The nb_slave args indicates the max number of sub slaves of the current application. A slave is a rendering which repeat the same scene for description of HMDs and CAVEs.
  • The keyboard and interaction behaviors through callbacks
  • A window is created for rendering. At window creation the at_init function is launched to iniitialize the content to be rendered.
  • The main event loop is started.

Windows and canvas

Lights

Cameras

Nodes

Interactions

Python Dependencies

  • python >= 2.7
  • python-opengl >= 3.1.0
  • python-numpy >= 1.1.12.1
  • python-pil >= 4.0.0-4
  • python-opencv >= 2.4.9.1 (to be withdrawn ?)

Credentials

Copyright Fr. Noël:VISION-R | Author Name | Firstname | email | | —————-|————–|———————————-| | Noël | Frédéric | frederic.noel@grenoble-inp.fr |

Classes

Class summury
FirstPersonCtrl  
OGLCameraCapture Texture loadin a camera capture
OGLCanvas The OGLCanvas class implements the observation of a scene
OGLCubeMap  
OGLDirLight A directional light is a ligth at an infinite position but sending ligth in a given direction
OGLFont  
OGLObjectProps Texture containing transformation matrix of objects
OGLScene An OGLScene is a handle to graphic nodes and ligths
OGLSkyBox A skybox implementation
OGLSpotLight A spot Light as a position and can be oriented
OGLStack OGLStack is a simple class to replace a usual gl matrix stack. It reproduces its basic methods
OGLTexture  
OGLTimer A OGL Timer instance enables to run Timers
OGLVBO  
OGLVideoCapture Texture loadin a video capture
OGLWindow Window management

Functions

Function summury
OGLApp(redirect=False, argv=[], gui=None, nb_slave=None, shared_texture=None) This function creates or returns the single OGLApp_ object for the current process. (more…)
OGLFontLibrary()  
get_oglprops_shape() Define the shape of the single Object Props (more…)
get_oglprops_shared_props() Define a sharable numpy array to store every object properties (more…)
ogl_frustum(left, right, bottom, top, znear, zfar) Build a frustum matrix (more…)
ogl_perspective(fovyInDegrees, aspectRatio, znear, zfar) Build a perspective matrix for a display in front of the camera (centered on the z axis) (more…)
set_default_oglprops_max(maxobject=9000) A texture for objects properties uses 10 pixels per objects. (more…)

Functions details

OGLApp

def OGLApp(redirect=False, argv=[], gui=None, nb_slave=None, shared_texture=None)

This function creates or returns the single OGLApp_ object for the current process.

get_oglprops_shape

def get_oglprops_shape()

Define the shape of the single Object Props linelen and nbparam => size linelen * linelen *nbparam param potential objects

get_oglprops_shared_props

def get_oglprops_shared_props()

Define a sharable numpy array to store every object properties linelen and nbparam => size linelen * linelen *nbparam param potential objects

ogl_frustum

def ogl_frustum(left, right, bottom, top, znear, zfar)

Build a frustum matrix

  • → left side of the display in x direction
  • → right side of the display in x direction
  • → bottom side of the display in y direction
  • → top side of the display in y direction
  • → znear near clipping plane position
  • → zfar far clipping plane position
  • ← the projection matrix

ogl_perspective

def ogl_perspective(fovyInDegrees, aspectRatio, znear, zfar)

Build a perspective matrix for a display in front of the camera (centered on the z axis)

  • → fovyInDegrees field of view angle in degree
  • → aspectRatio the ratio W/H where W is the width and H the height of the display
  • → znear near clipping plane position
  • → zfar far clipping plane position
  • ← the perspective matrix

set_default_oglprops_max

def set_default_oglprops_max(maxobject=9000)

A texture for objects properties uses 10 pixels per objects. linelen is the number of object on a line then it takes a size = linelenx10 pixels The texture is by default size x size.

then with a linelen L , we can set the properties for 10xL**2 objects

if we expect M objects L should be about sqrt(L)/sqrt(10) which is taken slightly higher to ensure the capacity


Table of contents