MCPcopy Create free account
hub / github.com/Angelo1211/HybridRenderingEngine / equiRectangularToCubeMap

Method equiRectangularToCubeMap

src/cubeMap.cpp:186–204  ·  view source on GitHub ↗

Transform an equirectangular map to a six sided cubemap

Source from the content-addressed store, hash-verified

184
185//Transform an equirectangular map to a six sided cubemap
186void 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

Callers 1

Calls 3

useMethod · 0.80
setIntMethod · 0.80
setMat4Method · 0.80

Tested by

no test coverage detected