HOG2
Functions | Variables
GLUThog.cpp File Reference
#include "Trackball.h"
#include "Common.h"
#include "GLUThog.h"
#include "TextBox.h"
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <string.h>
Include dependency graph for GLUThog.cpp:

Go to the source code of this file.

Functions

int hog_main (int argc, char **argv)
 
int main (int argc, char **argv)
 
pRecContext GetContext (unsigned long windowID)
 
pRecContext getCurrentContext ()
 
void RunHOGGUI (int argc, char **argv, int windowDimension)
 
void RunHOGGUI (int argc, char *argv[], int xDimension, int yDimension)
 
void createMenus ()
 
void processMenuEvents (int option)
 
void keyPressed (unsigned char key, int, int)
 Called when a key is pressed, and no other keys are held down. More...
 
void mouseMovedNoButton (int x, int y)
 
void mouseMovedButton (int x, int y)
 Called when the mouse is moved with a button pressed down. More...
 
 if (state==GLUT_DOWN)
 
static void mousePan (int x, int y, pRecContext pContextInfo)
 
static void mouseDolly (int x, int y, pRecContext pContextInfo)
 
void renderScene (void)
 Renders the scene. More...
 
void resizeWindow (int x, int y)
 Called when the window is resized. More...
 
void resizeGL (pRecContext pContextInfo, CGRect viewRect)
 Handles resizing of GL need context update and if the window dimensions change, a window dimension update, reseting of viewport and an update of the projection matrix. More...
 
void updateProjection (pRecContext pContextInfo, int viewPort)
 Update the projection matrix based on camera and view info. More...
 
void updateModelView (pRecContext pContextInfo, int currPort)
 Updates the viewpoint of the model. More...
 
void drawCStringGL (char *cstrOut, GLuint fontList)
 Draws a CString in OpenGL. More...
 
void appendTextToBuffer (const char *tempStr)
 
void submitTextToBuffer (const char *val)
 
void DrawGraphics (Graphics::Display &display, int port)
 
void drawGL (pRecContext pContextInfo)
 Main OpenGL drawing function. More...
 
void buildGL (void)
 End OpenGL drawing function - for visualizing trajectory merging. More...
 

Variables

pRecContext pContextInfo
 
GLint gDollyPanStartPoint [2] = {0, 0}
 
GLfloat gTrackBallRotation [4] = {0.0f, 0.0f, 0.0f, 0.0f}
 
GLboolean gDolly = GL_FALSE
 
GLboolean gPan = GL_FALSE
 
GLboolean gTrackball = GL_FALSE
 
pRecContext gTrackingContextInfo = NULL
 
int gCurrButton = -1
 
pRecContext backup
 
double fps = 30.0
 
int modifiers = glutGetModifiers()
 Called when a mouse button is pressed. More...
 
TextBoxmyTextBox = 0
 

Function Documentation

◆ appendTextToBuffer()

void appendTextToBuffer ( const char *  tempStr)

Definition at line 691 of file GLUThog.cpp.

References recContext::message, myTextBox, pContextInfo, point3d, and TextBox::setColor().

◆ buildGL()

void buildGL ( void  )

End OpenGL drawing function - for visualizing trajectory merging.

Initializes OpenGL.

Definition at line 1086 of file GLUThog.cpp.

References CGSize::height, pContextInfo, resizeGL(), SetLighting(), CGRect::size, and CGSize::width.

Referenced by RunHOGGUI().

◆ createMenus()

void createMenus ( )

Definition at line 100 of file GLUThog.cpp.

Referenced by RunHOGGUI().

◆ drawCStringGL()

void drawCStringGL ( char *  cstrOut,
GLuint  fontList 
)

Draws a CString in OpenGL.

Definition at line 680 of file GLUThog.cpp.

◆ drawGL()

void drawGL ( pRecContext  pContextInfo)

◆ DrawGraphics()

void DrawGraphics ( Graphics::Display display,
int  port 
)

◆ GetContext()

pRecContext GetContext ( unsigned long  windowID)

Definition at line 44 of file GLUThog.cpp.

References pContextInfo.

◆ getCurrentContext()

pRecContext getCurrentContext ( )

Definition at line 49 of file GLUThog.cpp.

◆ hog_main()

int hog_main ( int  argc,
char **  argv 
)

Referenced by main().

◆ if()

if ( state  = = GLUT_DOWN)

◆ keyPressed()

void keyPressed ( unsigned char  key,
int  ,
int   
)

Called when a key is pressed, and no other keys are held down.

Definition at line 113 of file GLUThog.cpp.

Referenced by RunHOGGUI().

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 14 of file GLUThog.cpp.

References hog_main().

◆ mouseDolly()

static void mouseDolly ( int  x,
int  y,
pRecContext  pContextInfo 
)
static

◆ mouseMovedButton()

void mouseMovedButton ( int  x,
int  y 
)

Called when the mouse is moved with a button pressed down.

Definition at line 176 of file GLUThog.cpp.

Referenced by RunHOGGUI().

◆ mouseMovedNoButton()

void mouseMovedNoButton ( int  x,
int  y 
)

Definition at line 124 of file GLUThog.cpp.

Referenced by RunHOGGUI().

◆ mousePan()

static void mousePan ( int  x,
int  y,
pRecContext  pContextInfo 
)
static

◆ processMenuEvents()

void processMenuEvents ( int  option)

Definition at line 104 of file GLUThog.cpp.

◆ renderScene()

void renderScene ( void  )

Renders the scene.

Used by GLUT for it's display function. Wraps the drawGL() function.

Definition at line 493 of file GLUThog.cpp.

Referenced by RunHOGGUI().

◆ resizeGL()

void resizeGL ( pRecContext  pContextInfo,
CGRect  viewRect 
)

Handles resizing of GL need context update and if the window dimensions change, a window dimension update, reseting of viewport and an update of the projection matrix.

Definition at line 533 of file GLUThog.cpp.

References recContext::globalCamera, CGSize::height, recContext::numPorts, CGRect::origin, pContextInfo, setPortCamera(), CGRect::size, updateProjection(), recCamera::viewHeight, recCamera::viewOriginX, recCamera::viewOriginY, recCamera::viewWidth, CGSize::width, CGPoint::x, and CGPoint::y.

Referenced by buildGL(), and resizeWindow().

◆ resizeWindow()

void resizeWindow ( int  x,
int  y 
)

Called when the window is resized.

Specific format for GLUT.

Definition at line 513 of file GLUThog.cpp.

Referenced by RunHOGGUI().

◆ RunHOGGUI() [1/2]

void RunHOGGUI ( int  argc,
char **  argv,
int  windowDimension 
)

Definition at line 54 of file GLUThog.cpp.

◆ RunHOGGUI() [2/2]

void RunHOGGUI ( int  argc,
char *  argv[],
int  xDimension,
int  yDimension 
)

◆ submitTextToBuffer()

void submitTextToBuffer ( const char *  val)

Definition at line 704 of file GLUThog.cpp.

References recContext::message, myTextBox, pContextInfo, point3d, and TextBox::setColor().

◆ updateModelView()

void updateModelView ( pRecContext  pContextInfo,
int  currPort 
)

◆ updateProjection()

void updateProjection ( pRecContext  pContextInfo,
int  viewPort 
)

Update the projection matrix based on camera and view info.

Should be called when viewport size, eye z position, or camera aperture changes. Also call if far or near changes which is determined by shape size in this case.

Definition at line 560 of file GLUThog.cpp.

References recCamera::aperture, recFrustum::bottom, recContext::camera, recFrustum::far, recCamera::frust, if(), recFrustum::left, recFrustum::near, recContext::numPorts, pContextInfo, recFrustum::right, recFrustum::top, recCamera::viewHeight, and recCamera::viewWidth.

Referenced by mouseDolly(), mouseMovedButton(), and resizeGL().

Variable Documentation

◆ backup

pRecContext backup

Definition at line 41 of file GLUThog.cpp.

◆ fps

double fps = 30.0

Definition at line 42 of file GLUThog.cpp.

Referenced by renderScene().

◆ gCurrButton

int gCurrButton = -1

Definition at line 38 of file GLUThog.cpp.

Referenced by if(), and mouseMovedButton().

◆ gDolly

GLboolean gDolly = GL_FALSE

Definition at line 34 of file GLUThog.cpp.

Referenced by if(), and mouseMovedButton().

◆ gDollyPanStartPoint

GLint gDollyPanStartPoint[2] = {0, 0}

Definition at line 32 of file GLUThog.cpp.

Referenced by if(), mouseDolly(), mouseMovedNoButton(), and mousePan().

◆ gPan

GLboolean gPan = GL_FALSE

Definition at line 35 of file GLUThog.cpp.

Referenced by if(), mouseMovedButton(), and mouseMovedNoButton().

◆ gTrackball

GLboolean gTrackball = GL_FALSE

Definition at line 36 of file GLUThog.cpp.

Referenced by if(), and mouseMovedButton().

◆ gTrackBallRotation

GLfloat gTrackBallRotation[4] = {0.0f, 0.0f, 0.0f, 0.0f}

Definition at line 33 of file GLUThog.cpp.

Referenced by if(), mouseMovedButton(), and updateModelView().

◆ gTrackingContextInfo

pRecContext gTrackingContextInfo = NULL

Definition at line 37 of file GLUThog.cpp.

Referenced by if(), mouseMovedNoButton(), and updateModelView().

◆ modifiers

int modifiers = glutGetModifiers()

Called when a mouse button is pressed.

Definition at line 241 of file GLUThog.cpp.

Referenced by if().

◆ myTextBox

TextBox* myTextBox = 0

Definition at line 689 of file GLUThog.cpp.

Referenced by appendTextToBuffer(), drawGL(), and submitTextToBuffer().

◆ pContextInfo

pRecContext pContextInfo