FaceTracker2
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
COpenGLWnd Class Reference

The OpenGL-enabled window with rendering and basic interaction. More...

#include <OpenGLWndFaceTracker.h>

Inherits CView.

Public Member Functions

bool DrawBackgroundImage ()
 Draw the background image on the screen. More...
 
void displayMessage (char *userMessage, char *caption, int type)
 Implementation of a virtual function from VisageSDK::TrackerGUIInterface. More...
 
void setOpenGLContext ()
 This function is called by method displayResults when it needs to clear the OpenGL window and set the OpenGL context. More...
 
void swapOpenGLBuffers ()
 This function is called by method displayResults when it needs to swap OpenGL buffers. More...
 
BOOL InitOpenGL ()
 Initialize OpenGL. More...
 
void SetContext ()
 Pre-render setup function. More...
 
void ReSizeGLScene (GLsizei width, GLsizei height)
 Initialise. More...
 
void RenderToScreen ()
 Render the model to screen. More...
 
void Close ()
 Closes down and resets renderer. More...
 

Public Attributes

float renderingFrameRate
 Frame rate. More...
 
CRITICAL_SECTION RenderingSection
 Critical section. More...
 

Protected Member Functions

afx_msg int OnCreate (LPCREATESTRUCT lpCreateStruct)
 Initialize OpenGL when window is created.
 

Protected Attributes

HGLRC m_hRC
 Rendering context for drawing the 3D model. More...
 
HGLRC m_hRC1
 Rendering context for tracking. More...
 

Detailed Description

The OpenGL-enabled window with rendering and basic interaction.

This class provides OpenGL context that is needed to visualize tracking results obtained from VisageTracker through FaceData.

Definition at line 32 of file OpenGLWndFaceTracker.h.

Member Function Documentation

void COpenGLWnd::Close ( )

Closes down and resets renderer.

Close down the renderer.

Call this before Initing next model.

Tidy up and close the rendering system.

Definition at line 104 of file OpenGLWndFaceTracker.cpp.

References SetContext().

void COpenGLWnd::displayMessage ( char *  userMessage,
char *  caption,
int  type 
)

Implementation of a virtual function from VisageSDK::TrackerGUIInterface.

VisageTracker calls this function when it needs to display a simple text prompt to the user. The function displays the message and lets the user click "OK" to continue. Essentially it is the same as Windows MessageBox function. Indeed, this implementation simply calls the Windows MessageBox function.

Parameters
userMessagemessage to be displayed
captionthe caption to be displayed on the message window
typetype of message

Definition at line 720 of file OpenGLWndFaceTracker.cpp.

bool COpenGLWnd::DrawBackgroundImage ( )

Draw the background image on the screen.

Load the background image from the file background.jpg the first time this function is called. If loading is succesful, the image is drawn on the screen every time the function is called. This function is called by SetContext(), so it is executed at the beginning of every frame.

Returns
true if image is succesfully drawn, 0 otherwise
See also
SetContext()

Definition at line 457 of file OpenGLWndFaceTracker.cpp.

Referenced by SetContext().

BOOL COpenGLWnd::InitOpenGL ( )

Initialize OpenGL.

Perform necessary OpenGL initializations.

Definition at line 221 of file OpenGLWndFaceTracker.cpp.

References m_hRC, and m_hRC1.

Referenced by OnCreate().

void COpenGLWnd::RenderToScreen ( )

Render the model to screen.

This function is used to render texture on screen.

Render the loaded model to screen. If no model is loaded, clears the screen.

Definition at line 40 of file OpenGLWndFaceTracker.cpp.

References renderingFrameRate, and SetContext().

Referenced by CVisionExampleDoc::OnTrackingStop().

void COpenGLWnd::ReSizeGLScene ( GLsizei  width,
GLsizei  height 
)

Initialise.

Initialise the renderer with a VRMLModel to render. Standard rendering mode is set. The view is set such that the model is fully visible on screen.

This function can be called several times with different models in case more than one model is rendered. Up to 1000 models are supported. Resize window. Resize And Initialize The GL Window.

Parameters
widththe width of the window.
heightthe height of the window.

Definition at line 666 of file OpenGLWndFaceTracker.cpp.

void COpenGLWnd::SetContext ( )

Pre-render setup function.

This function is called before the rendering in each rendering cycle. It sets up the GL context and clears the screen to prepare for the next frame to be rendered.

This is a good place to insert the rendering of other objects in the scene, background image or similar.

Definition at line 367 of file OpenGLWndFaceTracker.cpp.

References DrawBackgroundImage(), and m_hRC.

Referenced by Close(), and RenderToScreen().

void COpenGLWnd::setOpenGLContext ( )

This function is called by method displayResults when it needs to clear the OpenGL window and set the OpenGL context.

The function sets to OpenGL context to a context dedicated to the tracker, then clears the window.

Definition at line 725 of file OpenGLWndFaceTracker.cpp.

References m_hRC1.

void COpenGLWnd::swapOpenGLBuffers ( )

This function is called by method displayResults when it needs to swap OpenGL buffers.

The function calls the OpenGL commands to swap buffers.

Definition at line 753 of file OpenGLWndFaceTracker.cpp.

Member Data Documentation

HGLRC COpenGLWnd::m_hRC
protected

Rendering context for drawing the 3D model.

It is mapped to a viewport in the lower right corner of the main window.

Definition at line 124 of file OpenGLWndFaceTracker.h.

Referenced by InitOpenGL(), and SetContext().

HGLRC COpenGLWnd::m_hRC1
protected

Rendering context for tracking.

It is mapped to a viewport that takes the majority of the main window.

Definition at line 129 of file OpenGLWndFaceTracker.h.

Referenced by InitOpenGL(), and setOpenGLContext().

float COpenGLWnd::renderingFrameRate

Frame rate.

Calculated based on the last 50 rendered frames.

Definition at line 220 of file OpenGLWndFaceTracker.h.

Referenced by RenderToScreen().

CRITICAL_SECTION COpenGLWnd::RenderingSection

Critical section.

Used for thread synchronization during rendering.

Definition at line 227 of file OpenGLWndFaceTracker.h.


The documentation for this class was generated from the following files: