Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions
omni::visual::Rectangle Struct Reference

Visualizer helper class for drawing a rectangle in an OpenGL context. More...

#include <Rectangle.h>

Static Public Member Functions

static void draw (float _left=-0.5, float _right=0.5, float _top=0.5, float _bottom=-0.5)
 Draw rectangle from border coordinates. More...
 
static void draw (QSize const &_size)
 
static void draw (QRectF const &)
 Draw rectangle from given QRectF. More...
 
static void drawFlipped (float _left=-0.5, float _right=0.5, float _top=0.5, float _bottom=-0.5)
 Draw rectangle from border coordinates, flipped on y axis version. More...
 
static void drawFlipped (QRectF const &)
 Draw rectangle from given QRectF, flipped on y axis version. More...
 

Detailed Description

Visualizer helper class for drawing a rectangle in an OpenGL context.

Member Function Documentation

void omni::visual::Rectangle::draw ( float  _left = -0.5,
float  _right = 0.5,
float  _top = 0.5,
float  _bottom = -0.5 
)
static

Draw rectangle from border coordinates.

29  {
30  glBegin(GL_QUADS);
31  {
32  glTexCoord2f(0.0f, 1.0f);
33  glVertex2f(_left, _bottom);
34  glTexCoord2f(1.0f, 1.0f);
35  glVertex2f(_right, _bottom);
36  glTexCoord2f(1.0f, 0.0f);
37  glVertex2f(_right, _top);
38  glTexCoord2f(0.0f, 0.0f);
39  glVertex2f(_left, _top);
40  }
41  glEnd();
42  }
void omni::visual::Rectangle::draw ( QSize const &  _size)
static
44  {
45  withCurrentContext([&](QOpenGLFunctions& _) {
46  glBegin(GL_QUADS);
47  {
48  int _w = _size.width();
49  int _h = _size.height();
50  glTexCoord2f(0.0f, _h);
51  glVertex2f(-0.5, -0.5);
52  glTexCoord2f(_w, _h);
53  glVertex2f(0.5, -0.5);
54  glTexCoord2f(_w, 0.0f);
55  glVertex2f(0.5, 0.5);
56  glTexCoord2f(0.0f, 0.0f);
57  glVertex2f(-0.5, 0.5);
58  }
59  glEnd();
60  });
61  }
void withCurrentContext(ContextFunctor f)
Do OpenGL operations with current context, if it exists.
Definition: ContextSwitch.cpp:45
void omni::visual::Rectangle::draw ( QRectF const &  _rect)
static

Draw rectangle from given QRectF.

64  {
65  Rectangle::draw(_rect.left(), _rect.right(), _rect.top(), _rect.bottom());
66  }
static void draw(float _left=-0.5, float _right=0.5, float _top=0.5, float _bottom=-0.5)
Draw rectangle from border coordinates.
Definition: Rectangle.cpp:28
void omni::visual::Rectangle::drawFlipped ( float  _left = -0.5,
float  _right = 0.5,
float  _top = 0.5,
float  _bottom = -0.5 
)
static

Draw rectangle from border coordinates, flipped on y axis version.

72  {
73  glBegin(GL_QUADS);
74  {
75  glTexCoord2f(0.0f, 0.0f);
76  glVertex2f(_left, _bottom);
77  glTexCoord2f(1.0f, 0.0f);
78  glVertex2f(_right, _bottom);
79  glTexCoord2f(1.0f, 1.0f);
80  glVertex2f(_right, _top);
81  glTexCoord2f(0.0f, 1.0f);
82  glVertex2f(_left, _top);
83  }
84  glEnd();
85  }
void omni::visual::Rectangle::drawFlipped ( QRectF const &  _rect)
static

Draw rectangle from given QRectF, flipped on y axis version.

88  {
89  Rectangle::drawFlipped(_rect.left(), _rect.right(),
90  _rect.top(), _rect.bottom());
91  }
static void drawFlipped(float _left=-0.5, float _right=0.5, float _top=0.5, float _bottom=-0.5)
Draw rectangle from border coordinates, flipped on y axis version.
Definition: Rectangle.cpp:68

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