DUECA/DUSIME
Loading...
Searching...
No Matches
DuecaGLFWWindow Class Referenceabstract

Provides a DUECA shell around a window with a glfw. More...

#include <DuecaGLFWWindow.hxx>

Public Member Functions

 DuecaGLFWWindow (const char *window_title="DUECA", bool pass_passive=false, bool depth_buffer=true, bool stencil_buffer=false)
 Constructor.
 
 ~DuecaGLFWWindow ()
 Destructor.
 
bool setFullScreen (const bool &fs=true)
 Request full screen drawing – or not.
 
bool setWindow (const std::vector< int > &wpos)
 Set the window position, at least if the window manager will honour this.
 
void setWindow (int posx, int poxy, int width, int height)
 Set up the window initial position and size.
 
void openWindow ()
 Do the opening and displaying of the window.
 
void placeWindow ()
 If position given, place the window.
 
void selectCursor (int cursor)
 Select cursor type.
 
void redraw ()
 Indicate that a redraw of the window is needed.
 
void swapBuffers ()
 Swap front and back buffers.
 
bool selectGraphicsContext (bool do_select=true)
 Set the graphics content as current.
 
void makeCurrent ()
 If you want to do GL work outside the draw routine (add GL lists etc.) the window needs to be current.
 
void newSize (int w, int h)
 Specify a new size.
 
int getWidth ()
 Information function, retrieve width.
 
int getHeight ()
 Information function, retrieve height.
 
int getXOffset ()
 Retrieve x position.
 
int getYOffset ()
 Retrieve y position.
 
virtual void display ()=0
 Function to implement in a derived class.
 
virtual void initGL ()
 Function to implement in a derived class.
 
virtual void reshape (int x, int y)
 callback function, override to get notified of shape changes
 
virtual void keyboard (char c, int x, int y)
 callback function, override to get notified of keypresses
 
virtual void special (int c, int x, int y)
 callback function, override to get notified of special key presses
 
virtual void motion (int x, int y)
 mouse motion, with pressed key
 
virtual void passive (int x, int y)
 mouse motion, nothing pressed
 
virtual void mouse (int button, int state, int x, int y)
 mouse button press actions
 

Public Attributes

int cur_x
 Cursor position.
 
int cur_y
 Cursor position.
 

Detailed Description

Provides a DUECA shell around a window with a glfw.

After deriving from this class, you should implement the GL drawing routine.

You can also implement callbacks for reshape, initialisation and mouse and keyboard events.

Also note that under "modern" desktops, you would get a Wayland window, and these use OpenGL ES, rather than the "classic" desktop OpenGL you might be used to. The shaders you use need to be compliant with ES, see

this WikiPedia page

As far as I can tell it is not possible to mix this in the same DUECA process with X11 GL windows.

Constructor & Destructor Documentation

◆ DuecaGLFWWindow()

DuecaGLFWWindow::DuecaGLFWWindow ( const char * window_title = "DUECA",
bool pass_passive = false,
bool depth_buffer = true,
bool stencil_buffer = false )

Constructor.

Parameters
window_titleTitle for the window
pass_passiveFor compatibility, passive movement always passed.

Member Function Documentation

◆ setFullScreen()

bool DuecaGLFWWindow::setFullScreen ( const bool & fs = true)

Request full screen drawing – or not.

Can be linked to Scheme in a parameter table. This call is ignored for

◆ setWindow() [1/2]

bool DuecaGLFWWindow::setWindow ( const std::vector< int > & wpos)

Set the window position, at least if the window manager will honour this.

Can be linked to Scheme in a parameter table. Use this call before opening the window with openWindow.

◆ setWindow() [2/2]

void DuecaGLFWWindow::setWindow ( int posx,
int poxy,
int width,
int height )

Set up the window initial position and size.

Honouring of initial position depends on the window manager. Use this call before opening the window with openWindow.

◆ openWindow()

void DuecaGLFWWindow::openWindow ( )

Do the opening and displaying of the window.

In your module, preferably place this call in the "complete()" method. At this time, all GL stuff is in place, while the system is normally not yet running real-time.

◆ selectCursor()

void DuecaGLFWWindow::selectCursor ( int cursor)

Select cursor type.

  • 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

◆ selectGraphicsContext()

bool DuecaGLFWWindow::selectGraphicsContext ( bool do_select = true)

Set the graphics content as current.

Note that this is normally not needed, in the initGL, display and reshape callbacks, the GC will be current. You can use this in your destructor, when GL objects are deleted, and you need a correct GC for that.

Parameters
do_selectWhen false, resets the GC

◆ makeCurrent()

void DuecaGLFWWindow::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.

◆ display()

virtual void DuecaGLFWWindow::display ( )
pure virtual

Function to implement in a derived class.

Can assume that the GL context is current, do not need a swap call at the end! Only draw!

◆ initGL()

virtual void DuecaGLFWWindow::initGL ( )
virtual

Function to implement in a derived class.

Called with the GL context current.


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