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.15 by root, Sat Aug 30 04:43:02 2008 UTC vs.
Revision 1.20 by root, Tue Dec 22 01:38:53 2009 UTC

9our $GL_VERSION; 9our $GL_VERSION;
10 10
11our $GL_NPOT; 11our $GL_NPOT;
12our $GL_COMPRESS; 12our $GL_COMPRESS;
13our $GL_BFSEP; # blendfuncseparate 13our $GL_BFSEP; # blendfuncseparate
14our $GL_MULTITEX;
15our $APPLE_NVIDIA_BUG;
14 16
15our $DEBUG = 1; 17our $DEBUG = 1;
16our %INIT_HOOK; 18our %INIT_HOOK;
17our %SHUTDOWN_HOOK; 19our %SHUTDOWN_HOOK;
18 20
37 # try to find a suitable default 39 # try to find a suitable default
38 if ( 40 if (
39 $GL_VERSION >= 2.0 41 $GL_VERSION >= 2.0
40 && (!$GL_EXT{GL_ARB_texture_non_power_of_two} 42 && (!$GL_EXT{GL_ARB_texture_non_power_of_two}
41 || !$GL_EXT{GL_EXT_blend_func_separate}) 43 || !$GL_EXT{GL_EXT_blend_func_separate})
42 ) { 44 ) {
43 $::CFG->{force_opengl11} = 1; 45 $::CFG->{force_opengl11} = 1;
44 } else { 46 } else {
45 $::CFG->{force_opengl11} = 0; 47 $::CFG->{force_opengl11} = 0;
46 } 48 }
47 } 49 }
48 50
49 if ($::CFG->{force_opengl11}) { 51 if ($::CFG->{force_opengl11}) {
50 $GL_VERSION = 1.1; 52 $GL_VERSION = 1.1;
51 %GL_EXT = (); 53 %GL_EXT = ();
52 } 54 }
53 55
54 $GL_BFSEP = $GL_EXT{GL_EXT_blend_func_separate} || $GL_VERSION >= 2.0; 56 $GL_BFSEP = $GL_EXT{GL_EXT_blend_func_separate} || $GL_VERSION >= 2.0;
55 $GL_NPOT = $GL_EXT{GL_ARB_texture_non_power_of_two} || $GL_VERSION >= 2.0; 57 $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; 58 $GL_COMPRESS = $GL_EXT{GL_ARB_texture_compression} || $GL_VERSION >= 1.3;
59 $GL_MULTITEX = $GL_EXT{GL_ARB_multitexture} || $GL_VERSION >= 1.3;
60 $GL_MULTITEX &&= 2 <= glGetInteger GL_MAX_TEXTURE_UNITS;
57 61
58 $GL_COMPRESS = 0 if DC::OpenGL::gl_vendor eq "Apple Computer, Inc."; # there is no end to their suckage 62 $GL_COMPRESS = 0 if DC::OpenGL::gl_vendor eq "Apple Computer, Inc."; # there is no end to their suckage
63
64 $APPLE_NVIDIA_BUG = DC::OpenGL::gl_vendor eq "NVIDIA Corporation" && $^O eq "darwin";
65 apple_nvidia_bug $APPLE_NVIDIA_BUG;
59 66
60 disable_GL_EXT_blend_func_separate 67 disable_GL_EXT_blend_func_separate
61 unless $GL_BFSEP; 68 unless $GL_BFSEP;
62 69
63 glDisable GL_COLOR_MATERIAL; 70 glDisable GL_COLOR_MATERIAL;
74 glHint GL_GENERATE_MIPMAP_HINT , $hint; 81 glHint GL_GENERATE_MIPMAP_HINT , $hint;
75 glHint GL_TEXTURE_COMPRESSION_HINT , $hint; 82 glHint GL_TEXTURE_COMPRESSION_HINT , $hint;
76 #glDrawBuffer GL_BACK; 83 #glDrawBuffer GL_BACK;
77 #glReadBuffer GL_BACK; 84 #glReadBuffer GL_BACK;
78 85
86 c_init;
79 $_->() for values %INIT_HOOK; 87 $_->() for values %INIT_HOOK;
80} 88}
81 89
82sub quit { 90sub quit {
83 undef $GL_VERSION; 91 undef $GL_VERSION;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines