… | |
… | |
131 | sub render_chld { |
131 | sub render_chld { |
132 | my ($self) = @_; |
132 | my ($self) = @_; |
133 | my $chld = $self->get; |
133 | my $chld = $self->get; |
134 | my ($w, $h) = $self->size_request; |
134 | my ($w, $h) = $self->size_request; |
135 | |
135 | |
|
|
136 | $w = $h = 256; |
|
|
137 | |
136 | $self->{texture} = |
138 | $self->{texture} = |
137 | Crossfire::Client::Texture->new_from_opengl ( |
139 | Crossfire::Client::Texture->new_from_opengl ( |
138 | $w, $h, sub { |
140 | $w, $h, sub { |
139 | my ($txt, $w, $h) = @_; |
141 | glPushMatrix; |
|
|
142 | glLoadIdentity; |
140 | $chld->_draw; |
143 | $chld->_draw; |
|
|
144 | glPopMatrix; |
141 | } |
145 | } |
142 | ); |
146 | ); |
143 | $self->{texture}->upload; |
147 | $self->{texture}->upload; |
144 | } |
148 | } |
145 | |
149 | |
… | |
… | |
151 | } |
155 | } |
152 | |
156 | |
153 | sub _draw { |
157 | sub _draw { |
154 | my ($self) = @_; |
158 | my ($self) = @_; |
155 | |
159 | |
|
|
160 | my ($w, $h) = $self->size_request; |
156 | my $tex = $self->{texture} |
161 | my $tex = $self->{texture} |
157 | or return; |
162 | or return; |
158 | |
163 | |
159 | warn "DRAW TEX: $tex->{width} $tex->{height}\n"; |
|
|
160 | glEnable GL_BLEND; |
164 | glEnable GL_BLEND; |
161 | glEnable GL_TEXTURE_2D; |
165 | glEnable GL_TEXTURE_2D; |
162 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
166 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
163 | glBindTexture GL_TEXTURE_2D, $tex->{name}; |
167 | glBindTexture GL_TEXTURE_2D, $tex->{name}; |
164 | |
168 | |
165 | glColor 1, 1, 1; |
169 | glColor 1, 1, 1; |
166 | |
170 | |
167 | glBegin GL_QUADS; |
171 | glBegin GL_QUADS; |
168 | glTexCoord 0, 0; glVertex 0 , 0; |
172 | glTexCoord 0, 0; glVertex 0 , 0; |
169 | glTexCoord 0, 1; glVertex 0 , $tex->{height}; |
173 | glTexCoord 0, 1; glVertex 0 , $h; |
170 | glTexCoord 1, 1; glVertex $tex->{width}, $tex->{height}; |
174 | glTexCoord 1, 1; glVertex $w , $h; |
171 | glTexCoord 1, 0; glVertex $tex->{width}, 0; |
175 | glTexCoord 1, 0; glVertex $w , 0; |
172 | glEnd; |
176 | glEnd; |
173 | |
177 | |
174 | glDisable GL_BLEND; |
178 | glDisable GL_BLEND; |
175 | glDisable GL_TEXTURE_2D; |
179 | glDisable GL_TEXTURE_2D; |
176 | } |
180 | } |