Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2017-03-22 01:10:20 +0300
committerMike Erwin <significant.bit@gmail.com>2017-03-22 01:10:20 +0300
commit0a274df536251adbb7141f6baf8a95af89e50710 (patch)
tree6605097f2b57347dbdff1d28d3a0c35b4edb0a59 /source/blender/gpu/intern/gpu_matrix.c
parent6d2aca5a96efd8ac61eec633c43a41e641379a68 (diff)
OpenGL: add gpuLoadProjectionMatrix3D function
Make an existing 4x4 matrix the current projection. Found a need for this while converting code to new API. Part of T49450
Diffstat (limited to 'source/blender/gpu/intern/gpu_matrix.c')
-rw-r--r--source/blender/gpu/intern/gpu_matrix.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_matrix.c b/source/blender/gpu/intern/gpu_matrix.c
index cbef2d7373e..8cc51176310 100644
--- a/source/blender/gpu/intern/gpu_matrix.c
+++ b/source/blender/gpu/intern/gpu_matrix.c
@@ -32,6 +32,8 @@
#define SUPPRESS_GENERIC_MATRIX_API
#include "GPU_matrix.h"
+#include "BIF_glutil.h"
+
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.h"
@@ -185,6 +187,32 @@ void gpuLoadMatrix3D(const float m[4][4])
state.dirty = true;
}
+void gpuLoadProjectionMatrix3D(const float m[4][4])
+{
+#if SUPPORT_LEGACY_MATRIX
+ if (state.mode == MATRIX_MODE_INACTIVE) {
+ GLenum mode = glaGetOneInt(GL_MATRIX_MODE);
+ if (mode != GL_PROJECTION_MATRIX) {
+ glMatrixMode(GL_PROJECTION_MATRIX);
+ }
+
+ glLoadMatrixf((const float*) m);
+
+ if (mode != GL_PROJECTION_MATRIX) {
+ glMatrixMode(mode); /* restore */
+ }
+
+ state.dirty = true;
+ return;
+ }
+#endif
+
+ BLI_assert(state.mode == MATRIX_MODE_3D);
+ copy_m4_m4(Projection3D, m);
+ CHECKMAT(Projection3D);
+ state.dirty = true;
+}
+
void gpuLoadMatrix2D(const float m[3][3])
{
BLI_assert(state.mode == MATRIX_MODE_2D);