--- deliantra/Deliantra-Client/DC/OpenGL.pm 2007/12/26 20:46:39 1.13 +++ deliantra/Deliantra-Client/DC/OpenGL.pm 2010/04/03 02:58:25 1.21 @@ -1,9 +1,9 @@ -package dc::OpenGL; +package DC::OpenGL; -use strict; +use common::sense; use Carp (); -use dc; +use DC; our %GL_EXT; our $GL_VERSION; @@ -11,6 +11,8 @@ our $GL_NPOT; our $GL_COMPRESS; our $GL_BFSEP; # blendfuncseparate +our $GL_MULTITEX; +our $APPLE_NVIDIA_BUG; our $DEBUG = 1; our %INIT_HOOK; @@ -19,9 +21,7 @@ sub import { my $caller = caller; - no strict; - - my $symtab = *{"main::dc::OpenGL::"}{HASH}; + my $symtab = *{"main::DC::OpenGL::"}{HASH}; for (keys %$symtab) { *{"$caller\::$_"} = *$_ @@ -39,11 +39,11 @@ $GL_VERSION >= 2.0 && (!$GL_EXT{GL_ARB_texture_non_power_of_two} || !$GL_EXT{GL_EXT_blend_func_separate}) - ) { - $::CFG->{force_opengl11} = 1; - } else { - $::CFG->{force_opengl11} = 0; - } + ) { + $::CFG->{force_opengl11} = 1; + } else { + $::CFG->{force_opengl11} = 0; + } } if ($::CFG->{force_opengl11}) { @@ -54,6 +54,13 @@ $GL_BFSEP = $GL_EXT{GL_EXT_blend_func_separate} || $GL_VERSION >= 2.0; $GL_NPOT = $GL_EXT{GL_ARB_texture_non_power_of_two} || $GL_VERSION >= 2.0; $GL_COMPRESS = $GL_EXT{GL_ARB_texture_compression} || $GL_VERSION >= 1.3; + $GL_MULTITEX = $GL_EXT{GL_ARB_multitexture} || $GL_VERSION >= 1.3; + $GL_MULTITEX &&= 2 <= glGetInteger GL_MAX_TEXTURE_UNITS; + + $GL_COMPRESS = 0 if DC::OpenGL::gl_vendor eq "Apple Computer, Inc."; # there is no end to their suckage + + $APPLE_NVIDIA_BUG = DC::OpenGL::gl_vendor eq "NVIDIA Corporation" && $^O eq "darwin"; + apple_nvidia_bug $APPLE_NVIDIA_BUG; disable_GL_EXT_blend_func_separate unless $GL_BFSEP; @@ -74,6 +81,7 @@ #glDrawBuffer GL_BACK; #glReadBuffer GL_BACK; + c_init; $_->() for values %INIT_HOOK; }