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