]> icculus.org git repositories - taylor/freespace2.git/blob - src/graphics/gropengl.cpp
New graphics stubbing arrangement
[taylor/freespace2.git] / src / graphics / gropengl.cpp
1 /*
2  * $Logfile: /Freespace2/code/Graphics/GrOpenGL.cpp $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Code that uses the OpenGL graphics library
8  *
9  * $Log$
10  * Revision 1.5  2002/05/28 04:07:28  theoddone33
11  * New graphics stubbing arrangement
12  *
13  * Revision 1.4  2002/05/27 23:39:34  relnev
14  * 0
15  *
16  * Revision 1.3  2002/05/27 22:35:01  theoddone33
17  * more symbols
18  *
19  * Revision 1.2  2002/05/27 22:32:02  theoddone33
20  * throw all d3d stuff at opengl
21  *
22  * Revision 1.1.1.1  2002/05/03 03:28:09  root
23  * Initial import.
24  *
25  * 
26  * 10    7/14/99 9:42a Dave
27  * Put in clear_color debug function. Put in base for 3dnow stuff / P3
28  * stuff
29  * 
30  * 9     7/09/99 9:51a Dave
31  * Added thick polyline code.
32  * 
33  * 8     6/29/99 10:35a Dave
34  * Interface polygon bitmaps! Whee!
35  * 
36  * 7     2/03/99 11:44a Dave
37  * Fixed d3d transparent textures.
38  * 
39  * 6     1/24/99 11:37p Dave
40  * First full rev of beam weapons. Very customizable. Removed some bogus
41  * Int3()'s in low level net code.
42  * 
43  * 5     12/18/98 1:13a Dave
44  * Rough 1024x768 support for Direct3D. Proper detection and usage through
45  * the launcher.
46  * 
47  * 4     12/06/98 2:36p Dave
48  * Drastically improved nebula fogging.
49  * 
50  * 3     11/11/98 5:37p Dave
51  * Checkin for multiplayer testing.
52  * 
53  * 2     10/07/98 10:53a Dave
54  * Initial checkin.
55  * 
56  * 1     10/07/98 10:49a Dave
57  * 
58  * 14    5/20/98 9:46p John
59  * added code so the places in code that change half the palette don't
60  * have to clear the screen.
61  * 
62  * 13    5/06/98 5:30p John
63  * Removed unused cfilearchiver.  Removed/replaced some unused/little used
64  * graphics functions, namely gradient_h and _v and pixel_sp.   Put in new
65  * DirectX header files and libs that fixed the Direct3D alpha blending
66  * problems.
67  * 
68  * 12    4/14/98 12:15p John
69  * Made 16-bpp movies work.
70  * 
71  * 11    3/12/98 5:36p John
72  * Took out any unused shaders.  Made shader code take rgbc instead of
73  * matrix and vector since noone used it like a matrix and it would have
74  * been impossible to do in hardware.   Made Glide implement a basic
75  * shader for online help.  
76  * 
77  * 10    3/10/98 4:18p John
78  * Cleaned up graphics lib.  Took out most unused gr functions.   Made D3D
79  * & Glide have popups and print screen.  Took out all >8bpp software
80  * support.  Made Fred zbuffer.  Made zbuffer allocate dynamically to
81  * support Fred.  Made zbuffering key off of functions rather than one
82  * global variable.
83  * 
84  * 9     12/02/97 4:00p John
85  * Added first rev of thruster glow, along with variable levels of
86  * translucency, which retquired some restructing of palman.
87  * 
88  * 8     10/03/97 9:10a John
89  * added better antialiased line drawer
90  * 
91  * 7     9/23/97 10:45a John
92  * made so you can tell bitblt code to rle a bitmap by passing flag to
93  * gr_set_bitmap
94  * 
95  * 6     9/09/97 11:01a Sandeep
96  * fixed warning level 4 bugs
97  * 
98  * 5     7/10/97 2:06p John
99  * added code to specify alphablending type for bitmaps.
100  * 
101  * 4     6/17/97 7:04p John
102  * added d3d support for gradients.
103  * fixed some color bugs by adding screen signatures instead of watching
104  * flags and palette changes.
105  * 
106  * 3     6/12/97 2:50a Lawrance
107  * bm_unlock() now passed bitmap number, not pointer
108  * 
109  * 2     6/11/97 1:12p John
110  * Started fixing all the text colors in the game.
111  * 
112  * 1     5/12/97 12:14p John
113  *
114  * $NoKeywords: $
115  */
116
117 #ifndef PLAT_UNIX
118 #include <windows.h>
119 #include <windowsx.h>
120 #endif
121
122 #include "osapi.h"
123 #include "2d.h"
124 #include "bmpman.h"
125 #include "floating.h"
126 #include "palman.h"
127 #include "grinternal.h"
128 #include "gropengl.h"
129 #include "line.h"
130
131 static int Inited = 0;
132 #ifdef PLAT_UNIX
133 // Throw in some dummy functions - DDOI
134
135 int D3D_32bit = 0;              // grd3d.cpp
136 int D3D_fog_mode = -1;          // grd3d.cpp
137 int D3D_inited = 0;             // grd3d.cpp
138 int D3D_zbias = 1;              // grd3d.cpp
139 int D3d_rendition_uvs = 0;      // grd3d.cpp
140
141 void gr_dd_activate(int active)         // grdirectdraw.cpp
142 {
143         STUB_FUNCTION;
144 }
145
146 void gr_directdraw_cleanup()            // grdirectdraw.cpp
147 {
148         STUB_FUNCTION;
149 }
150
151 void gr_directdraw_force_windowed()     // grdirectdraw.cpp
152 {
153         STUB_FUNCTION;
154 }
155
156 void gr_directdraw_init()
157 {
158         STUB_FUNCTION;
159 }
160
161 void gr_opengl_preload_init()
162 {
163         STUB_FUNCTION;
164 }
165
166 void gr_d3d_preload(int x, int y)
167 {
168         STUB_FUNCTION;
169 }
170
171 void gr_opengl_activate(int b)
172 {
173         STUB_FUNCTION;
174 }
175
176 void d3d_flush ()
177 {
178         STUB_FUNCTION;
179 }
180
181 void d3d_zbias (int a)
182 {
183         STUB_FUNCTION;
184 }
185 #endif
186
187 void gr_opengl_pixel(int x, int y)
188 {
189         if ( x < gr_screen.clip_left ) return;
190         if ( x > gr_screen.clip_right ) return;
191         if ( y < gr_screen.clip_top ) return;
192         if ( y > gr_screen.clip_bottom ) return;
193 }
194
195 void gr_opengl_clear()
196 {
197 }
198
199
200 void gr_opengl_flip()
201 {
202 }
203
204 void gr_opengl_flip_window(uint _hdc, int x, int y, int w, int h )
205 {
206 }
207
208 void gr_opengl_set_clip(int x,int y,int w,int h)
209 {
210         // check for sanity of parameters
211         if (x < 0)
212                 x = 0;
213         if (y < 0)
214                 y = 0;
215
216         if (x >= gr_screen.max_w)
217                 x = gr_screen.max_w - 1;
218         if (y >= gr_screen.max_h)
219                 y = gr_screen.max_h - 1;
220
221         if (x + w > gr_screen.max_w)
222                 w = gr_screen.max_w - x;
223         if (y + h > gr_screen.max_h)
224                 h = gr_screen.max_h - y;
225         
226         if (w > gr_screen.max_w)
227                 w = gr_screen.max_w;
228         if (h > gr_screen.max_h)
229                 h = gr_screen.max_h;
230         
231         gr_screen.offset_x = x;
232         gr_screen.offset_y = y;
233         gr_screen.clip_left = 0;
234         gr_screen.clip_right = w-1;
235         gr_screen.clip_top = 0;
236         gr_screen.clip_bottom = h-1;
237         gr_screen.clip_width = w;
238         gr_screen.clip_height = h;
239 }
240
241 void gr_opengl_reset_clip()
242 {
243         gr_screen.offset_x = 0;
244         gr_screen.offset_y = 0;
245         gr_screen.clip_left = 0;
246         gr_screen.clip_top = 0;
247         gr_screen.clip_right = gr_screen.max_w - 1;
248         gr_screen.clip_bottom = gr_screen.max_h - 1;
249         gr_screen.clip_width = gr_screen.max_w;
250         gr_screen.clip_height = gr_screen.max_h;
251 }
252
253 void gr_opengl_set_font(int fontnum)
254 {
255 }
256
257 void gr_opengl_set_color( int r, int g, int b )
258 {
259         Assert((r >= 0) && (r < 256));
260         Assert((g >= 0) && (g < 256));
261         Assert((b >= 0) && (b < 256));
262
263         gr_screen.current_color.red = (unsigned char)r;
264         gr_screen.current_color.green = (unsigned char)g;
265         gr_screen.current_color.blue = (unsigned char)b;
266 }
267
268 void gr_opengl_set_bitmap( int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha, int sx, int sy )
269 {
270         gr_screen.current_alpha = alpha;
271         gr_screen.current_alphablend_mode = alphablend_mode;
272         gr_screen.current_bitblt_mode = bitblt_mode;
273         gr_screen.current_bitmap = bitmap_num;
274
275         gr_screen.current_bitmap_sx = sx;
276         gr_screen.current_bitmap_sy = sy;
277 }
278
279 void gr_opengl_create_shader(shader * shade, float r, float g, float b, float c )
280 {
281         shade->screen_sig = gr_screen.signature;
282         shade->r = r;
283         shade->g = g;
284         shade->b = b;
285         shade->c = c;
286 }
287
288 void gr_opengl_set_shader( shader * shade )
289 {       
290         if ( shade )    {
291                 if (shade->screen_sig != gr_screen.signature)   {
292                         gr_create_shader( shade, shade->r, shade->g, shade->b, shade->c );
293                 }
294                 gr_screen.current_shader = *shade;
295         } else {
296                 gr_create_shader( &gr_screen.current_shader, 0.0f, 0.0f, 0.0f, 0.0f );
297         }
298 }
299
300
301 void gr_opengl_bitmap_ex(int x,int y,int w,int h,int sx,int sy)
302 {
303         int i,j;
304         bitmap * bmp;
305         ubyte * sptr;
306
307         bmp = bm_lock( gr_screen.current_bitmap, 8, 0 );
308         sptr = (ubyte *)( bmp->data + (sy*bmp->w+sx) );
309
310 //      mprintf(( "x=%d, y=%d, w=%d, h=%d\n", x, y, w, h ));
311 //      mprintf(( "sx=%d, sy=%d, bw=%d, bh=%d\n", sx, sy, bmp->w, bmp->h ));
312
313         for (i=0; i<h; i++ )    {
314                 for ( j=0; j<w; j++ )   {
315                         gr_set_color( gr_palette[sptr[j]*3+0], gr_palette[sptr[j]*3+1], gr_palette[sptr[j]*3+2] );
316                         gr_pixel( x+j, i+y );
317                 }
318                 sptr += bmp->w;
319         }
320         bm_unlock(gr_screen.current_bitmap);
321 }
322
323 void gr_opengl_bitmap(int x, int y)
324 {
325         int w, h;
326
327         bm_get_info( gr_screen.current_bitmap, &w, &h, NULL );
328         int dx1=x, dx2=x+w-1;
329         int dy1=y, dy2=y+h-1;
330         int sx=0, sy=0;
331
332         if ((dx1 > gr_screen.clip_right ) || (dx2 < gr_screen.clip_left)) return;
333         if ((dy1 > gr_screen.clip_bottom ) || (dy2 < gr_screen.clip_top)) return;
334         if ( dx1 < gr_screen.clip_left ) { sx = gr_screen.clip_left-dx1; dx1 = gr_screen.clip_left; }
335         if ( dy1 < gr_screen.clip_top ) { sy = gr_screen.clip_top-dy1; dy1 = gr_screen.clip_top; }
336         if ( dx2 > gr_screen.clip_right )       { dx2 = gr_screen.clip_right; }
337         if ( dy2 > gr_screen.clip_bottom )      { dy2 = gr_screen.clip_bottom; }
338
339         if ( sx < 0 ) return;
340         if ( sy < 0 ) return;
341         if ( sx >= w ) return;
342         if ( sy >= h ) return;
343
344         // Draw bitmap bm[sx,sy] into (dx1,dy1)-(dx2,dy2)
345
346         gr_bitmap_ex(dx1,dy1,dx2-dx1+1,dy2-dy1+1,sx,sy);
347 }
348
349 static void opengl_scanline(int x1,int x2,int y)
350 {
351 }
352
353 void gr_opengl_rect(int x,int y,int w,int h)
354 {
355         int i, swapped=0;
356         int x1 = x, x2;
357         int y1 = y, y2;
358
359         if ( w > 0 )
360                  x2 = x + w - 1;
361         else
362                  x2 = x + w + 1;
363
364         if ( h > 0 )
365                 y2 = y + h - 1;
366         else
367                 y2 = y + h + 1;
368                 
369         if ( x2 < x1 )  {
370                 int tmp;        
371                 tmp = x1;
372                 x1 = x2;
373                 x2 = tmp;
374                 w = -w;
375                 swapped = 1;
376         }
377
378         if ( y2 < y1 )  {
379                 int tmp;        
380                 tmp = y1;
381                 y1 = y2;
382                 y2 = tmp;
383                 h = -h;
384                 swapped = 1;
385         }
386
387         for (i=0; i<h; i++ )
388                 opengl_scanline( x1, x2, y1+i );
389 }
390
391
392 void gr_opengl_shade(int x,int y,int w,int h)
393 {
394 }
395
396 void opengl_mtext(int x, int y, char *s, int len )
397 {
398 }
399
400 void gr_opengl_string(int x,int y,char * text)
401 {
402         char *p, *p1;
403         int w, h;
404
405         p1 = text;
406         do {
407                 p = strchr( p1, '\n' );
408                 if ( p ) { 
409                         *p = 0;
410                         p++;
411                 }
412                 gr_get_string_size( &w, &h, p1 );
413
414                 if ( x == 0x8000 )
415                         opengl_mtext(gr_screen.offset_x+(gr_screen.clip_width-w)/2,y+gr_screen.offset_y,p1,strlen(p1));
416                 else
417                         opengl_mtext(gr_screen.offset_x+x,y+gr_screen.offset_y,p1,strlen(p1));
418
419                 p1 = p;
420                 if ( p1 && (strlen(p1) < 1) ) p1 = NULL;
421                 y += h;
422         } while(p1!=NULL);
423 }
424
425
426
427
428 void gr_opengl_circle( int xc, int yc, int d )
429 {
430         int p,x, y, r;
431
432         r = d/2;
433         p=3-d;
434         x=0;
435         y=r;
436
437         // Big clip
438         if ( (xc+r) < gr_screen.clip_left ) return;
439         if ( (xc-r) > gr_screen.clip_right ) return;
440         if ( (yc+r) < gr_screen.clip_top ) return;
441         if ( (yc-r) > gr_screen.clip_bottom ) return;
442
443         while(x<y)      {
444                 // Draw the first octant
445                 opengl_scanline( xc-y, xc+y, yc-x );
446                 opengl_scanline( xc-y, xc+y, yc+x );
447
448                 if (p<0) 
449                         p=p+(x<<2)+6;
450                 else    {
451                         // Draw the second octant
452                         opengl_scanline( xc-x, xc+x, yc-y );
453                         opengl_scanline( xc-x, xc+x, yc+y );
454                         p=p+((x-y)<<2)+10;
455                         y--;
456                 }
457                 x++;
458         }
459         if(x==y)        {
460                 opengl_scanline( xc-x, xc+x, yc-y );
461                 opengl_scanline( xc-x, xc+x, yc+y );
462         }
463         return;
464 }
465
466
467 void gr_opengl_line(int x1,int y1,int x2,int y2)
468 {
469         int i;
470    int xstep,ystep;
471    int dy=y2-y1;
472    int dx=x2-x1;
473    int error_term=0;
474         int clipped = 0, swapped=0;
475
476         INT_CLIPLINE(x1,y1,x2,y2,gr_screen.clip_left,gr_screen.clip_top,gr_screen.clip_right,gr_screen.clip_bottom,return,clipped=1,swapped=1);
477                 
478         if(dy<0)        {
479                 dy=-dy;
480       ystep=-1;
481         }       else    {
482       ystep=1;
483         }
484
485    if(dx<0)     {
486       dx=-dx;
487       xstep=-1;
488    } else {
489       xstep=1;
490         }
491
492         if(dx>dy)       {
493
494                 for(i=dx+1;i>0;i--) {
495                         gr_pixel( x1, y1 ); 
496                         x1 += xstep;
497          error_term+=dy;
498
499          if(error_term>dx)      {
500                                 error_term-=dx;
501             y1+=ystep;
502          }
503       }
504    } else {
505
506       for(i=dy+1;i>0;i--)       {
507                         gr_pixel( x1, y1 ); 
508                         y1 += ystep;
509          error_term+=dx;
510          if(error_term>0)       {
511             error_term-=dy;
512             x1+=xstep;
513          }
514
515       }
516
517    }
518 }
519
520 #define FIND_SCALED_NUM(x,x0,x1,y0,y1) (((((x)-(x0))*((y1)-(y0)))/((x1)-(x0)))+(y0))
521
522 void gr_opengl_scaler(vertex *va, vertex *vb )
523 {
524         float x0, y0, x1, y1;
525         float u0, v0, u1, v1;
526         float clipped_x0, clipped_y0, clipped_x1, clipped_y1;
527         float clipped_u0, clipped_v0, clipped_u1, clipped_v1;
528         float xmin, xmax, ymin, ymax;
529         int dx0, dy0, dx1, dy1;
530
531         //============= CLIP IT =====================
532
533         x0 = va->sx; y0 = va->sy;
534         x1 = vb->sx; y1 = vb->sy;
535
536         xmin = i2fl(gr_screen.clip_left); ymin = i2fl(gr_screen.clip_top);
537         xmax = i2fl(gr_screen.clip_right); ymax = i2fl(gr_screen.clip_bottom);
538
539         u0 = va->u; v0 = va->v;
540         u1 = vb->u; v1 = vb->v;
541
542         // Check for obviously offscreen bitmaps...
543         if ( (y1<=y0) || (x1<=x0) ) return;
544         if ( (x1<xmin ) || (x0>xmax) ) return;
545         if ( (y1<ymin ) || (y0>ymax) ) return;
546
547         clipped_u0 = u0; clipped_v0 = v0;
548         clipped_u1 = u1; clipped_v1 = v1;
549
550         clipped_x0 = x0; clipped_y0 = y0;
551         clipped_x1 = x1; clipped_y1 = y1;
552
553         // Clip the left, moving u0 right as necessary
554         if ( x0 < xmin )        {
555                 clipped_u0 = FIND_SCALED_NUM(xmin,x0,x1,u0,u1);
556                 clipped_x0 = xmin;
557         }
558
559         // Clip the right, moving u1 left as necessary
560         if ( x1 > xmax )        {
561                 clipped_u1 = FIND_SCALED_NUM(xmax,x0,x1,u0,u1);
562                 clipped_x1 = xmax;
563         }
564
565         // Clip the top, moving v0 down as necessary
566         if ( y0 < ymin )        {
567                 clipped_v0 = FIND_SCALED_NUM(ymin,y0,y1,v0,v1);
568                 clipped_y0 = ymin;
569         }
570
571         // Clip the bottom, moving v1 up as necessary
572         if ( y1 > ymax )        {
573                 clipped_v1 = FIND_SCALED_NUM(ymax,y0,y1,v0,v1);
574                 clipped_y1 = ymax;
575         }
576         
577         dx0 = fl2i(clipped_x0); dx1 = fl2i(clipped_x1);
578         dy0 = fl2i(clipped_y0); dy1 = fl2i(clipped_y1);
579
580         if (dx1<=dx0) return;
581         if (dy1<=dy0) return;
582
583         //============= DRAW IT =====================
584         int u, v, du, dv;
585         int y, w;
586         ubyte * sbits;
587         bitmap * bp;
588         ubyte * spixels;
589         float tmpu, tmpv;
590
591         tmpu = (clipped_u1-clipped_u0) / (dx1-dx0);
592         if ( fl_abs(tmpu) < 0.001f ) {
593                 return;         // scaled up way too far!
594         }
595         tmpv = (clipped_v1-clipped_v0) / (dy1-dy0);
596         if ( fl_abs(tmpv) < 0.001f ) {
597                 return;         // scaled up way too far!
598         }
599
600         bp = bm_lock( gr_screen.current_bitmap, 8, 0 );
601
602         du = fl2f(tmpu*(bp->w-1));
603         dv = fl2f(tmpv*(bp->h-1));
604
605         v = fl2f(clipped_v0*(bp->h-1));
606         u = fl2f(clipped_u0*(bp->w-1)); 
607         w = dx1 - dx0 + 1;
608
609         spixels = (ubyte *)bp->data;
610
611         for (y=dy0; y<=dy1; y++ )                       {
612                 sbits = &spixels[bp->rowsize*(v>>16)];
613
614                 int x, tmp_u;
615                 tmp_u = u;
616                 for (x=0; x<w; x++ )                    {
617                         ubyte c = sbits[ tmp_u >> 16 ];
618                         if ( c != 255 ) {
619                                 gr_set_color( gr_palette[c*3+0], gr_palette[c*3+1], gr_palette[c*3+2] );
620                                 gr_pixel( x+dx0, y );
621                         }
622                         tmp_u += du;
623                 }
624                 v += dv;
625         }
626
627         bm_unlock(gr_screen.current_bitmap);
628
629 }
630
631
632
633 void gr_opengl_tmapper( int nv, vertex * verts[], uint flags )
634 {
635 }
636
637
638 void gr_opengl_gradient(int x1,int y1,int x2,int y2)
639 {
640 }
641
642 void gr_opengl_set_palette(ubyte *new_palette, int is_alphacolor)
643 {
644 }
645
646 void gr_opengl_get_color( int * r, int * g, int * b )
647 {
648         if (r) *r = gr_screen.current_color.red;
649         if (g) *g = gr_screen.current_color.green;
650         if (b) *b = gr_screen.current_color.blue;
651 }
652
653 void gr_opengl_init_color(color *c, int r, int g, int b)
654 {
655         gr_screen.current_color.screen_sig = gr_screen.signature;
656         gr_screen.current_color.red = (unsigned char)r;
657         gr_screen.current_color.green = (unsigned char)g;
658         gr_screen.current_color.blue = (unsigned char)b;
659 }
660
661 void gr_opengl_set_color_fast(color *dst)
662 {
663         if ( dst->screen_sig != gr_screen.signature )   {
664                 gr_init_color( dst, dst->red, dst->green, dst->blue );
665                 return;
666         }
667         gr_screen.current_color = *dst;
668 }
669
670
671
672 void gr_opengl_print_screen(char *filename)
673 {
674
675 }
676
677 int gr_opengl_supports_res_ingame(int res)
678 {
679         return 1;
680 }
681
682 int gr_opengl_supports_res_interface(int res)
683 {
684         return 1;
685 }
686
687 void gr_opengl_cleanup()
688 {
689         if ( !Inited )  return;
690
691         gr_reset_clip();
692         gr_clear();
693         gr_flip();
694
695         Inited = 0;
696 }
697
698 void gr_opengl_fog_set(int fog_mode, int r, int g, int b, float near, float far)
699 {
700 }
701
702 void gr_opengl_get_pixel(int x, int y, int *r, int *g, int *b)
703 {
704 }
705
706 void gr_opengl_get_region(int front, int w, int g, ubyte *data)
707 {
708 }
709
710 void gr_opengl_set_cull(int cull)
711 {
712 }
713
714 void gr_opengl_filter_set(int filter)
715 {
716 }
717
718 // cross fade
719 void gr_opengl_cross_fade(int bmap1, int bmap2, int x1, int y1, int x2, int y2, float pct)
720 {
721 }
722
723 int gr_opengl_tcache_set(int bitmap_id, int bitmap_type, float *u_ratio, float *v_ratio, int fail_on_full = 0, int sx = -1, int sy = -1, int force = 0)
724 {
725         return 1;
726 }
727
728 void gr_opengl_set_clear_color(int r, int g, int b)
729 {
730 }
731
732 void gr_opengl_init()
733 {
734         if ( Inited )   {
735                 gr_opengl_cleanup();
736                 Inited = 0;
737         }
738
739         mprintf(( "Initializing opengl graphics device...\n" ));
740         Inited = 1;
741
742         gr_opengl_clear();
743
744         gr_screen.gf_flip = gr_opengl_flip;
745         gr_screen.gf_flip_window = gr_opengl_flip_window;
746         gr_screen.gf_set_clip = gr_opengl_set_clip;
747         gr_screen.gf_reset_clip = gr_opengl_reset_clip;
748         gr_screen.gf_set_font = gr_opengl_set_font;
749         gr_screen.gf_set_color = gr_opengl_set_color;
750         gr_screen.gf_set_bitmap = gr_opengl_set_bitmap;
751         gr_screen.gf_create_shader = gr_opengl_create_shader;
752         gr_screen.gf_set_shader = gr_opengl_set_shader;
753         gr_screen.gf_clear = gr_opengl_clear;
754         // gr_screen.gf_bitmap = gr_opengl_bitmap;
755         // gr_screen.gf_bitmap_ex = gr_opengl_bitmap_ex;
756         gr_screen.gf_rect = gr_opengl_rect;
757         gr_screen.gf_shade = gr_opengl_shade;
758         gr_screen.gf_string = gr_opengl_string;
759         gr_screen.gf_circle = gr_opengl_circle;
760
761         gr_screen.gf_line = gr_opengl_line;
762         gr_screen.gf_pixel = gr_opengl_pixel;
763         gr_screen.gf_scaler = gr_opengl_scaler;
764         gr_screen.gf_tmapper = gr_opengl_tmapper;
765
766         gr_screen.gf_gradient = gr_opengl_gradient;
767
768         gr_screen.gf_set_palette = gr_opengl_set_palette;
769         gr_screen.gf_get_color = gr_opengl_get_color;
770         gr_screen.gf_init_color = gr_opengl_init_color;
771         gr_screen.gf_set_color_fast = gr_opengl_set_color_fast;
772         gr_screen.gf_print_screen = gr_opengl_print_screen;
773
774         gr_screen.gf_fog_set = gr_opengl_fog_set;       
775
776         gr_screen.gf_get_region = gr_opengl_get_region;
777
778         gr_screen.gf_get_pixel = gr_opengl_get_pixel;
779
780         gr_screen.gf_set_cull = gr_opengl_set_cull;
781
782         gr_screen.gf_cross_fade = gr_opengl_cross_fade;
783
784         gr_screen.gf_filter_set = gr_opengl_filter_set;
785
786         gr_screen.gf_tcache_set = gr_opengl_tcache_set;
787
788         gr_screen.gf_set_clear_color = gr_opengl_set_clear_color;
789 }
790
791
792