HOG2
Functions | Variables
GLUtil.cpp File Reference
#include "GLUtil.h"
#include "FPUtil.h"
#include <math.h>
#include <assert.h>
#include <vector>
#include <cstring>
Include dependency graph for GLUtil.cpp:

Go to the source code of this file.

Functions

bool fastCrossTest (float p0_x, float p0_y, float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, float *i_x, float *i_y)
 
bool operator== (const recVec &l1, const recVec &l2)
 
std::ostream & operator<< (std::ostream &out, const recVec &loc)
 
void DrawPyramid (GLfloat x, GLfloat y, GLfloat z, GLfloat height, GLfloat width)
 Draw a pyramid with the tip at the given location, given height, and width from center to edge as width. More...
 
void DrawBoxFrame (GLfloat xx, GLfloat yy, GLfloat zz, GLfloat rad)
 
void DrawBox (GLfloat xx, GLfloat yy, GLfloat zz, GLfloat rad)
 
void DrawCylinder (GLfloat xx, GLfloat yy, GLfloat zz, GLfloat innerRad, GLfloat outerRad, GLfloat height)
 
void OutlineRect (GLdouble left, GLdouble top, GLdouble right, GLdouble bottom, double zz)
 
void DrawSquare (GLdouble xx, GLdouble yy, GLdouble zz, GLdouble rad)
 
void FrameCircle (GLdouble _x, GLdouble _y, GLdouble tRadius, GLdouble lineWidth, int segments, float rotation)
 
void DrawCircle (GLdouble _x, GLdouble _y, GLdouble tRadius, int segments, float rotation)
 
void DrawSphere (GLdouble _x, GLdouble _y, GLdouble _z, GLdouble tRadius)
 
void DrawText (double x, double y, double z, double scale, const char *str)
 
void DrawTextCentered (double x, double y, double z, double scale, const char *str)
 
void SetLighting (GLfloat ambientf, GLfloat diffusef, GLfloat specularf)
 

Variables

GLfloat vertices3 []
 
GLubyte indices []
 

Function Documentation

◆ DrawBox()

void DrawBox ( GLfloat  xx,
GLfloat  yy,
GLfloat  zz,
GLfloat  rad 
)

◆ DrawBoxFrame()

void DrawBoxFrame ( GLfloat  xx,
GLfloat  yy,
GLfloat  zz,
GLfloat  rad 
)

Definition at line 252 of file GLUtil.cpp.

Referenced by AirplaneEnvironment::OpenGLDraw(), and Voxels::OpenGLDraw().

◆ DrawCircle()

void DrawCircle ( GLdouble  _x,
GLdouble  _y,
GLdouble  tRadius,
int  segments,
float  rotation 
)

Definition at line 421 of file GLUtil.cpp.

References rotation, and TWOPI.

Referenced by DoDrawCommands(), DrawGraphics(), and DrawLines().

◆ DrawCylinder()

void DrawCylinder ( GLfloat  xx,
GLfloat  yy,
GLfloat  zz,
GLfloat  innerRad,
GLfloat  outerRad,
GLfloat  height 
)

Definition at line 309 of file GLUtil.cpp.

References height, and TWOPI.

Referenced by AirplaneEnvironment::OpenGLDraw(), and TOH< patternDisks >::OpenGLDraw().

◆ DrawPyramid()

void DrawPyramid ( GLfloat  x,
GLfloat  y,
GLfloat  z,
GLfloat  height,
GLfloat  width 
)

Draw a pyramid with the tip at the given location, given height, and width from center to edge as width.

Definition at line 185 of file GLUtil.cpp.

References height, ROOT2D2, and width.

Referenced by SearchUnit::OpenGLDraw().

◆ DrawSphere()

void DrawSphere ( GLdouble  _x,
GLdouble  _y,
GLdouble  _z,
GLdouble  tRadius 
)

◆ DrawSquare()

void DrawSquare ( GLdouble  xx,
GLdouble  yy,
GLdouble  zz,
GLdouble  rad 
)

◆ DrawText()

void DrawText ( double  x,
double  y,
double  z,
double  scale,
const char *  str 
)

◆ DrawTextCentered()

void DrawTextCentered ( double  x,
double  y,
double  z,
double  scale,
const char *  str 
)

Definition at line 542 of file GLUtil.cpp.

References width.

Referenced by DrawGraphics(), CanonicalGraphEnvironment::OpenGLDraw(), and GraphEnvironment::OpenGLDraw().

◆ fastCrossTest()

bool fastCrossTest ( float  p0_x,
float  p0_y,
float  p1_x,
float  p1_y,
float  p2_x,
float  p2_y,
float  p3_x,
float  p3_y,
float *  i_x,
float *  i_y 
)

Definition at line 160 of file GLUtil.cpp.

Referenced by line2d::crosses().

◆ FrameCircle()

void FrameCircle ( GLdouble  _x,
GLdouble  _y,
GLdouble  tRadius,
GLdouble  lineWidth,
int  segments,
float  rotation 
)

Definition at line 407 of file GLUtil.cpp.

References rotation, and TWOPI.

Referenced by DoDrawCommands(), and DrawGraphics().

◆ operator<<()

std::ostream& operator<< ( std::ostream &  out,
const recVec loc 
)

Definition at line 27 of file GLUtil.cpp.

References loc::x, and loc::y.

◆ operator==()

bool operator== ( const recVec l1,
const recVec l2 
)

Definition at line 22 of file GLUtil.cpp.

References fequal(), recVec::x, and recVec::y.

◆ OutlineRect()

void OutlineRect ( GLdouble  left,
GLdouble  top,
GLdouble  right,
GLdouble  bottom,
double  zz 
)

◆ SetLighting()

void SetLighting ( GLfloat  ambientf,
GLfloat  diffusef,
GLfloat  specularf 
)

Definition at line 565 of file GLUtil.cpp.

Referenced by buildGL().

Variable Documentation

◆ indices

GLubyte indices[]
Initial value:
= { 0, 1, 2, 2, 3, 0,
4, 5, 6, 6, 7, 4,
8, 9,10, 10,11, 8,
12,13,14, 14,15,12,
16,17,18, 18,19,16,
20,21,22, 22,23,20 }

Definition at line 245 of file GLUtil.cpp.

Referenced by DrawBox().

◆ vertices3

GLfloat vertices3[]
Initial value:
= { 1, 1, 1, 0, 0, 1, 1, 1, 1,
-1, 1, 1, 0, 0, 1, 1, 1, 0,
-1,-1, 1, 0, 0, 1, 1, 0, 0,
1,-1, 1, 0, 0, 1, 1, 0, 1,
1, 1, 1, 1, 0, 0, 1, 1, 1,
1,-1, 1, 1, 0, 0, 1, 0, 1,
1,-1,-1, 1, 0, 0, 0, 0, 1,
1, 1,-1, 1, 0, 0, 0, 1, 1,
1, 1, 1, 0, 1, 0, 1, 1, 1,
1, 1,-1, 0, 1, 0, 0, 1, 1,
-1, 1,-1, 0, 1, 0, 0, 1, 0,
-1, 1, 1, 0, 1, 0, 1, 1, 0,
-1, 1, 1, -1, 0, 0, 1, 1, 0,
-1, 1,-1, -1, 0, 0, 0, 1, 0,
-1,-1,-1, -1, 0, 0, 0, 0, 0,
-1,-1, 1, -1, 0, 0, 1, 0, 0,
-1,-1,-1, 0,-1, 0, 0, 0, 0,
1,-1,-1, 0,-1, 0, 0, 0, 1,
1,-1, 1, 0,-1, 0, 1, 0, 1,
-1,-1, 1, 0,-1, 0, 1, 0, 0,
1,-1,-1, 0, 0,-1, 0, 0, 1,
-1,-1,-1, 0, 0,-1, 0, 0, 0,
-1, 1,-1, 0, 0,-1, 0, 1, 0,
1, 1,-1, 0, 0,-1, 0, 1, 1 }

Definition at line 215 of file GLUtil.cpp.

Referenced by DrawBox().