gl.h File Reference


Functions

void glstart ()
void glfinish ()
void glsetcolor (Color)
void glstrokerect (int x, int y, int w, int h)
void glfillrect (int x, int y, int w, int h)
void glsetfont (Font *f, float size)
float glgetascent ()
float glgetdescent ()
float glgetwidth (const char *)
float glgetwidth (const char *, int n)
void gldrawtext (const char *)
void gldrawtext (const char *, int n)
void gldrawtext (const char *, float x, float y, float z=0)
void gldrawtext (const char *, int n, float x, float y, float z=0)
void gldrawimage (const uchar *, int x, int y, int w, int h, int d=3, int ld=0)

Detailed Description

Portably include the OpenGL header files, and define a few OpenGL drawing functions provided by fltk.

Function Documentation

void gldrawimage const uchar *  b,
int  x,
int  y,
int  w,
int  h,
int  d,
int  ld
 

Uses glDrawPixels to draw an image using the same arguments as drawimage(). If you are in the normal OpenGL coordinate system with 0,0 in the lower-left, the first pixel is memory is the lower-left corner.

void gldrawtext const char *  str,
int  n,
float  x,
float  y,
float  z
 

Draw the first n bytes of text at the given point in 3D space transformed to the screen.

void gldrawtext const char *  str,
float  x,
float  y,
float  z
 

Draw text at the given point in 3D space transformed to the screen.

void gldrawtext const char *  text,
int  n
 

Draw the first n bytes of text at the current glRasterPos.

void gldrawtext const char *  str  ) 
 

Draw text at the current glRasterPos in the current font selected with glsetfont(). You can use glRasterPos2f() or similar calls to set the position before calling this.

The string is in UTF-8, although only characters in ISO-8859-1 are drawn correctly, others draw as question marks.

void glfillrect int  x,
int  y,
int  w,
int  h
[inline]
 

Inline wrapper for glRecti(x,y,x+w,y+h).

void glfinish  ) 
 

Turn off the effects of a previous glstart(). You must call this before using normal fltk drawing methods.

void glsetcolor Color  i  ) 
 

Set the current OpenGL color to a FLTK color, or as close as possible.

void glsetfont Font font,
float  size
 

Make the current OpenGL font (as used by gldrawtext()) be as similar as possible to an FLTK Font. Currently the font is aliased except on X.

void glstart  ) 
 

Set up an OpenGL context to draw into the current window being drawn by fltk. This will allow you to use OpenGL to update a normal window. The current transformation is reproduced, and the current clipping is simulated with glScissor() calls (which can only do a rectangle).

You must use glfinish() to exit this mode before any normal fltk drawing calls are done.

You should call glvisual() at program startup if you intend to use this. This may be used to change how windows are created so this call works.

I would like this to work reliably, but it is not real good now on any platforms. In particular it does not cooperate with the double-buffering schemes. It does appear to work on X when you turn off double buffering, it also works if OpenGL is entirely software, such as MESA.

Do not call glstart()/glfinish() when drawing into a GlWindow!

void glstrokerect int  x,
int  y,
int  w,
int  h
 

Draw a 1-thick line just inside the given rectangle.


Sun Jan 7 00:55:17 2007. FLTK ©2006 Bill Spitzak and others.
Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.