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