Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

GLWindow Class Reference

OpenGL window. More...

#include <GLWindow.win32.h>

Inherits Frame.

Inheritance diagram for GLWindow:

Inheritance graph
[legend]
Collaboration diagram for GLWindow:

Collaboration graph
[legend]
List of all members.

Public Methods

 GLWindow (const string &t="")
 Default constructor.

virtual ~GLWindow ()
 Destructor.

void setZBufferBits (short z)
 Set Z-buffer bits, only valid before calling create.

bool create ()
 Creates a window and OpenGL context. More...

void quit ()
 Posts a quit message. More...

void swapBuffers ()
 Swaps OpenGL display buffers.

bool getFullscreen ()
 Returns the fullscreen flag.

void fullscreen (bool flag)
 Sets the fullscreen flag. More...

void refreshChildren ()
 Refreshes all child Region instances. More...

bool translateEvent (UINT uMsg, WPARAM wParam, LPARAM lParam, Event &event)
 Translate a WIN32 message to Event. More...

void refresh ()
 Repaints the region. More...

void resize (unsigned short w, unsigned short h)
 Resizes the region. More...

void parseSymbol (Token &t, ObjectFile &file)
 Reads a single parameter sections inside the body of the object description. More...

void writeParams (ostream &stream)
 Writes all parameter sections inside the body of the object description. More...


Protected Methods

virtual void initGL ()
 Initialize OpenGL. More...


Protected Attributes

string title
 Window title.


Detailed Description

OpenGL window.

A dubbel buffered window with an associated OpenGL contex. A GLWindow must be explicitly created using the GLWindow::create method. Currently two versions exists: one based on WIN32 and one on X11.

Format: (see Frame)

    PARAM ::= FS | TITLE
    FS ::= "fullscreen"
    TITLE ::= "title" <string>
    


Member Function Documentation

bool GLWindow::create  
 

Creates a window and OpenGL context.

Creates a Win32 OpenGL window in the following steps:

  • Create and register OpenGL class.
  • Switch to fullscreen mode if needed.
  • Create Win32 window.
  • Create Device context.
  • Set the appropriate Pixel format.
  • Create OpenGL context and make it the current.
  • Show the window.
  • Call GLWindow::initGL.
Postcondition:
OpenGL window is created.
Returns:
True iff succesful.

void GLWindow::fullscreen bool    flag
 

Sets the fullscreen flag.

Set the fullscreen flag to 'flag'. If the window is already created the window settings are set appropriately and the screen is resulution is set to fullscreen mode or restored to its default settings.

Parameters:
flag  New fullscreen value.
See also:
GLApplication::getFullScreenMode.

void GLWindow::initGL   [protected, virtual]
 

Initialize OpenGL.

Initializes the OpenGL context.

Precondition:
Window and OpenGL contex is created.

void GLWindow::parseSymbol Token   t,
ObjectFile   file
[virtual]
 

Reads a single parameter sections inside the body of the object description.

Each object has a set of parameter names associated with it, called symbols. Symbols are declared inside the createSymbols method. The method parseSymbol expects the Token t to be such a symbol and reads the corresponding parameters. Unknown symbols are passed to its super class.

Parameters:
t  Token that is the current parameter symbol.
file  ObjectFile from which to read.
Precondition:
The file is opened for reading and is positioned just after the parameter name.
Postcondition:
The parameter section is read including the terminating semicolon (';').

Reimplemented from Frame.

void GLWindow::quit  
 

Posts a quit message.

Posts a quit message that will be handled by the underlying Application.

See also:
GLApplication.

void GLWindow::refresh   [virtual]
 

Repaints the region.

This method is called whenever the screen is repainted. The repaint method uses OpenGL calls to render the region. Currently it is assumed that regions are refreshed automatically so that no refresh notification has to be done when the region changes state i.e. no refresh has to be forced by the region. Region rendering is done back to front.

Precondition:
An OpenGL context has been created and activated to render in.
Postcondition:
The region is redrawn.

Reimplemented from Frame.

void GLWindow::refreshChildren  
 

Refreshes all child Region instances.

Sets the OpenGL context for 2D rendering and refresh all child Region instances.

Todo:
Correctly reset OpenGL values.

Precondition:
Window and OpenGL contex is created.
Postcondition:
All children are refreshed.

void GLWindow::resize unsigned short    w,
unsigned short    h
[virtual]
 

Resizes the region.

Virtual method to change the size of the Region.

Parameters:
w  New width.
h  New height.
Postcondition:
The region has been resized to (w, h).

Reimplemented from Region.

bool GLWindow::translateEvent UINT    uMsg,
WPARAM    wParam,
LPARAM    lParam,
Event   event
 

Translate a WIN32 message to Event.

Translates the Win32 mesage with parameters to an Event. Mouse positions are cached so that all events have proper mounse coordinates.

Parameters:
uMsg  Win32 message id.
wParam  Win32 message WPARAM.
lParam  Win32 message LPARAM.
event  [out] Translated event.
Precondition:
none.
Postcondition:
Event is filled in with the translated event.
Returns:
True if the translation was succesfull.

void GLWindow::writeParams ostream &    stream [virtual]
 

Writes all parameter sections inside the body of the object description.

This method writes all object parameters to ostream. Inhereting classes will always call super::writeParams().

Parameters:
stream  ostream to which to write.
Precondition:
stream is opened for writing.
Postcondition:
All object parameters are written.

Reimplemented from Frame.


The documentation for this class was generated from the following files:
This documentation was generated using doxygen. If you have any comments or additions please mail me.