| 58 | } |
| 59 | |
| 60 | void TextureResource::initFromScreen() |
| 61 | { |
| 62 | deinit(); |
| 63 | |
| 64 | int width = Renderer::getScreenWidth(); |
| 65 | int height = Renderer::getScreenHeight(); |
| 66 | |
| 67 | glGenTextures(1, &mTextureID); |
| 68 | glBindTexture(GL_TEXTURE_2D, mTextureID); |
| 69 | |
| 70 | glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, width, height, 0); |
| 71 | |
| 72 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 73 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 74 | |
| 75 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); |
| 76 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); |
| 77 | |
| 78 | mTextureSize[0] = height; |
| 79 | mTextureSize[1] = height; |
| 80 | } |
| 81 | |
| 82 | void TextureResource::deinit() |
| 83 | { |
no test coverage detected