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

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.278 by root, Sun Jun 4 23:05:06 2006 UTC vs.
Revision 1.279 by root, Mon Jun 5 00:17:47 2006 UTC

855 my $tex = $self->{texture} 855 my $tex = $self->{texture}
856 or return; 856 or return;
857 857
858 glEnable GL_TEXTURE_2D; 858 glEnable GL_TEXTURE_2D;
859 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 859 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
860 glEnable GL_BLEND;
861 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
862 glColor 0, 0, 0, 1; 860 glColor 0, 0, 0, 1;
863 861
864 $tex->draw_quad (0, 0, $w, $h); 862 $tex->draw_quad_alpha_premultiplied (0, 0, $w, $h);
865 863
866 glDisable GL_BLEND;
867 glDisable GL_TEXTURE_2D; 864 glDisable GL_TEXTURE_2D;
868} 865}
869 866
870############################################################################# 867#############################################################################
871 868
1638 }; 1635 };
1639 1636
1640 glEnable GL_TEXTURE_2D; 1637 glEnable GL_TEXTURE_2D;
1641 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1638 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1642 1639
1640 glColor_premultiply @{$self->{fg}}
1643 if ($tex->{format} == GL_ALPHA) { 1641 if $tex->{format} == GL_ALPHA;
1644 glColor @{$self->{fg}}; 1642
1645 $tex->draw_quad_alpha ($self->{ox}, $self->{oy});
1646 } else {
1647 $tex->draw_quad_alpha_premultiplied ($self->{ox}, $self->{oy}); 1643 $tex->draw_quad_alpha_premultiplied ($self->{ox}, $self->{oy});
1648 }
1649 1644
1650 glDisable GL_TEXTURE_2D; 1645 glDisable GL_TEXTURE_2D;
1651} 1646}
1652 1647
1653############################################################################# 1648#############################################################################
1913} 1908}
1914 1909
1915sub _draw { 1910sub _draw {
1916 my ($self) = @_; 1911 my ($self) = @_;
1917 1912
1918 local $self->{fg} = $self->{fg}; 1913 local $self->{fg} = $GRAB == $self ? $self->{active_fg} : $self->{fg};
1919
1920 if ($GRAB == $self) {
1921 $self->{fg} = $self->{active_fg};
1922 }
1923 1914
1924 glEnable GL_TEXTURE_2D; 1915 glEnable GL_TEXTURE_2D;
1925 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1916 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1926 glColor 0, 0, 0, 1; 1917 glColor 0, 0, 0, 1;
1927 1918
2575 2566
2576 delete $self->{texture}; 2567 delete $self->{texture};
2577 } 2568 }
2578 2569
2579 $self->{texture} ||= new_from_opengl CFClient::Texture $W, $H, sub { 2570 $self->{texture} ||= new_from_opengl CFClient::Texture $W, $H, sub {
2580 glClearColor 0.5, 0.5, 0.5, 0; 2571 glClearColor 0, 0, 0, 0;
2581 glClear GL_COLOR_BUFFER_BIT; 2572 glClear GL_COLOR_BUFFER_BIT;
2582 2573
2583 my $top = int $self->{children}[1]{range}[0]; 2574 my $top = int $self->{children}[1]{range}[0];
2584 2575
2585 my $y0 = $top; 2576 my $y0 = $top;
2620sub _draw { 2611sub _draw {
2621 my ($self) = @_; 2612 my ($self) = @_;
2622 2613
2623 glEnable GL_TEXTURE_2D; 2614 glEnable GL_TEXTURE_2D;
2624 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 2615 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
2625 glColor 1, 1, 1, 1; 2616 glColor 0, 0, 0, 1;
2626 $self->{texture}->draw_quad_alpha (0, 0, $self->{children}[0]{w}, $self->{children}[0]{h}); 2617 $self->{texture}->draw_quad_alpha_premultiplied (0, 0, $self->{children}[0]{w}, $self->{children}[0]{h});
2627 glDisable GL_TEXTURE_2D; 2618 glDisable GL_TEXTURE_2D;
2628 2619
2629 $self->{children}[1]->draw; 2620 $self->{children}[1]->draw;
2630 2621
2631} 2622}
2858 my $tex = $::CONN->{texture}[$::CONN->{faceid}[$face || $self->{face}]]; 2849 my $tex = $::CONN->{texture}[$::CONN->{faceid}[$face || $self->{face}]];
2859 2850
2860 if ($tex) { 2851 if ($tex) {
2861 glEnable GL_TEXTURE_2D; 2852 glEnable GL_TEXTURE_2D;
2862 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 2853 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
2863 glColor 1, 1, 1, 1; 2854 glColor 0, 0, 0, 1;
2864 $tex->draw_quad_alpha (0, 0, $self->{w}, $self->{h}); 2855 $tex->draw_quad_alpha (0, 0, $self->{w}, $self->{h});
2865 glDisable GL_TEXTURE_2D; 2856 glDisable GL_TEXTURE_2D;
2866 } 2857 }
2867} 2858}
2868 2859

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines