… | |
… | |
691 | $self->{texture} = new_from_opengl CFClient::Texture $self->{w}, $self->{h}, sub { |
691 | $self->{texture} = new_from_opengl CFClient::Texture $self->{w}, $self->{h}, sub { |
692 | glClearColor 0, 0, 0, 0; |
692 | glClearColor 0, 0, 0, 0; |
693 | glClear GL_COLOR_BUFFER_BIT; |
693 | glClear GL_COLOR_BUFFER_BIT; |
694 | |
694 | |
695 | $self->_render; |
695 | $self->_render; |
696 | # glColorMask 1, 1, 1, 0; |
|
|
697 | # glEnable GL_BLEND; |
|
|
698 | # glBlendFunc GL_SRC_ALPHA, GL_ZERO; |
|
|
699 | # glRasterPos 0, 0; |
|
|
700 | # glCopyPixels 0, 0, $self->{w}, $self->{h}; |
|
|
701 | # glDisable GL_BLEND; |
|
|
702 | # glColorMask 1, 1, 1, 1; |
|
|
703 | }; |
696 | }; |
704 | } |
697 | } |
705 | |
698 | |
706 | sub _draw { |
699 | sub _draw { |
707 | my ($self) = @_; |
700 | my ($self) = @_; |
… | |
… | |
711 | my $tex = $self->{texture} |
704 | my $tex = $self->{texture} |
712 | or return; |
705 | or return; |
713 | |
706 | |
714 | glEnable GL_TEXTURE_2D; |
707 | glEnable GL_TEXTURE_2D; |
715 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
708 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
716 | glColor 0, 0, 0, 1; |
709 | glColor 1, 1, 1, 1; |
717 | |
710 | |
718 | $tex->draw_quad_alpha_premultiplied (0, 0, $w, $h); |
711 | $tex->draw_quad_alpha_premultiplied (0, 0, $w, $h); |
719 | |
712 | |
720 | glDisable GL_TEXTURE_2D; |
713 | glDisable GL_TEXTURE_2D; |
721 | } |
714 | } |
… | |
… | |
2157 | glScale $self->{w}, $self->{h}; |
2150 | glScale $self->{w}, $self->{h}; |
2158 | |
2151 | |
2159 | if ($self->{vertical}) { |
2152 | if ($self->{vertical}) { |
2160 | # draw a vertical slider like a rotated horizontal slider |
2153 | # draw a vertical slider like a rotated horizontal slider |
2161 | |
2154 | |
|
|
2155 | glTranslate 1, 0, 0; |
2162 | glRotate 90, 0, 0, 1; |
2156 | glRotate 90, 0, 0, 1; |
2163 | glTranslate 0, 1, 0; |
|
|
2164 | } |
2157 | } |
2165 | |
2158 | |
2166 | my $fg = $FOCUS == $self ? $self->{active_fg} : $self->{fg}; |
2159 | my $fg = $FOCUS == $self ? $self->{active_fg} : $self->{fg}; |
2167 | my $bg = $FOCUS == $self ? $self->{active_bg} : $self->{bg}; |
2160 | my $bg = $FOCUS == $self ? $self->{active_bg} : $self->{bg}; |
2168 | |
2161 | |
… | |
… | |
2284 | |
2277 | |
2285 | delete $self->{texture}; |
2278 | delete $self->{texture}; |
2286 | } |
2279 | } |
2287 | |
2280 | |
2288 | $self->{texture} ||= new_from_opengl CFClient::Texture $self->{children}[0]{w}, $self->{children}[0]{h}, sub { |
2281 | $self->{texture} ||= new_from_opengl CFClient::Texture $self->{children}[0]{w}, $self->{children}[0]{h}, sub { |
2289 | glClearColor 0, 0, 0, 0; |
2282 | glClearColor 0.5, 0.5, 0.5, 0; |
2290 | glClear GL_COLOR_BUFFER_BIT; |
2283 | glClear GL_COLOR_BUFFER_BIT; |
2291 | |
2284 | |
2292 | glEnable GL_TEXTURE_2D; |
2285 | glEnable GL_TEXTURE_2D; |
2293 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
2286 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
2294 | |
2287 | |
… | |
… | |
2326 | my ($self) = @_; |
2319 | my ($self) = @_; |
2327 | |
2320 | |
2328 | glEnable GL_TEXTURE_2D; |
2321 | glEnable GL_TEXTURE_2D; |
2329 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
2322 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
2330 | glColor 1, 1, 1, 1; |
2323 | glColor 1, 1, 1, 1; |
2331 | $self->{texture}->draw_quad_alpha_premultiplied (0, 0, $self->{children}[0]{w}, $self->{children}[0]{h}); |
2324 | $self->{texture}->draw_quad_alpha (0, 0, $self->{children}[0]{w}, $self->{children}[0]{h}); |
2332 | glDisable GL_TEXTURE_2D; |
2325 | glDisable GL_TEXTURE_2D; |
2333 | |
2326 | |
2334 | $self->{children}[1]->draw; |
2327 | $self->{children}[1]->draw; |
2335 | |
2328 | |
2336 | } |
2329 | } |