MinVR  0.9.0
A multi-platform virtual reality library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
MinVR::WindowGLFW Class Reference
Inheritance diagram for MinVR::WindowGLFW:
MinVR::AbstractWindow

Public Member Functions

 WindowGLFW (WindowSettingsRef settings, std::vector< AbstractCameraRef > cameras)
 
 ~WindowGLFW ()
 
void pollForInput (std::vector< EventRef > &events)
 Collect window events. More...
 
void swapBuffers ()
 Swaps window buffers. More...
 
void makeContextCurrent ()
 Make the context current. More...
 
void releaseContext ()
 Release the context current. More...
 
int getWidth ()
 
int getHeight ()
 
int getXPos ()
 
int getYPos ()
 
GLFWwindow * getWindowPtr ()
 
void setSize (int width, int height, bool actuallySet)
 
void setPosition (int xPos, int yPos, bool actuallySet)
 
void appendEvent (EventRef newEvent)
 
void setCursorPosition (double x, double y)
 
glm::vec2 getCursorPosition ()
 
- Public Member Functions inherited from MinVR::AbstractWindow
 AbstractWindow (WindowSettingsRef settings, std::vector< AbstractCameraRef > cameras)
 
virtual ~AbstractWindow ()
 
virtual void updateHeadTrackingForAllViewports (glm::mat4 headFrame)
 Updates the current head position. More...
 
WindowSettings::StereoType getStereoType ()
 
int getNumViewports ()
 
MinVR::Rect2D getViewport (int n)
 
AbstractCameraRef getCamera (int n)
 
WindowSettingsRef getSettings ()
 

Static Public Member Functions

static std::map< GLFWwindow
*, WindowGLFW * > 
initPointerToObjectMap ()
 
static void window_size_callback (GLFWwindow *window, int width, int height)
 
static void window_pos_callback (GLFWwindow *window, int xpos, int ypos)
 
static void mouse_button_callback (GLFWwindow *window, int button, int action, int mods)
 
static void cursor_position_callback (GLFWwindow *window, double x, double y)
 
static void cursor_enter_callback (GLFWwindow *window, int entered)
 
static void scroll_callback (GLFWwindow *window, double x, double y)
 
static void key_callback (GLFWwindow *window, int key, int scancode, int action, int mods)
 

Static Public Attributes

static std::map< GLFWwindow
*, WindowGLFW * > 
pointerToObjectMap
 

Additional Inherited Members

- Protected Attributes inherited from MinVR::AbstractWindow
WindowSettingsRef _settings
 
std::vector< MinVR::Rect2D_viewports
 
std::vector< AbstractCameraRef_cameras
 

Constructor & Destructor Documentation

MinVR::WindowGLFW::WindowGLFW ( WindowSettingsRef  settings,
std::vector< AbstractCameraRef cameras 
)
MinVR::WindowGLFW::~WindowGLFW ( )

Member Function Documentation

void MinVR::WindowGLFW::appendEvent ( EventRef  newEvent)

This method is called from the event callback methods to add an event to _currentEvents for the next pollForInput to process

static void MinVR::WindowGLFW::cursor_enter_callback ( GLFWwindow *  window,
int  entered 
)
static
static void MinVR::WindowGLFW::cursor_position_callback ( GLFWwindow *  window,
double  x,
double  y 
)
static
glm::vec2 MinVR::WindowGLFW::getCursorPosition ( )

Gets the most recently updated cursor position in this window

int MinVR::WindowGLFW::getHeight ( )
virtual

Implements MinVR::AbstractWindow.

int MinVR::WindowGLFW::getWidth ( )
virtual

Implements MinVR::AbstractWindow.

GLFWwindow* MinVR::WindowGLFW::getWindowPtr ( )
int MinVR::WindowGLFW::getXPos ( )
virtual

Implements MinVR::AbstractWindow.

int MinVR::WindowGLFW::getYPos ( )
virtual

Implements MinVR::AbstractWindow.

static std::map<GLFWwindow*, WindowGLFW*> MinVR::WindowGLFW::initPointerToObjectMap ( )
static
static void MinVR::WindowGLFW::key_callback ( GLFWwindow *  window,
int  key,
int  scancode,
int  action,
int  mods 
)
static
void MinVR::WindowGLFW::makeContextCurrent ( )
virtual

This method should be implemented for each derived class. It makes the associated context current on the calling thread.

Note
A context can only be current on one thread at a time. RenderThread calls this method for each thread.

Implements MinVR::AbstractWindow.

static void MinVR::WindowGLFW::mouse_button_callback ( GLFWwindow *  window,
int  button,
int  action,
int  mods 
)
static
void MinVR::WindowGLFW::pollForInput ( std::vector< EventRef > &  events)
virtual

This method should be implemented for each derived class. It collects window events and adds them to the events array.

Implements MinVR::AbstractWindow.

void MinVR::WindowGLFW::releaseContext ( )
virtual

This method should be implemented for each derived class. It releases the associated context that is current on the calling thread.

Note
A context can only be current on one thread at a time.

Implements MinVR::AbstractWindow.

static void MinVR::WindowGLFW::scroll_callback ( GLFWwindow *  window,
double  x,
double  y 
)
static
void MinVR::WindowGLFW::setCursorPosition ( double  x,
double  y 
)

This method is called from the cursor position callback to keep track of the current cursor position to send along with mouse events

void MinVR::WindowGLFW::setPosition ( int  xPos,
int  yPos,
bool  actuallySet 
)

This method is called from the window_pos_callback to update the _xPos and _yPos member variables. It can also be used to change the window position if actuallySet is true.

void MinVR::WindowGLFW::setSize ( int  width,
int  height,
bool  actuallySet 
)

This method is called from the window_size_callback to update the _width and _height member variables. It can also be used to change the window size if actuallySet is true.

void MinVR::WindowGLFW::swapBuffers ( )
virtual

This method should be implemented for each derived class. It swaps the front and back opengl buffers.

Implements MinVR::AbstractWindow.

static void MinVR::WindowGLFW::window_pos_callback ( GLFWwindow *  window,
int  xpos,
int  ypos 
)
static
static void MinVR::WindowGLFW::window_size_callback ( GLFWwindow *  window,
int  width,
int  height 
)
static

Member Data Documentation

std::map<GLFWwindow*, WindowGLFW*> MinVR::WindowGLFW::pointerToObjectMap
static

This uglyness is caused because glfw is a C library so its callback functions for key presses, size changes, etc. must be static or regular functions. Unfortunately, we need to access the member variables in the callback functions, so we use this hash table as a way to find the object and access the members.


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