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

Comparing deliantra/Deliantra-Client/DC/Texture.pm (file contents):
Revision 1.1 by root, Fri May 26 18:28:23 2006 UTC vs.
Revision 1.4 by root, Tue Jun 6 02:55:50 2006 UTC

122 unless ($tw > 0 && $th > 0) { 122 unless ($tw > 0 && $th > 0) {
123 $tw = $th = 1; 123 $tw = $th = 1;
124 $data = "\x00" x 64; 124 $data = "\x00" x 64;
125 } 125 }
126 126
127 $self->{minified} = [CFClient::average $tw, $th, $data] 127 $self->{minified} ||= [CFClient::average $tw, $th, $data]
128 if $self->{minify}; 128 if $self->{minify};
129 129
130 unless ($GL_NPOT) { 130 unless ($GL_NPOT) {
131 # TODO: does not work for zero-sized textures 131 # TODO: does not work for zero-sized textures
132 $tw = topot $tw; 132 $tw = topot $tw;
145 145
146 $self->{name} ||= glGenTexture; 146 $self->{name} ||= glGenTexture;
147 147
148 glBindTexture GL_TEXTURE_2D, $self->{name}; 148 glBindTexture GL_TEXTURE_2D, $self->{name};
149 149
150 if ($self->{wrap}) {
150 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP; 151 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT;
151 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP; 152 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT;
153 } else {
154 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, $GL_VERSION >= 1.2 ? GL_CLAMP_TO_EDGE : GL_CLAMP;
155 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, $GL_VERSION >= 1.2 ? GL_CLAMP_TO_EDGE : GL_CLAMP;
156 }
152 157
153 if ($::FAST) { 158 if ($::FAST) {
154 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST; 159 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST;
155 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST; 160 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST;
156 } elsif ($self->{mipmap} && $GL_VERSION >= 1.4) { 161 } elsif ($self->{mipmap} && $GL_VERSION >= 1.4) {
157 # alternatively check for 0x8191
158 glTexParameter GL_TEXTURE_2D, GL_GENERATE_MIPMAP, 1; 162 glTexParameter GL_TEXTURE_2D, GL_GENERATE_MIPMAP, 1;
159 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR; 163 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR;
160 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR; 164 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR;
161 } else { 165 } else {
162 glTexParameter GL_TEXTURE_2D, GL_GENERATE_MIPMAP, $self->{mipmap}; 166 glTexParameter GL_TEXTURE_2D, GL_GENERATE_MIPMAP, $self->{mipmap};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines