… | |
… | |
687 | |
687 | |
688 | sub render_child { |
688 | sub render_child { |
689 | my ($self) = @_; |
689 | my ($self) = @_; |
690 | |
690 | |
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.5, 0.5, 0.5, 1; |
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 | } |
… | |
… | |
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 | |