Create the texture
| 52 | |
| 53 | // Create the texture |
| 54 | void Texture2D::create(uint width, uint height, uint internalFormat, uint format, uint type, |
| 55 | void* data) { |
| 56 | |
| 57 | // Destroy the current texture |
| 58 | destroy(); |
| 59 | |
| 60 | mWidth = width; |
| 61 | mHeight = height; |
| 62 | |
| 63 | // Create the OpenGL texture |
| 64 | glGenTextures(1, &mID); |
| 65 | assert(mID != 0); |
| 66 | glBindTexture(GL_TEXTURE_2D, mID); |
| 67 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 68 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 69 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 70 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 71 | glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, mWidth, mHeight, 0, format, type, data); |
| 72 | glBindTexture(GL_TEXTURE_2D, 0); |
| 73 | } |
| 74 | |
| 75 | // Create the texture |
| 76 | void Texture2D::create(uint width, uint height, uint internalFormat, uint format, uint type, |
nothing calls this directly
no outgoing calls
no test coverage detected