Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The Win32Context class implements an OpenGLContext using the Win32 API. More...
#include <Win32Context.hpp>
Public Member Functions | |
Win32Context () | |
Win32Context (int w, int h) | |
~Win32Context () | |
virtual HWND | hwnd () const =0 |
HDC | hdc () const |
HGLRC | hglrc () const |
void | shareOpenGLResources (HGLRC hGLRC) |
Use this function when you want two OpenGL contexts to share their resources (display lists, textures, shader objects, buffer objects etc.) Equivalent to wglShareLists(this->hglrc(), hGLRC) | |
void | makeCurrent () |
Sets the OpenGL context as current for the calling thread. | |
void | update () |
If the OpenGLContext is a widget this function requests a redraw and generates an updateEvent(). | |
void | swapBuffers () |
Swaps the back and front buffers to present the last rendering. | |
void | setWindowTitle (const vl::String &title) |
If the OpenGL context is a top window this function sets its title. | |
void | show () |
If the OpenGL context is a widget this function makes it visible to the user. | |
void | hide () |
If the OpenGL context is a widget this function makes it invisible to the user. | |
void | getFocus () |
If the OpenGL context is a widget this function requests the mouse focus on it. | |
void | setMouseVisible (bool visible) |
If the OpenGL context is a widget this function sets whether the mouse is visible over it or not. | |
void | setMousePosition (int x, int y) |
If the OpenGL context is a widget this function sets the mouse position. | |
void | setPosition (int x, int y) |
If the OpenGL context is a widget this function sets its position. | |
vl::ivec2 | position () const |
If the OpenGL context is a widget this function returns its position. | |
void | setSize (int w, int h) |
The actual size of the OpenGL context, i.e. | |
vl::ivec2 | size () const |
The actual size of the OpenGL context, i.e. the client area if this is a window. | |
void | setWindowSize (int w, int h) |
Sets the size of the window. Note that if this Win32Window has window decorations the actual OpenGL context will be smaller than the given w and h parameters. | |
vl::ivec2 | windowSize () const |
Returns the size of the window and not the client area. | |
bool | setFullscreen (bool fullscreen_on) |
If the OpenGL context is a widget this function requests a maximization to fullscreen. | |
void | quitApplication () |
Calls the PostQuitMessage(0) function (Win32 API). | |
const std::vector< int > & | contextAttribs () const |
Context attributes used when creating an OpenGL 3.x / 4.x context. | |
std::vector< int > & | contextAttribs () |
Context attributes used when creating an OpenGL 3.x / 4.x context. | |
void | setContextAttribs (const int *attribs, int size) |
Context attributes used when creating an OpenGL 3.x / 4.x context. | |
Protected Member Functions | |
bool | initWin32GLContext (HGLRC share_context, const vl::String &title, const vl::OpenGLContextFormat &fmt, int x, int y, int width, int height) |
Protected Attributes | |
std::vector< int > | mContextAttribs |
HDC | mHDC |
HGLRC | mHGLRC |
vl::ivec2 | mNormPosit |
vl::ivec2 | mNormSize |
unsigned int | mNormFlags |
The Win32Context class implements an OpenGLContext using the Win32 API.
Definition at line 46 of file Win32Context.hpp.
vlWin32::Win32Context::Win32Context | ( | ) | [inline] |
Definition at line 49 of file Win32Context.hpp.
vlWin32::Win32Context::Win32Context | ( | int | w, |
int | h | ||
) | [inline] |
Definition at line 51 of file Win32Context.hpp.
Win32Context::~Win32Context | ( | ) |
Definition at line 40 of file Win32Context.cpp.
virtual HWND vlWin32::Win32Context::hwnd | ( | ) | const [pure virtual] |
Implemented in vlMFC::MDIWindow, vlMFC::MFCWindow, and vlWin32::Win32Window.
HDC vlWin32::Win32Context::hdc | ( | ) | const [inline] |
Definition at line 57 of file Win32Context.hpp.
Referenced by vlWin32::Win32Window::WindowProc().
HGLRC vlWin32::Win32Context::hglrc | ( | ) | const [inline] |
Definition at line 59 of file Win32Context.hpp.
Referenced by vlMFC::MFCWindow::initMFCWindow(), and vlWin32::Win32Window::WindowProc().
void Win32Context::shareOpenGLResources | ( | HGLRC | hGLRC ) |
Use this function when you want two OpenGL contexts to share their resources (display lists, textures, shader objects, buffer objects etc.) Equivalent to wglShareLists(this->hglrc(), hGLRC)
Definition at line 44 of file Win32Context.cpp.
void Win32Context::makeCurrent | ( | ) | [virtual] |
Sets the OpenGL context as current for the calling thread.
Implements vl::OpenGLContext.
Definition at line 50 of file Win32Context.cpp.
void Win32Context::update | ( | ) | [virtual] |
If the OpenGLContext is a widget this function requests a redraw and generates an updateEvent().
Implements vl::OpenGLContext.
Definition at line 56 of file Win32Context.cpp.
Referenced by vlWin32::dispatchUpdate().
void Win32Context::swapBuffers | ( | ) | [virtual] |
Swaps the back and front buffers to present the last rendering.
Implements vl::OpenGLContext.
Definition at line 162 of file Win32Context.cpp.
void Win32Context::setWindowTitle | ( | const vl::String & | ) | [virtual] |
If the OpenGL context is a top window this function sets its title.
Reimplemented from vl::OpenGLContext.
Definition at line 128 of file Win32Context.cpp.
References vl::String::ptr().
void Win32Context::show | ( | ) | [virtual] |
If the OpenGL context is a widget this function makes it visible to the user.
Reimplemented from vl::OpenGLContext.
Definition at line 134 of file Win32Context.cpp.
void Win32Context::hide | ( | ) | [virtual] |
If the OpenGL context is a widget this function makes it invisible to the user.
Reimplemented from vl::OpenGLContext.
Definition at line 140 of file Win32Context.cpp.
void Win32Context::getFocus | ( | ) | [virtual] |
If the OpenGL context is a widget this function requests the mouse focus on it.
Reimplemented from vl::OpenGLContext.
Definition at line 146 of file Win32Context.cpp.
void Win32Context::setMouseVisible | ( | bool | ) | [virtual] |
If the OpenGL context is a widget this function sets whether the mouse is visible over it or not.
Reimplemented from vl::OpenGLContext.
Definition at line 67 of file Win32Context.cpp.
void Win32Context::setMousePosition | ( | int | , |
int | |||
) | [virtual] |
If the OpenGL context is a widget this function sets the mouse position.
Reimplemented from vl::OpenGLContext.
Definition at line 152 of file Win32Context.cpp.
void Win32Context::setPosition | ( | int | , |
int | |||
) | [virtual] |
If the OpenGL context is a widget this function sets its position.
Reimplemented from vl::OpenGLContext.
Definition at line 76 of file Win32Context.cpp.
vl::ivec2 Win32Context::position | ( | ) | const [virtual] |
If the OpenGL context is a widget this function returns its position.
Reimplemented from vl::OpenGLContext.
Definition at line 103 of file Win32Context.cpp.
void Win32Context::setSize | ( | int | w, |
int | h | ||
) | [virtual] |
The actual size of the OpenGL context, i.e.
the client area if this is a window. Note that if this Win32Window has window decorations the actual window size will be bigger than the given w and h parameters.
Reimplemented from vl::OpenGLContext.
Definition at line 82 of file Win32Context.cpp.
vl::ivec2 Win32Context::size | ( | ) | const |
The actual size of the OpenGL context, i.e. the client area if this is a window.
Definition at line 119 of file Win32Context.cpp.
void Win32Context::setWindowSize | ( | int | w, |
int | h | ||
) |
Sets the size of the window. Note that if this Win32Window has window decorations the actual OpenGL context will be smaller than the given w and h parameters.
Definition at line 95 of file Win32Context.cpp.
vl::ivec2 Win32Context::windowSize | ( | ) | const |
Returns the size of the window and not the client area.
Use the size() method if you need the size of the actual OpenGL rendering context.
Definition at line 111 of file Win32Context.cpp.
bool Win32Context::setFullscreen | ( | bool | ) | [virtual] |
If the OpenGL context is a widget this function requests a maximization to fullscreen.
Reimplemented from vl::OpenGLContext.
Definition at line 168 of file Win32Context.cpp.
References NULL.
void Win32Context::quitApplication | ( | ) | [virtual] |
Calls the PostQuitMessage(0) function (Win32 API).
Reimplemented from vl::OpenGLContext.
Definition at line 62 of file Win32Context.cpp.
const std::vector<int>& vlWin32::Win32Context::contextAttribs | ( | ) | const [inline] |
Context attributes used when creating an OpenGL 3.x / 4.x context.
The flags must be the ones specified by http://www.opengl.org/registry/specs/ARB/wgl_create_context.txt
Definition at line 111 of file Win32Context.hpp.
std::vector<int>& vlWin32::Win32Context::contextAttribs | ( | ) | [inline] |
Context attributes used when creating an OpenGL 3.x / 4.x context.
The flags must be the ones specified by http://www.opengl.org/registry/specs/ARB/wgl_create_context.txt
Definition at line 115 of file Win32Context.hpp.
void Win32Context::setContextAttribs | ( | const int * | attribs, |
int | size | ||
) |
Context attributes used when creating an OpenGL 3.x / 4.x context.
The flags must be the ones specified by http://www.opengl.org/registry/specs/ARB/wgl_create_context.txt
Definition at line 375 of file Win32Context.cpp.
bool Win32Context::initWin32GLContext | ( | HGLRC | share_context, |
const vl::String & | title, | ||
const vl::OpenGLContextFormat & | fmt, | ||
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) | [protected] |
Definition at line 249 of file Win32Context.cpp.
References vlWin32::choosePixelFormat(), vl::Log::error(), vl::OpenGLContextFormat::fullscreen(), vl::OpenGLContextFormat::multisample(), NULL, VL_CHECK, and vl::OpenGLContextFormat::vSync().
std::vector<int> vlWin32::Win32Context::mContextAttribs [protected] |
Definition at line 125 of file Win32Context.hpp.
HDC vlWin32::Win32Context::mHDC [protected] |
Definition at line 127 of file Win32Context.hpp.
HGLRC vlWin32::Win32Context::mHGLRC [protected] |
Definition at line 128 of file Win32Context.hpp.
vl::ivec2 vlWin32::Win32Context::mNormPosit [protected] |
Definition at line 130 of file Win32Context.hpp.
vl::ivec2 vlWin32::Win32Context::mNormSize [protected] |
Definition at line 131 of file Win32Context.hpp.
unsigned int vlWin32::Win32Context::mNormFlags [protected] |
Definition at line 132 of file Win32Context.hpp.