Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]

vlWin32::Win32Context Class Reference

The Win32Context class implements an OpenGLContext using the Win32 API. More...

#include <Win32Context.hpp>

Inheritance diagram for vlWin32::Win32Context:

vl::OpenGLContext vl::Object vlMFC::MFCWindow vlWin32::Win32Window

List of all members.

Public Member Functions

 Win32Context ()
 Win32Context (int w, int h)
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.
void makeCurrent ()
void update ()
void swapBuffers ()
void setWindowTitle (const vl::String &title)
void show ()
void hide ()
void getFocus ()
void setMouseVisible (bool visible)
void setMousePosition (int x, int y)
void setPosition (int x, int y)
vl::ivec2 position () const
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)
void quitApplication ()
 Calls the PostQuitMessage(0) function (Win32 API).

Protected Member Functions

bool init (HGLRC share_context, const vl::String &title, const vl::OpenGLContextFormat &fmt, int x, int y, int width, int height)

Protected Attributes

HDC mHDC
HGLRC mHGLRC
vl::ivec2 mNormPosit
vl::ivec2 mNormSize
unsigned mNormFlags


Detailed Description

The Win32Context class implements an OpenGLContext using the Win32 API.

Constructor & Destructor Documentation

vlWin32::Win32Context::Win32Context (  )  [inline]

vlWin32::Win32Context::Win32Context ( int  w,
int  h 
) [inline]


Member Function Documentation

virtual HWND vlWin32::Win32Context::hwnd (  )  const [pure virtual]

Implemented in vlWin32::Win32Window, and vlMFC::MFCWindow.

HDC vlWin32::Win32Context::hdc (  )  const [inline]

HGLRC vlWin32::Win32Context::hglrc (  )  const [inline]

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)

Remarks:
If you want to share resources among two or more OpenGL contexts, you must call this function before you start creating any resources.

void Win32Context::makeCurrent (  )  [virtual]

Reimplemented from vl::OpenGLContext.

void Win32Context::update (  )  [virtual]

Reimplemented from vl::OpenGLContext.

void Win32Context::swapBuffers (  )  [virtual]

Reimplemented from vl::OpenGLContext.

void Win32Context::setWindowTitle ( const vl::String title  )  [virtual]

Reimplemented from vl::OpenGLContext.

void Win32Context::show (  )  [virtual]

Reimplemented from vl::OpenGLContext.

void Win32Context::hide (  )  [virtual]

Reimplemented from vl::OpenGLContext.

void Win32Context::getFocus (  )  [virtual]

Reimplemented from vl::OpenGLContext.

void Win32Context::setMouseVisible ( bool  visible  )  [virtual]

Reimplemented from vl::OpenGLContext.

void Win32Context::setMousePosition ( int  x,
int  y 
) [virtual]

Reimplemented from vl::OpenGLContext.

void Win32Context::setPosition ( int  x,
int  y 
) [virtual]

Reimplemented from vl::OpenGLContext.

vl::ivec2 Win32Context::position (  )  const [virtual]

Reimplemented from vl::OpenGLContext.

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.

vl::ivec2 Win32Context::size (  )  const [virtual]

The actual size of the OpenGL context, i.e. the client area if this is a window.

Reimplemented from vl::OpenGLContext.

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.

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.

Note:
windowSize() can be different from size() because of the space taken by the window caption and decorations.

bool Win32Context::setFullscreen ( bool  fullscreen_on  )  [virtual]

Reimplemented from vl::OpenGLContext.

void Win32Context::quitApplication (  )  [virtual]

Calls the PostQuitMessage(0) function (Win32 API).

Reimplemented from vl::OpenGLContext.

bool Win32Context::init ( HGLRC  share_context,
const vl::String title,
const vl::OpenGLContextFormat fmt,
int  x,
int  y,
int  width,
int  height 
) [protected]


Member Data Documentation

HDC vlWin32::Win32Context::mHDC [protected]

HGLRC vlWin32::Win32Context::mHGLRC [protected]

unsigned vlWin32::Win32Context::mNormFlags [protected]


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

Visualization Library v2009.08 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Tue Dec 29 13:57:10 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.