gtk_opengl.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include "../ut/ut_umem.h"
#include "../gui/gui_types.h"
#include "../gui/gui_base.h"
#include "../gui_gtk/gtk_base.h"
#include "../gui_gtk/gtk_opengl.h"
Functions |
int | GUI_gl_set_active (int mode, MemObj *mo) |
MemObj | GUI_gl__ (MemObj *o_par, void *fDraw, int hsiz, int vsiz) |
int | GUI_gl_ev_move (MemObj *mo, void *fMove) |
int | GUI_gl_ev_button (MemObj *mo, void *fButton) |
| GUI_gl_ev_test (MemObj *mo) |
int | GUI_gl_ev_key (MemObj *mo, void *fKey) |
int | GUI_gl_block (MemObj *mo, int mode) |
int | GUI_gl_draw (void *parent, void *event, MemObj mo) |
int | GUI_gl_move (void *parent, void *event, MemObj mo) |
int | GUI_gl_button (void *parent, void *ev, MemObj mo) |
int | GUI_gl_key (void *parent, void *event, MemObj mo) |
int | GUI_gl_idle1 (void *data) |
Variables |
GtkWidget * | UI_MainWin |
GtkWidget * | UI_act_wi |
static Obj_GLwin * | UI_win_gl |
Detailed Description
Function Documentation
int GUI_gl_set_active |
( |
int |
mode, |
|
|
MemObj * |
mo | |
|
) |
| | |
GUI_gl_set_active activate/disactivate output to gl-window
mode 1=activate (call before using gl-functions)
0=disactivate; (call after gl-functions = execute)
must be used for all gl*-functions
MemObj GUI_gl__ |
( |
MemObj * |
o_par, |
|
|
void * |
fDraw, |
|
|
int |
hsiz, |
|
|
int |
vsiz | |
|
) |
| | |
GUI_gl__ get opengl-window; connect redraw- and resize-event
Input:
o_par parentBox
fDraw callback-function redraw-, resize-event
hsiz,vsiz minimum-size of opengl-window in screencoords
Prototypes:
int fDraw (void *parent, void **data);
GUI_DATA_EVENT=*(int*)data[0]=type of event; TYP_EventConfig|TYP_EventDraw
GUI_DATA_I1 =*(int*)data[1]=window-width
GUI_DATA_I2 =*(int*)data[2]=window-height
GUI_OBJ_TYP(mo) = TYP_GUI_BoxGL
int GUI_gl_ev_move |
( |
MemObj * |
mo, |
|
|
void * |
fMove | |
|
) |
| | |
add callback for mouse-move-events in OpenGL-window
Input:
mo OpenGL-window-obj
fMove callback-function move-event
prototype:
int fMove (MemObj *mo, void **data);
GUI_DATA_EVENT=*(int*)data[0]=TYP_EventMove
GUI_DATA_I1 =*(int*)data[2]=x-val mousepos in screencoords
GUI_DATA_I2 =*(int*)data[3]=y-val mousepos in screencoords
GUI_OBJ_TYP(mo) = TYP_GUI_BoxGL
printf(" x=%d y=%d\n",GUI_DATA_I1,GUI_DATA_I2);
int GUI_gl_ev_button |
( |
MemObj * |
mo, |
|
|
void * |
fButton | |
|
) |
| | |
add callback for the mouse-button event
Input:
mo OpenGL-window-obj
fButton callback-function mouse-button event
prototype:
int fButton (MemObj *mo, void **data);
GUI_DATA_EVENT=*(int*)data[0]=TYP_EventPress|TYP_EventRelease
GUI_DATA_I1 =*(int*)data[1]=TYP_DeviceMouse
GUI_DATA_I2 =*(int*)data[2]=GUI_MouseL| left mousebutton
GUI_MouseM| mid mousebutton
GUI_MouseR| right mousebutton
GUI_MouseScUp| mouse scroll up
GUI_MouseScDown mouse scroll down
GUI_OBJ_TYP(mo) = TYP_GUI_BoxGL
printf(" button=%d\n",GUI_DATA_I1);
GUI_gl_ev_test |
( |
MemObj * |
mo |
) |
|
int GUI_gl_ev_key |
( |
MemObj * |
mo, |
|
|
void * |
fKey | |
|
) |
| | |
add callback for the key-events
Input:
mo OpenGL-window-obj
fKey callback-function key-events
prototyp fKey:
int fKey (MemObj *mo, void **data);
GUI_DATA_EVENT=*(int*)data[0]=TYP_EventPress|TYP_EventRelease
GUI_DATA_I1 =*(int*)data[1]=TYP_DeviceKeyb
GUI_DATA_I2 =*(int*)data[2]=keyvalue; eg 'a'
GUI_DATA_I3 =*(int*)data[3]=state of modifierkeys;
&1=shift; &4=ctrl; &8=alt.
GUI_OBJ_TYP(mo) = TYP_GUI_BoxGL
printf(" key=%d\n",GUI_DATA_I1);
Example see GUI_Entry__
int fKey (void *parent, int iKey, int iStat); iStat: 1=up, -1=down
int GUI_gl_block |
( |
MemObj * |
mo, |
|
|
int |
mode | |
|
) |
| | |
block (1) or unblock (0) input
Blocks scroll-events, key-events, button-events and move-events.
mo OpenGL-window-obj
int GUI_gl_draw |
( |
void * |
parent, |
|
|
void * |
event, |
|
|
MemObj |
mo | |
|
) |
| | |
INTERNAL draw / expose & config-callback
int GUI_gl_move |
( |
void * |
parent, |
|
|
void * |
event, |
|
|
MemObj |
mo | |
|
) |
| | |
int GUI_gl_button |
( |
void * |
parent, |
|
|
void * |
ev, |
|
|
MemObj |
mo | |
|
) |
| | |
int GUI_gl_key |
( |
void * |
parent, |
|
|
void * |
event, |
|
|
MemObj |
mo | |
|
) |
| | |
int GUI_gl_idle1 |
( |
void * |
data |
) |
|
INTERNAL draw must be last call
return 0;
return 1;
Variable Documentation