DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
dueca::DuecaGLCanvas Class Referenceabstract

A DuecaGLCanvas is the interface between the DUECA world and OpenGL drawing. More...

#include <DuecaGLCanvas.hxx>

Inheritance diagram for dueca::DuecaGLCanvas:
Inheritance graph
[legend]

Public Member Functions

 DuecaGLCanvas ()
 Constructor.
 
virtual ~DuecaGLCanvas ()
 destructor.
 
void selectCursor (int cursor)
 Select a cursor type.
 
void redraw ()
 Indicate that a redraw of the window is needed.
 
void swapBuffers ()
 Swap front and back buffers.
 
void makeCurrent ()
 If you want to do GL work outside the draw routine (add GL lists etc.) the window needs to be current.
 
virtual void reshape (int x, int y)
 This is called if the size of the window is changed.
 
virtual void display ()=0
 This is called whenever the display needs to be redrawn.
 
virtual void initGL ()
 This is called when the window is ready, for first-time set-up.
 
int getWidth ()
 Obtain the current widget width.
 
int getHeight ()
 Obtain the current widget height.
 
int getXOffset ()
 Obtain current widget x-position.
 
int getYOffset ()
 Obtain current widget y-position.
 
GLWindowHelper * getOpenGLHelper ()
 Return a pointer to the GLWindowHelper object.
 

Protected Member Functions

void widgetDestroyed ()
 Notification that the window is being destroyed.
 
void redrawDone ()
 Indicate that the redraw has taken place.
 
bool checkAndMarkInitDone ()
 return true if GL initialisation still has to be done, mark that it has been done.
 

Protected Attributes

GLWindowHelper * helper
 Defines a class for implementation-dependent data.
 
bool marked_for_redraw
 Remembers whether the display was already marked for redraw.
 
bool gl_initialised
 Flag to remember whether GL initialisation has taken place.
 

Friends

void redraw_done (DuecaGLCanvas *gw)
 redrawDone is called by the callback thingies in Gtk, Glut etc.
 
bool check_and_mark_init_done (DuecaGLCanvas *gw)
 checkAndMarkInitDone is called by the callback thingies in Gtk, Glut etc.
 

Detailed Description

A DuecaGLCanvas is the interface between the DUECA world and OpenGL drawing.

Independently of the windowing toolkit that is used – provided that this toolkit is GL capable – you can use the DuecaGLCanvas to open and manipulate a GL view.

DuecaGLCanvas is not used for gtk3; to get this functionality, either use a full-gl DuecaGLWindow (which is implemented through X11 directly), or insert a GtkGLArea widget in your gtk code, and use the gtk3 version of DuecaGLWidget to get event callbacks and implement the GL drawing routine.

Note that the toolkit usage depends on the inclusion of the proper code with DCOMPONENTS in your project's main Makefile, and the toolkit is selected with the make-environment call, in dueca.cnf.

Member Function Documentation

◆ selectCursor()

void dueca::DuecaGLCanvas::selectCursor ( int cursor)

Select a cursor type.

The following types are available:

  • 0, no cursor
  • 1, the same cursor as the master (root) window
  • 2, a crosshair cursor
  • 3, a right arrow pointer
  • 4, a left arrow pointer

◆ makeCurrent()

void dueca::DuecaGLCanvas::makeCurrent ( )

If you want to do GL work outside the draw routine (add GL lists etc.) the window needs to be current.

First call this routine in that case.

◆ reshape()

virtual void dueca::DuecaGLCanvas::reshape ( int x,
int y )
virtual

This is called if the size of the window is changed.

Prototypes for interaction handling. This class adheres to – as much as is practical – the calling conventions for Glut. You might need to update the image set-up for a different screen format.

◆ display()

virtual void dueca::DuecaGLCanvas::display ( )
pure virtual

This is called whenever the display needs to be redrawn.

When called, the appropriate window has been made current.

◆ initGL()

virtual void dueca::DuecaGLCanvas::initGL ( )
virtual

This is called when the window is ready, for first-time set-up.

DO NOT CALL THIS FUNCTION YOURSELF! Override this function, and when it is called, you can assume the gl code is possible. So creating viewports, GL lists, allocating textures etc. can be done in initGL.

◆ getOpenGLHelper()

GLWindowHelper * dueca::DuecaGLCanvas::getOpenGLHelper ( )
inline

Return a pointer to the GLWindowHelper object.

Currently the only application of this is further querying your window, in the case you have a glui (glut + glui) interface. Use with care, note that the type of helper you get back depends on the windowing toolkit configured; use a dynamic_cast to verify that the configuration matches your assumptions.

Friends And Related Symbol Documentation

◆ redraw_done

void redraw_done ( DuecaGLCanvas * gw)
friend

redrawDone is called by the callback thingies in Gtk, Glut etc.

Only these need access, therefore a friend is declared.

◆ check_and_mark_init_done

bool check_and_mark_init_done ( DuecaGLCanvas * gw)
friend

checkAndMarkInitDone is called by the callback thingies in Gtk, Glut etc.

Only these need access, therefore a friend is declared.

Member Data Documentation

◆ helper

GLWindowHelper* dueca::DuecaGLCanvas::helper
protected

Defines a class for implementation-dependent data.

The data needed depends on the GUI toolset(s) supported by this build of DUECA.


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