|
Blender
V2.59
|
00001 /* 00002 * $Id: BIF_glutil.h 38978 2011-08-03 09:28:16Z campbellbarton $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00021 * All rights reserved. 00022 * 00023 * Contributor(s): Blender Foundation 2002-2008 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00032 #ifndef BIF_GLUTIL_H 00033 #define BIF_GLUTIL_H 00034 00035 struct rcti; 00036 struct rctf; 00037 00038 void fdrawbezier(float vec[4][3]); 00039 void fdrawline(float x1, float y1, float x2, float y2); 00040 void fdrawbox(float x1, float y1, float x2, float y2); 00041 void sdrawline(short x1, short y1, short x2, short y2); 00042 void sdrawtri(short x1, short y1, short x2, short y2); 00043 void sdrawtrifill(short x1, short y1, short x2, short y2); 00044 void sdrawbox(short x1, short y1, short x2, short y2); 00045 00046 void sdrawXORline(int x0, int y0, int x1, int y1); 00047 void sdrawXORline4(int nr, int x0, int y0, int x1, int y1); 00048 00049 void fdrawXORellipse(float xofs, float yofs, float hw, float hh); 00050 void fdrawXORcirc(float xofs, float yofs, float rad); 00051 00052 /* glStipple defines */ 00053 extern unsigned char stipple_halftone[128]; 00054 extern unsigned char stipple_quarttone[128]; 00055 extern unsigned char stipple_diag_stripes_pos[128]; 00056 extern unsigned char stipple_diag_stripes_neg[128]; 00057 00069 void glutil_draw_lined_arc (float start, float angle, float radius, int nsegments); 00070 00082 void glutil_draw_filled_arc (float start, float angle, float radius, int nsegments); 00083 00088 int glaGetOneInteger (int param); 00089 00094 float glaGetOneFloat (int param); 00095 00107 void glaRasterPosSafe2f (float x, float y, float known_good_x, float known_good_y); 00108 00128 void glaDrawPixelsSafe (float x, float y, int img_w, int img_h, int row_w, int format, int type, void *rect); 00129 00144 /* only for float rects, converts to 32 bits and draws */ 00145 void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, float *rectf, int gamma_correct); 00146 00147 00148 void glaDrawPixelsTex (float x, float y, int img_w, int img_h, int format, void *rect); 00149 00150 void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, void *rect, float scaleX, float scaleY); 00151 00152 /* 2D Drawing Assistance */ 00153 00164 void glaDefine2DArea (struct rcti *screen_rect); 00165 00166 typedef struct gla2DDrawInfo gla2DDrawInfo; 00167 00185 gla2DDrawInfo* glaBegin2DDraw (struct rcti *screen_rect, struct rctf *world_rect); 00186 00188 void gla2DDrawTranslatePt (gla2DDrawInfo *di, float wo_x, float wo_y, int *sc_x_r, int *sc_y_r); 00189 00191 void gla2DDrawTranslatePtv (gla2DDrawInfo *di, float world[2], int screen_r[2]); 00192 00193 /* Restores the previous OpenGL state and free's the auxilary 00194 * gla data. 00195 */ 00196 void glaEnd2DDraw (gla2DDrawInfo *di); 00197 00199 void gla2DGetMap(gla2DDrawInfo *di, struct rctf *rect); 00200 void gla2DSetMap(gla2DDrawInfo *di, struct rctf *rect); 00201 00202 00203 /* use this for platform hacks. glPointSize is solved here */ 00204 void bglBegin(int mode); 00205 void bglEnd(void); 00206 int bglPointHack(void); 00207 void bglVertex3fv(float *vec); 00208 void bglVertex3f(float x, float y, float z); 00209 void bglVertex2fv(float *vec); 00210 /* intel gfx cards frontbuffer problem */ 00211 void bglFlush(void); 00212 void set_inverted_drawing(int enable); 00213 void setlinestyle(int nr); 00214 00215 /* own working polygon offset */ 00216 void bglPolygonOffset(float viewdist, float dist); 00217 00218 /* For caching opengl matrices (gluProject/gluUnProject) */ 00219 typedef struct bglMats { 00220 double modelview[16]; 00221 double projection[16]; 00222 int viewport[4]; 00223 } bglMats; 00224 void bgl_get_mats(bglMats *mats); 00225 00226 #endif /* BIF_GLUTIL_H */ 00227