libGLV
0.4.0
|
The GLV library provides a small, cross-platform interface for creating a window or fullscreen display with an OpenGL context. More...
#include <GL/glx.h>
Go to the source code of this file.
Data Structures | |
struct | GLViewEvent |
The GLViewEvent struct is passed to the event handler callback. More... | |
struct | GLView |
The GLView struct... More... | |
struct | GLViewMode |
The GLViewMode struct holds information about a video mode. More... | |
Macros | |
#define | GLV_MODEID_WINDOW -1 |
Functions | |
int | glv_queryModes (GLViewMode_f func, void *) |
GLView * | glv_create (int attributes, int glVersion) |
void | glv_destroy (GLView *view) |
int | glv_attributes (GLView *view) |
int | glv_dpi (GLView *view) |
int | glv_changeMode (GLView *view, const GLViewMode *mode) |
void | glv_swapBuffers (GLView *view) |
void | glv_makeCurrent (GLView *view) |
void | glv_show (GLView *view) |
void | glv_hide (GLView *view) |
void | glv_setTitle (GLView *view, const char *title) |
void | glv_move (GLView *view, int x, int y) |
void | glv_resize (GLView *view, int w, int h) |
void | glv_raise (GLView *view) |
void | glv_iconify (GLView *view) |
void | glv_showCursor (GLView *view, int on) |
void | glv_setEventHandler (GLView *view, GLViewEvent_f func) |
void | glv_waitEvent (GLView *view) |
void | glv_handleEvents (GLView *view) |
void | glv_filterRepeatKeys (GLView *view, int on) |
int | glv_clipboardText (GLView *view, void(*func)(const char *data, int len, void *user), void *user) |
The GLV library provides a small, cross-platform interface for creating a window or fullscreen display with an OpenGL context.
Here is a short example of how to use GLV:
#define GLV_MODEID_WINDOW -1 |
A GLViewMode::id of GL_MODEID_WINDOW means the GLView is a window on the desktop rather than a fullscreen mode.
int glv_attributes | ( | GLView * | view | ) |
Returns a mask of GL_ATTRIB_* bits which apply to the view.
int glv_changeMode | ( | GLView * | view, |
const GLViewMode * | mode | ||
) |
Returns non-zero if successful. It must not be called from within an input handler function.
To make a window for the view use the following code:
References GLV_MODEID_WINDOW, GLView::height, GLViewMode::height, GLViewMode::id, GLViewEvent::type, GLView::width, and GLViewMode::width.
int glv_clipboardText | ( | GLView * | view, |
void(*)(const char *data, int len, void *user) | func, | ||
void * | user | ||
) |
Calls func with the current system clipboard text.
GLView* glv_create | ( | int | attributes, |
int | glVersion | ||
) |
Creates a view. Returns a GLView pointer or zero if the view could not be created.
If glv_create fails then no other GLV function should be called (though it is safe to call glv_destroy()).
A valid view may be returned even if all attributes could not be set. Use glv_attributes() to check which are set.
attributes | The possible attributes are GLV_ATTRIB_DOUBLEBUFFER, GLV_ATTRIB_STENCIL, GLV_ATTRIB_MULTISAMPLE, GLV_ATTRIB_ES, and GLV_ATTRIB_DEBUG. Only RGBA visuals will be created. |
glVersion | This contains the OpenGL major version in bits 8-15 and the minor in bits 0-7, so version 3.2 is 0x302. If zero, no specific version is requested. |
int glv_dpi | ( | GLView * | view | ) |
Returns vertical dots per inch of display.
void glv_filterRepeatKeys | ( | GLView * | view, |
int | on | ||
) |
Enables or disables key repeat for the view. Repeat is on by default.
void glv_handleEvents | ( | GLView * | view | ) |
Calls the event handler for all pending events.
This should be called periodically (e.g. from your main loop).
References GLViewEvent::type.
void glv_hide | ( | GLView * | view | ) |
Hides the window.
void glv_iconify | ( | GLView * | view | ) |
Minimizes the window.
void glv_makeCurrent | ( | GLView * | view | ) |
Makes the GL context of the view current.
void glv_move | ( | GLView * | view, |
int | x, | ||
int | y | ||
) |
Positions window on screen. Should only be called when in windowed mode.
int glv_queryModes | ( | GLViewMode_f | func, |
void * | data | ||
) |
Calls func for each mode and returns the number of available fullscreen modes.
void glv_raise | ( | GLView * | view | ) |
Show window on top of all other windows.
void glv_resize | ( | GLView * | view, |
int | w, | ||
int | h | ||
) |
Sets window dimensions. Should only be called when in windowed mode.
void glv_setEventHandler | ( | GLView * | view, |
GLViewEvent_f | func | ||
) |
Sets the function called during glv_handleEvents()
void glv_setTitle | ( | GLView * | view, |
const char * | title | ||
) |
Sets window title and icon name.
void glv_show | ( | GLView * | view | ) |
Makes the window visible.
void glv_showCursor | ( | GLView * | view, |
int | on | ||
) |
Show or hide the native mouse pointer. There are no provisions to set the native pointer image. It is assumed that a GL primitive will be used for custom pointers.
void glv_swapBuffers | ( | GLView * | view | ) |
Swaps the GL buffers of the view.
void glv_waitEvent | ( | GLView * | view | ) |
Waits until an event is recieved.