31 GLenum internal_format,
32 GLenum type, GLenum format) {
38 for(
unsigned int i = 0; i < 6; i++) {
39 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0,
40 internal_format, res_x, res_y, 0, format,
43 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
44 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
45 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
46 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
47 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
70 std::vector<const Image *> sides =
71 {&pos_x, &neg_x, &pos_y, &neg_y, &pos_z, &neg_z};
74 for(
unsigned int i = 0; i < 6; i++) {
75 tmp = SDL_ConvertSurfaceFormat(sides[i]->image,
76 SDL_PIXELFORMAT_RGBA8888, 0);
81 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA,
83 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, tmp->pixels);
86 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
87 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
88 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
89 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
90 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
void create_empty(unsigned int res_x, unsigned int res_y, GLenum internal_format, GLenum type, GLenum format)
Creates an empty texture.
bool load(const std::string &pos_x, const std::string &neg_x, const std::string &pos_y, const std::string &neg_y, const std::string &pos_z, const std::string &neg_z)
Load a new cubemap.
unsigned int width
The width of the texture.
unsigned int height
The height of the texture.