summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2020-09-25 18:14:46 +0200
committerraysan5 <[email protected]>2020-09-25 18:14:46 +0200
commitfe8bf2fa556a56c4d541a334a329467120c11a28 (patch)
treea33c093b9be94f11f1af691c59ce35b864dd9d6e
parentb9ece86ffdf6e8fa14c3432e26e126429fffbb17 (diff)
downloadraylib-fe8bf2fa556a56c4d541a334a329467120c11a28.tar.gz
raylib-fe8bf2fa556a56c4d541a334a329467120c11a28.zip
REVIEWED: GenTextureCubemap(), use rlgl functionality only
Function has been reviewed to avoid any direct OpenGL call and use rlgl functionality, also, GenDrawCube() has been replaced by the internal batch system with DrawCube(). WARNING: rlEnableTexture() call must be issued after enabling the current framebuffer when using batch mechanism because it includes a set of security checks to avoid batch overflow and push/pop matrix operations.
-rw-r--r--src/rlgl.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/rlgl.h b/src/rlgl.h
index 2710beb8..0ecf1cb5 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -3327,8 +3327,8 @@ TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, in
};
rlEnableShader(shader.id);
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, panorama.id);
+ //glActiveTexture(GL_TEXTURE0);
+ //glBindTexture(GL_TEXTURE_2D, panorama.id);
rlViewport(0, 0, size, size); // Set viewport to current fbo dimensions
@@ -3338,8 +3338,14 @@ TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, in
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i);
rlEnableFramebuffer(fbo);
+ rlEnableTexture(panorama.id); // WARNING: It must be called after enabling current framebuffer if using internal batch system!
+
rlClearScreenBuffers();
- GenDrawCube();
+ //GenDrawCube();
+
+ // Using internal batch system instead of raw OpenGL cube creating+drawing
+ DrawCubeV(Vector3Zero(), Vector3One(), WHITE);
+ DrawRenderBatch(RLGL.currentBatch);
}
//------------------------------------------------------------------------------------------