| 78 | } |
| 79 | |
| 80 | void allocate(size_t new_width, size_t new_height) |
| 81 | { |
| 82 | width = new_width; |
| 83 | height = new_height; |
| 84 | size = height * width * bytes_per_pixel; |
| 85 | data = new unsigned char[size]; |
| 86 | |
| 87 | glGenTextures(1, &texture); |
| 88 | bindToUnit(GL_TEXTURE0); |
| 89 | glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); |
| 90 | glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); |
| 91 | glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 92 | glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 93 | glTexImage2D(GL_TEXTURE_RECTANGLE, 0, FormatT::InternalFormat, width, height, 0, FormatT::Format, FormatT::Type, 0); |
| 94 | } |
| 95 | |
| 96 | void deallocate() |
| 97 | { |