#include <math.h>
+#include <assert.h>
#include "texture.h"
#include "image.h"
#include "opengl.h"
} else {
glActiveTexture(GL_TEXTURE0 + tunit);
glBindTexture(cur_target[tunit], 0);
+ assert(glGetError() == GL_NO_ERROR);
glActiveTexture(GL_TEXTURE0);
}
}
}
glBindTexture(target, id);
+ assert(glGetError() == GL_NO_ERROR);
glTexParameteri(target, GL_TEXTURE_WRAP_S, wrap);
glTexParameteri(target, GL_TEXTURE_WRAP_T, wrap);
glTexParameteri(target, GL_TEXTURE_WRAP_R, wrap);
void Texture::set_filtering(unsigned int min_filt, unsigned int mag_filt)
{
glBindTexture(target, id);
+ assert(glGetError() == GL_NO_ERROR);
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, min_filt);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, mag_filt);
}
{
glActiveTexture(GL_TEXTURE0 + tex_unit);
glBindTexture(target, id);
+ assert(glGetError() == GL_NO_ERROR);
glActiveTexture(GL_TEXTURE0);
cur_target[tex_unit] = target;
target = type_to_target(textype);
glBindTexture(target, id);
+ assert(glGetError() == GL_NO_ERROR);
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
pixels[1] = 64;
pixels[2] = chess ? 32 : 255;
pixels[3] = 255;
+ pixels += 4;
}
}
+ default_img->save("/tmp/foo.png");
}
switch(type) {
target = GL_TEXTURE_2D;
glBindTexture(target, id);
+ assert(glGetError() == GL_NO_ERROR);
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_REPEAT);
target = GL_TEXTURE_CUBE_MAP;
glBindTexture(target, id);
+ assert(glGetError() == GL_NO_ERROR);
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
Texture *TextureSet::get_texture(const char *name, TextureType type) const
{
- typename std::map<std::string, Texture*>::const_iterator iter = data.find(name);
+ std::map<std::string, Texture*>::const_iterator iter = data.find(name);
if(iter != data.end()) {
return iter->second;
}
Texture *res = create();
+ data[name] = res;
res->create_default(type);
resman_lookup(rman, name, res);
return res;