GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-36359e2344
|
OGSF library - primitive drawing functions (lower level functions) More...
#include <stdlib.h>
#include <string.h>
#include <grass/config.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glx.h>
#include <grass/gis.h>
#include <grass/ogsf.h>
#include <grass/glocale.h>
Go to the source code of this file.
Macros | |
#define | USE_GL_NORMALIZE |
#define | RED_MASK 0x000000FF |
#define | GRN_MASK 0x0000FF00 |
#define | BLU_MASK 0x00FF0000 |
#define | ALP_MASK 0xFF000000 |
#define | INT_TO_RED(i, r) (r = (i & RED_MASK)) |
#define | INT_TO_GRN(i, g) (g = (i & GRN_MASK) >> 8) |
#define | INT_TO_BLU(i, b) (b = (i & BLU_MASK) >> 16) |
#define | INT_TO_ALP(i, a) (a = (i & ALP_MASK) >> 24) |
#define | MAX_OBJS 64 |
#define | border 15 |
Functions | |
void | gsd_flush (void) |
Mostly for flushing drawing commands across a network. More... | |
void | gsd_colormode (int cm) |
Set color mode. More... | |
void | show_colormode (void) |
Print color mode to stderr. More... | |
void | gsd_circ (float x, float y, float rad) |
ADD. More... | |
void | gsd_disc (float x, float y, float z, float rad) |
ADD. More... | |
void | gsd_sphere (float *center, float siz) |
ADD. More... | |
void | gsd_zwritemask (unsigned long n) |
Write out z-mask. More... | |
void | gsd_backface (int n) |
ADD. More... | |
void | gsd_linewidth (short n) |
Set width of rasterized lines. More... | |
void | gsd_bgnqstrip (void) |
ADD. More... | |
void | gsd_endqstrip (void) |
ADD. More... | |
void | gsd_bgntmesh (void) |
ADD. More... | |
void | gsd_endtmesh (void) |
ADD. More... | |
void | gsd_bgntstrip (void) |
ADD. More... | |
void | gsd_endtstrip (void) |
ADD. More... | |
void | gsd_bgntfan (void) |
ADD. More... | |
void | gsd_endtfan (void) |
ADD. More... | |
void | gsd_swaptmesh (void) |
ADD. More... | |
void | gsd_bgnpolygon (void) |
Delimit the vertices of a primitive or a group of like primitives. More... | |
void | gsd_endpolygon (void) |
Delimit the vertices of a primitive or a group of like primitives. More... | |
void | gsd_bgnline (void) |
Begin line. More... | |
void | gsd_endline (void) |
End line. More... | |
void | gsd_shademodel (int shade) |
Set shaded model. More... | |
int | gsd_getshademodel (void) |
Get shaded model. More... | |
void | gsd_bothbuffers (void) |
Draw to the front and back buffers. More... | |
void | gsd_frontbuffer (void) |
Draw to the front buffer. More... | |
void | gsd_backbuffer (void) |
Draw to the back buffer. More... | |
void | gsd_swapbuffers (void) |
Swap buffers. More... | |
void | gsd_popmatrix (void) |
Pop the current matrix stack. More... | |
void | gsd_pushmatrix (void) |
Push the current matrix stack. More... | |
void | gsd_scale (float xs, float ys, float zs) |
Multiply the current matrix by a general scaling matrix. More... | |
void | gsd_translate (float dx, float dy, float dz) |
Multiply the current matrix by a translation matrix. More... | |
void | gsd_getwindow (int *window, int *viewport, double *modelMatrix, double *projMatrix) |
Get viewport. More... | |
int | gsd_checkpoint (float pt[4], int window[4], int viewport[4], double modelMatrix[16], double projMatrix[16]) |
ADD. More... | |
void | gsd_rot (float angle, char axis) |
ADD. More... | |
void | gsd_litvert_func (float *norm, unsigned long col, float *pt) |
Set the current normal vector & specify vertex. More... | |
void | gsd_litvert_func2 (float *norm, unsigned long col UNUSED, float *pt) |
ADD. More... | |
void | gsd_vert_func (float *pt) |
ADD. More... | |
void | gsd_color_func (unsigned int col) |
Set current color. More... | |
void | gsd_init_lightmodel (void) |
Initialize model light. More... | |
void | gsd_set_material (int set_shin, int set_emis, float sh, float em, int emcolor) |
Set material. More... | |
void | gsd_deflight (int num, struct lightdefs *vals) |
Define light. More... | |
void | gsd_switchlight (int num, int on) |
Switch light on/off. More... | |
int | gsd_getimage (unsigned char **pixbuf, unsigned int *xsize, unsigned int *ysize) |
Get image of current GL screen. More... | |
int | gsd_getViewport (GLint tmp[4], GLint num[2]) |
Get viewpoint. More... | |
int | gsd_writeView (unsigned char **pixbuf, unsigned int xsize, unsigned int ysize) |
Write view. More... | |
void | gsd_blend (int yesno) |
Specify pixel arithmetic. More... | |
void | gsd_def_clipplane (int num, double *params) |
Define clip plane. More... | |
void | gsd_set_clipplane (int num, int able) |
Set clip plane. More... | |
void | gsd_finish (void) |
Finish. More... | |
void | gsd_viewport (int l, int r, int b, int t) |
Set the viewport. More... | |
int | gsd_makelist (void) |
ADD. More... | |
void | gsd_bgnlist (int listno, int do_draw) |
ADD. More... | |
void | gsd_endlist (void) |
End list. More... | |
void | gsd_deletelist (GLuint listno, int range UNUSED) |
Delete list. More... | |
void | gsd_calllist (int listno) |
ADD. More... | |
void | gsd_calllists (int listno UNUSED) |
ADD. More... | |
OGSF library - primitive drawing functions (lower level functions)
GRASS OpenGL gsurf OGSF Library
(C) 1999-2008, 2018 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file gsd_prim.c.
#define ALP_MASK 0xFF000000 |
Definition at line 51 of file gsd_prim.c.
#define BLU_MASK 0x00FF0000 |
Definition at line 50 of file gsd_prim.c.
#define border 15 |
Definition at line 62 of file gsd_prim.c.
#define GRN_MASK 0x0000FF00 |
Definition at line 49 of file gsd_prim.c.
#define INT_TO_ALP | ( | i, | |
a | |||
) | (a = (i & ALP_MASK) >> 24) |
Definition at line 56 of file gsd_prim.c.
Definition at line 55 of file gsd_prim.c.
Definition at line 54 of file gsd_prim.c.
Definition at line 53 of file gsd_prim.c.
#define MAX_OBJS 64 |
Definition at line 58 of file gsd_prim.c.
#define RED_MASK 0x000000FF |
Definition at line 48 of file gsd_prim.c.
#define USE_GL_NORMALIZE |
Definition at line 46 of file gsd_prim.c.
void gsd_backbuffer | ( | void | ) |
Draw to the back buffer.
Definition at line 470 of file gsd_prim.c.
void gsd_backface | ( | int | n | ) |
void gsd_bgnline | ( | void | ) |
Begin line.
Definition at line 397 of file gsd_prim.c.
Referenced by gsd_3dcursor(), gsd_diamond_lines(), gsd_draw_box(), gsd_draw_gyro(), gsd_fringe_horiz_line(), gsd_fringe_horiz_line2(), gsd_fringe_vert_line(), gsd_line_onsurf(), gsd_nline_onsurf(), gsd_plus(), gsd_scalebar_v2(), gsd_wire_surf_const(), gsd_wire_surf_map(), gsd_x(), gvd_draw_lineonsurf(), gvd_vect(), and gvld_wind3_box().
void gsd_bgnlist | ( | int | listno, |
int | do_draw | ||
) |
void gsd_bgnpolygon | ( | void | ) |
Delimit the vertices of a primitive or a group of like primitives.
Definition at line 372 of file gsd_prim.c.
Referenced by gsd_box(), gsd_cube(), gsd_diamond(), gsd_north_arrow(), and gsd_scalebar().
void gsd_bgnqstrip | ( | void | ) |
ADD.
Definition at line 277 of file gsd_prim.c.
Referenced by gsd_fringe_horiz_poly(), and gsd_fringe_vert_poly().
void gsd_bgntfan | ( | void | ) |
ADD.
Definition at line 337 of file gsd_prim.c.
void gsd_bgntmesh | ( | void | ) |
void gsd_bgntstrip | ( | void | ) |
ADD.
Definition at line 317 of file gsd_prim.c.
void gsd_blend | ( | int | yesno | ) |
void gsd_bothbuffers | ( | void | ) |
Draw to the front and back buffers.
Definition at line 446 of file gsd_prim.c.
void gsd_calllist | ( | int | listno | ) |
void gsd_calllists | ( | int listno | UNUSED | ) |
ADD.
listno | [unused] |
Definition at line 1185 of file gsd_prim.c.
References gsd_pushmatrix(), and MAX_OBJS.
int gsd_checkpoint | ( | float | pt[4], |
int | window[4], | ||
int | viewport[4], | ||
double | modelMatrix[16], | ||
double | projMatrix[16] | ||
) |
ADD.
pt | |
widnow | |
viewport | |
doubleMatrix | |
projMatrix |
Definition at line 585 of file gsd_prim.c.
void gsd_circ | ( | float | x, |
float | y, | ||
float | rad | ||
) |
ADD.
x,y | |
rad |
Definition at line 167 of file gsd_prim.c.
References x.
Referenced by gsd_draw_gyro().
void gsd_color_func | ( | unsigned int | col | ) |
Set current color.
col | color value |
Definition at line 698 of file gsd_prim.c.
Referenced by gpd_obj(), gsd_display_fringe(), gsd_draw_asterisk(), gsd_draw_box(), gsd_draw_gyro(), gsd_drawsphere(), gsd_north_arrow(), gsd_plus(), gsd_scalebar(), gsd_scalebar_v2(), gsd_wire_surf_const(), gsd_wire_surf_map(), gsd_x(), gvd_draw_lineonsurf(), gvd_vect(), and gvld_wind3_box().
void gsd_colormode | ( | int | cm | ) |
Set color mode.
Call glColorMaterial before enabling the GL_COLOR_MATERIAL
cm | color mode value |
Definition at line 98 of file gsd_prim.c.
References CM_AD, CM_COLOR, CM_DIFFUSE, CM_EMISSION, and CM_NULL.
Referenced by gpd_obj(), gsd_bgn_legend_viewport(), gsd_display_fringe(), gsd_wire_arrows(), gsd_wire_surf_const(), gsd_wire_surf_map(), gvd_vect(), and gvld_wind3_box().
void gsd_def_clipplane | ( | int | num, |
double * | params | ||
) |
void gsd_deflight | ( | int | num, |
struct lightdefs * | vals | ||
) |
Define light.
num | light id (starts with 1) |
vals | position(x,y,z,w), color, ambientm, emission |
Definition at line 836 of file gsd_prim.c.
References MAX_LIGHTS.
void gsd_deletelist | ( | GLuint | listno, |
int range | UNUSED | ||
) |
Delete list.
listno | |
range | [unused] |
Definition at line 1153 of file gsd_prim.c.
References MAX_OBJS.
void gsd_disc | ( | float | x, |
float | y, | ||
float | z, | ||
float | rad | ||
) |
void gsd_endline | ( | void | ) |
End line.
Definition at line 407 of file gsd_prim.c.
Referenced by gsd_3dcursor(), gsd_diamond_lines(), gsd_draw_box(), gsd_draw_gyro(), gsd_fringe_horiz_line(), gsd_fringe_horiz_line2(), gsd_fringe_vert_line(), gsd_line_onsurf(), gsd_nline_onsurf(), gsd_plus(), gsd_scalebar_v2(), gsd_wire_surf_const(), gsd_wire_surf_map(), gsd_x(), gvd_draw_lineonsurf(), gvd_vect(), and gvld_wind3_box().
void gsd_endlist | ( | void | ) |
End list.
Definition at line 1140 of file gsd_prim.c.
void gsd_endpolygon | ( | void | ) |
Delimit the vertices of a primitive or a group of like primitives.
Definition at line 387 of file gsd_prim.c.
Referenced by gsd_box(), gsd_cube(), gsd_diamond(), gsd_north_arrow(), and gsd_scalebar().
void gsd_endqstrip | ( | void | ) |
ADD.
Definition at line 287 of file gsd_prim.c.
Referenced by gsd_fringe_horiz_poly(), and gsd_fringe_vert_poly().
void gsd_endtfan | ( | void | ) |
ADD.
Definition at line 347 of file gsd_prim.c.
void gsd_endtmesh | ( | void | ) |
void gsd_endtstrip | ( | void | ) |
ADD.
Definition at line 327 of file gsd_prim.c.
void gsd_finish | ( | void | ) |
Finish.
Does nothing, only called from src.contrib/GMSL/NVIZ2.2/src/glwrappers.c
Definition at line 1059 of file gsd_prim.c.
void gsd_flush | ( | void | ) |
Mostly for flushing drawing commands across a network.
glFlush doesn't block, so if blocking is desired use glFinish.
Definition at line 84 of file gsd_prim.c.
Referenced by gsd_fringe_horiz_line(), gsd_fringe_horiz_line2(), gsd_fringe_horiz_poly(), gsd_fringe_vert_line(), gsd_fringe_vert_poly(), gsd_north_arrow(), gsd_scalebar(), and gsd_scalebar_v2().
void gsd_frontbuffer | ( | void | ) |
Draw to the front buffer.
Definition at line 458 of file gsd_prim.c.
int gsd_getimage | ( | unsigned char ** | pixbuf, |
unsigned int * | xsize, | ||
unsigned int * | ysize | ||
) |
Get image of current GL screen.
pixbuf | data buffer | |
[out] | xsize,ysize | picture dimension |
Definition at line 902 of file gsd_prim.c.
Referenced by GS_write_ppm(), and GS_write_tif().
int gsd_getshademodel | ( | void | ) |
Get shaded model.
Definition at line 438 of file gsd_prim.c.
Referenced by gsd_box(), gsd_cube(), and gsd_diamond().
int gsd_getViewport | ( | GLint | tmp[4], |
GLint | num[2] | ||
) |
void gsd_getwindow | ( | int * | window, |
int * | viewport, | ||
double * | modelMatrix, | ||
double * | projMatrix | ||
) |
Get viewport.
[out] | window | |
viewport | ||
modelMatrix | model matrix | |
projMatrix | projection matrix |
Definition at line 554 of file gsd_prim.c.
void gsd_init_lightmodel | ( | void | ) |
Initialize model light.
Definition at line 719 of file gsd_prim.c.
void gsd_linewidth | ( | short | n | ) |
Set width of rasterized lines.
n | line width |
Definition at line 267 of file gsd_prim.c.
Referenced by GS_draw_X(), gsd_bgn_legend_viewport(), gsd_display_fringe(), gsd_scalebar_v2(), gvd_vect(), and gvld_wind3_box().
void gsd_litvert_func | ( | float * | norm, |
unsigned long | col, | ||
float * | pt | ||
) |
Set the current normal vector & specify vertex.
norm | normal vector |
col | color value |
pt | point (model coordinates) |
Definition at line 657 of file gsd_prim.c.
Referenced by gsd_box(), gsd_cube(), and gsd_diamond().
void gsd_litvert_func2 | ( | float * | norm, |
unsigned long col | UNUSED, | ||
float * | pt | ||
) |
int gsd_makelist | ( | void | ) |
ADD.
First time called, gets a bunch of objects, then hands them back when needed
Definition at line 1094 of file gsd_prim.c.
void gsd_popmatrix | ( | void | ) |
Pop the current matrix stack.
Definition at line 501 of file gsd_prim.c.
Referenced by gpd_obj(), gsd_bgn_legend_viewport(), gsd_box(), gsd_cube(), gsd_diamond(), gsd_draw_asterisk(), gsd_draw_box(), gsd_draw_gyro(), gsd_end_legend_viewport(), gsd_fringe_horiz_line(), gsd_fringe_horiz_line2(), gsd_fringe_horiz_poly(), gsd_fringe_vert_line(), gsd_fringe_vert_poly(), gsd_north_arrow(), gsd_scalebar(), gsd_scalebar_v2(), gsd_wire_arrows(), gsd_wire_surf_const(), gsd_wire_surf_map(), gvd_vect(), and gvld_wind3_box().
void gsd_pushmatrix | ( | void | ) |
Push the current matrix stack.
Definition at line 511 of file gsd_prim.c.
Referenced by gpd_obj(), GS_draw_X(), GS_set_Narrow(), gsd_bgn_legend_viewport(), gsd_box(), gsd_calllists(), gsd_cube(), gsd_diamond(), gsd_draw_asterisk(), gsd_draw_box(), gsd_draw_gyro(), gsd_fringe_horiz_line(), gsd_fringe_horiz_line2(), gsd_fringe_horiz_poly(), gsd_fringe_vert_line(), gsd_fringe_vert_poly(), gsd_north_arrow(), gsd_scalebar(), gsd_scalebar_v2(), gsd_wire_arrows(), gsd_wire_surf_const(), gsd_wire_surf_map(), gvd_vect(), and gvld_wind3_box().
void gsd_rot | ( | float | angle, |
char | axis | ||
) |
ADD.
angle | |
axis |
Definition at line 605 of file gsd_prim.c.
References _, G_warning(), and x.
Referenced by gsd_draw_asterisk(), and gsd_draw_gyro().
void gsd_scale | ( | float | xs, |
float | ys, | ||
float | zs | ||
) |
Multiply the current matrix by a general scaling matrix.
xs | x scale value |
ys | y scale value |
zs | z scale value |
Definition at line 525 of file gsd_prim.c.
Referenced by gpd_obj(), gsd_box(), gsd_cube(), gsd_diamond(), gsd_do_scale(), gsd_draw_asterisk(), gsd_draw_box(), and gsd_draw_gyro().
void gsd_set_clipplane | ( | int | num, |
int | able | ||
) |
Set clip plane.
num | |
able |
Definition at line 1041 of file gsd_prim.c.
Referenced by gsd_cplane_off().
void gsd_set_material | ( | int | set_shin, |
int | set_emis, | ||
float | sh, | ||
float | em, | ||
int | emcolor | ||
) |
Set material.
set_shin,set_emis | flags |
sh,em | should be 0. - 1. |
emcolor | packed colors to use for emission |
Definition at line 803 of file gsd_prim.c.
void gsd_shademodel | ( | int | shade | ) |
Set shaded model.
shade | non-zero for GL_SMOOTH otherwise GL_FLAT |
Definition at line 419 of file gsd_prim.c.
Referenced by GS_draw_surf(), gsd_box(), gsd_cube(), gsd_diamond(), and gvld_wind3_box().
void gsd_sphere | ( | float * | center, |
float | siz | ||
) |
ADD.
center | center-point |
siz | size value |
Definition at line 207 of file gsd_prim.c.
Referenced by gpd_obj(), and gsd_drawsphere().
void gsd_swapbuffers | ( | void | ) |
Swap buffers.
Definition at line 482 of file gsd_prim.c.
void gsd_swaptmesh | ( | void | ) |
void gsd_switchlight | ( | int | num, |
int | on | ||
) |
Switch light on/off.
num | |
on | 1 for 'on', 0 turns them off |
Definition at line 877 of file gsd_prim.c.
void gsd_translate | ( | float | dx, |
float | dy, | ||
float | dz | ||
) |
Multiply the current matrix by a translation matrix.
dx | x translation value |
dy | y translation value |
dz | z translation value |
Definition at line 539 of file gsd_prim.c.
Referenced by GS_draw_X(), gsd_box(), gsd_cube(), gsd_diamond(), gsd_do_scale(), gsd_draw_asterisk(), gsd_draw_box(), gsd_draw_gyro(), gsd_fringe_horiz_line(), gsd_fringe_horiz_line2(), gsd_fringe_horiz_poly(), gsd_fringe_vert_line(), gsd_fringe_vert_poly(), gsd_wire_arrows(), gsd_wire_surf_const(), gsd_wire_surf_map(), gvd_vect(), and gvld_wind3_box().
void gsd_vert_func | ( | float * | pt | ) |
ADD.
pt |
Definition at line 686 of file gsd_prim.c.
Referenced by gsd_3dcursor(), gsd_diamond_lines(), gsd_draw_box(), gsd_draw_gyro(), gsd_fringe_horiz_line(), gsd_fringe_horiz_line2(), gsd_fringe_horiz_poly(), gsd_fringe_vert_line(), gsd_fringe_vert_poly(), gsd_line_onsurf(), gsd_nline_onsurf(), gsd_plus(), gsd_scalebar_v2(), gsd_wire_surf_const(), gsd_wire_surf_map(), gsd_x(), gvd_draw_lineonsurf(), gvd_vect(), and gvld_wind3_box().
void gsd_viewport | ( | int | l, |
int | r, | ||
int | b, | ||
int | t | ||
) |
Set the viewport.
l, b specify the lower left corner of the viewport rectangle, in pixels.
r, t specify the width and height of the viewport.
l | left |
r | right |
b | bottom |
t | top |
Definition at line 1077 of file gsd_prim.c.
Referenced by GS_set_viewport().
int gsd_writeView | ( | unsigned char ** | pixbuf, |
unsigned int | xsize, | ||
unsigned int | ysize | ||
) |
Write view.
pixbuf | data buffer |
xsize,ysize | picture dimension |
Definition at line 969 of file gsd_prim.c.
References G_malloc.
Referenced by GS_write_zoom().
void gsd_zwritemask | ( | unsigned long | n | ) |
Write out z-mask.
Enable or disable writing into the depth buffer
n | Specifies whether the depth buffer is enabled for writing |
Definition at line 241 of file gsd_prim.c.
Referenced by gsd_display_fringe().
void show_colormode | ( | void | ) |
Print color mode to stderr.
Definition at line 151 of file gsd_prim.c.
References _, and G_message().