ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/OpenGL.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/OpenGL.pm (file contents):
Revision 1.8 by root, Sun Aug 12 01:49:09 2007 UTC vs.
Revision 1.11 by root, Sun Aug 19 15:57:40 2007 UTC

7 7
8our %GL_EXT; 8our %GL_EXT;
9our $GL_VERSION; 9our $GL_VERSION;
10 10
11our $GL_NPOT; 11our $GL_NPOT;
12our $GL_COMPRESS;
13our $GL_BFSEP; # blendfuncseparate
12 14
13our $DEBUG = 1; 15our $DEBUG = 1;
14our %INIT_HOOK; 16our %INIT_HOOK;
15our %SHUTDOWN_HOOK; 17our %SHUTDOWN_HOOK;
16 18
26 if /^(?:gl[A-Z_]|GL_)/; 28 if /^(?:gl[A-Z_]|GL_)/;
27 } 29 }
28} 30}
29 31
30sub init { 32sub init {
33 $GL_VERSION = gl_version * 1;
34 %GL_EXT = map +($_ => 1), split /\s+/, gl_extensions;
35
36 unless (defined $::CFG->{force_opengl11}) {
37 # try to find a suitable default
38 if (
39 $GL_VERSION >= 2.0
40 && (!$GL_EXT{GL_ARB_texture_non_power_of_two}
41 || !$GL_EXT{GL_EXT_blend_func_separate})
42 ) {
43 $::CFG->{force_opengl11} = 1;
44 } else {
45 $::CFG->{force_opengl11} = 0;
46 }
47 }
48
31 if ($::CFG->{opengl11}) { 49 if ($::CFG->{force_opengl11}) {
32 $GL_VERSION = 1.1; 50 $GL_VERSION = 1.1;
33 %GL_EXT = (); 51 %GL_EXT = ();
34 } else {
35 $GL_VERSION = gl_version * 1;
36 %GL_EXT = map +($_ => 1), split /\s+/, gl_extensions;
37 } 52 }
38 53
54 $GL_BFSEP = $GL_EXT{GL_EXT_blend_func_separate} || $GL_VERSION >= 2.0;
39 $GL_NPOT = $GL_EXT{GL_ARB_texture_non_power_of_two} || $GL_VERSION >= 2; 55 $GL_NPOT = $GL_EXT{GL_ARB_texture_non_power_of_two} || $GL_VERSION >= 2.0;
56 $GL_COMPRESS = $GL_EXT{GL_ARB_texture_compression} || $GL_VERSION >= 1.3;
57
58 disable_GL_EXT_blend_func_separate
59 unless $GL_BFSEP;
40 60
41 glDisable GL_COLOR_MATERIAL; 61 glDisable GL_COLOR_MATERIAL;
42 glShadeModel GL_FLAT; 62 glShadeModel GL_FLAT;
43 glDisable GL_DITHER; 63 glDisable GL_DITHER;
44 glDisable GL_DEPTH_TEST; 64 glDisable GL_DEPTH_TEST;
48 glHint GL_PERSPECTIVE_CORRECTION_HINT, $hint; 68 glHint GL_PERSPECTIVE_CORRECTION_HINT, $hint;
49 glHint GL_POINT_SMOOTH_HINT , $hint; 69 glHint GL_POINT_SMOOTH_HINT , $hint;
50 glHint GL_LINE_SMOOTH_HINT , $hint; 70 glHint GL_LINE_SMOOTH_HINT , $hint;
51 glHint GL_POLYGON_SMOOTH_HINT , $hint; 71 glHint GL_POLYGON_SMOOTH_HINT , $hint;
52 glHint GL_GENERATE_MIPMAP_HINT , $hint; 72 glHint GL_GENERATE_MIPMAP_HINT , $hint;
73 glHint GL_TEXTURE_COMPRESSION_HINT , $hint;
53 #glDrawBuffer GL_BACK; 74 #glDrawBuffer GL_BACK;
54 #glReadBuffer GL_BACK; 75 #glReadBuffer GL_BACK;
55 76
56 $_->() for values %INIT_HOOK; 77 $_->() for values %INIT_HOOK;
57} 78}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines