Central viewer managing window, controllers, animations, and main loop.
More...
#include "Viewer.h"
|
static void | errorCB_ (int error, const char *description) |
|
static void | framebufferSizeCB_ (GLFWwindow *window, int width, int height) |
|
Central viewer managing window, controllers, animations, and main loop.
A few static functions are required for GLFW callbacks.
- Examples
- scg3_table_scene_example.cpp.
Definition at line 108 of file Viewer.h.
◆ Viewer()
◆ ~Viewer()
virtual scg::Viewer::~Viewer |
( |
| ) |
|
|
virtual |
◆ addAnimation()
Add animation to be updated in main loop.
- Returns
- this pointer for method chaining
◆ addAnimations() [1/2]
Add animations to be updated in main loop.
- Returns
- this pointer for method chaining
◆ addAnimations() [2/2]
Add animations to be updated in main loop.
- Returns
- this pointer for method chaining
◆ addController()
Add controller to be checked in main loop, e.g., a camera controller.
- Returns
- this pointer for method chaining
◆ addControllers() [1/2]
Add controllers to be checked in main loop, e.g., a camera controller.
- Returns
- this pointer for method chaining
- Examples
- scg3_table_scene_example.cpp.
◆ addControllers() [2/2]
Add controllers to be checked in main loop, e.g., a camera controller.
- Returns
- this pointer for method chaining
◆ create()
◆ createFullscreenWindow()
Viewer* scg::Viewer::createFullscreenWindow |
( |
const char * |
title | ) |
|
Create OpenGL context, open fullscreen window with given title, hide mouse cursor, and initialize GLEW.
- Returns
- this pointer for method chaining
◆ createWindow()
Viewer* scg::Viewer::createWindow |
( |
const char * |
title, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
Create OpenGL context, open window with given title and dimensions, and initialize GLEW.
- Returns
- this pointer for method chaining
◆ createWindow_()
void scg::Viewer::createWindow_ |
( |
const char * |
title, |
|
|
int |
width, |
|
|
int |
height, |
|
|
bool |
fullscreenMode |
|
) |
| |
|
protected |
Create OpenGL context, open window with given title, dimensions, and fullscreen mode, and initialize GLEW. Called by createWindow() and createFullscrennWindow().
◆ errorCB_()
static void scg::Viewer::errorCB_ |
( |
int |
error, |
|
|
const char * |
description |
|
) |
| |
|
staticprotected |
GLFW error callback function.
◆ framebufferSizeCB_()
static void scg::Viewer::framebufferSizeCB_ |
( |
GLFWwindow * |
window, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
|
staticprotected |
GLFW callback function for framebuffer resize event. Note: Use glfwSetFramebufferSizeCallback() instead of glfwSetWindowSizeCallback() to correctly handle Mac Retina display
◆ getWindowSize()
void scg::Viewer::getWindowSize |
( |
int & |
width, |
|
|
int & |
height |
|
) |
| const |
Get current window dimensions.
◆ init()
Initialize GLFW with given renderer.
- Returns
- this pointer for method chaining
◆ initSimpleRenderer() [1/2]
Initialize viewer with default renderer, Gouraud shader, perspective camera, and empty scene (with child node camera).
- Parameters
-
camera | unallocated pointer |
scene | unallocated pointer |
- Returns
- this pointer for method chaining
◆ initSimpleRenderer() [2/2]
Initialize viewer with default renderer, Gouraud shader, perspective camera, directed light, and empty scene (with child nodes camera and light).
- Parameters
-
camera | unallocated pointer |
scene | unallocated pointer |
light | unallocated pointer |
- Returns
- this pointer for method chaining
◆ isWindowResized()
bool scg::Viewer::isWindowResized |
( |
| ) |
|
Check if window has been resized since last call of this method. The internal resize flag is cleared afterwards.
◆ processAnimations_()
void scg::Viewer::processAnimations_ |
( |
| ) |
|
|
protected |
◆ processControllers_()
void scg::Viewer::processControllers_ |
( |
| ) |
|
|
protected |
◆ SCG_DISALLOW_COPY_AND_ASSIGN()
scg::Viewer::SCG_DISALLOW_COPY_AND_ASSIGN |
( |
Viewer |
| ) |
|
|
private |
Disallow copy constructor and assignment operator.
◆ setOpenGLConfig()
Set OpenGL configuration. In order to take effect, this method has to be called before init().
- Returns
- this pointer for method chaining
◆ setWindowSize()
Viewer* scg::Viewer::setWindowSize |
( |
int |
width, |
|
|
int |
height |
|
) |
| |
Set window dimensions.
- Returns
- this pointer for method chaining
◆ setWindowTitle()
Viewer* scg::Viewer::setWindowTitle |
( |
const char * |
title | ) |
|
Set window title.
- Returns
- this pointer for method chaining
◆ startAnimations()
Viewer* scg::Viewer::startAnimations |
( |
| ) |
|
Start all animations.
- Returns
- this pointer for method chaining
◆ startMainLoop()
void scg::Viewer::startMainLoop |
( |
| ) |
|
Start main loop, periodically check input devices and render scene.
◆ animations_
◆ controllers_
◆ frameBufferClearMask_
GLbitfield scg::Viewer::frameBufferClearMask_ |
|
protected |
◆ frameBufferSize_
◆ isInstantiated_
bool scg::Viewer::isInstantiated_ |
|
staticprotected |
◆ isWindowResized_
bool scg::Viewer::isWindowResized_ |
|
staticprotected |
◆ oglConfig_
◆ oglVersion_
int scg::Viewer::oglVersion_ |
|
protected |
◆ renderer_
◆ viewState_
◆ window_
GLFWwindow* scg::Viewer::window_ |
|
protected |
The documentation for this class was generated from the following file: