Transform an equirectangular map to a six sided cubemap
| 184 | |
| 185 | //Transform an equirectangular map to a six sided cubemap |
| 186 | void CubeMap::equiRectangularToCubeMap(const unsigned int equirectangularMap, |
| 187 | const int resolution, const Shader &transformShader){ |
| 188 | transformShader.use(); |
| 189 | transformShader.setInt("equirectangularMap", 0); |
| 190 | transformShader.setMat4("projection", captureProjection); |
| 191 | |
| 192 | glActiveTexture(GL_TEXTURE0); |
| 193 | glBindTexture(GL_TEXTURE_2D, equirectangularMap); |
| 194 | glViewport(0, 0, resolution, resolution); |
| 195 | |
| 196 | for(unsigned int i = 0; i < numSidesInCube; i++){ |
| 197 | transformShader.setMat4("view", captureViews[i]); |
| 198 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 199 | GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, textureID, 0); |
| 200 | |
| 201 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
| 202 | drawCube(); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | //This function seems kind of useless, I should check to see if it is being inlined away |
| 207 | //by the compiler and think of better ways to do this |
no test coverage detected