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:
-rw-r--r--source/blender/editors/screen/area.c18
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c25
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c26
-rw-r--r--source/blender/gpu/intern/gpu_draw.c25
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.c12
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c20
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c18
7 files changed, 74 insertions, 70 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 7e1fda6d095..0d3a060b8ee 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -58,9 +58,9 @@
#include "ED_space_api.h"
#include "GPU_immediate.h"
+#include "GPU_matrix.h"
#include "GPU_draw.h"
-#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "BLF_api.h"
@@ -123,7 +123,7 @@ static void region_draw_emboss(const ARegion *ar, const rcti *scirct)
void ED_region_pixelspace(ARegion *ar)
{
wmOrtho2_region_pixelspace(ar);
- glLoadIdentity();
+ gpuLoadIdentity();
}
/* only exported for WM */
@@ -455,8 +455,8 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glPushMatrix();
- glTranslatef(-ar->winrct.xmin, -ar->winrct.ymin, 0.0f);
+ gpuPushMatrix();
+ gpuTranslate2f(-ar->winrct.xmin, -ar->winrct.ymin);
for (az = sa->actionzones.first; az; az = az->next) {
/* test if action zone is over this region */
@@ -493,7 +493,7 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar)
}
}
- glPopMatrix();
+ gpuPopMatrix();
glDisable(GL_BLEND);
}
@@ -2338,11 +2338,11 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame,
return;
/* find window pixel coordinates of origin */
- glPushMatrix();
+ gpuPushMatrix();
/* offset and zoom using ogl */
- glTranslatef(x, y, 0.0f);
- glScalef(zoomx, zoomy, 1.0f);
+ gpuTranslate2f(x, y);
+ gpuScale2f(zoomx, zoomy);
BLF_size(blf_mono_font, style->widgetlabel.points * 1.5f * U.pixelsize, U.dpi);
@@ -2396,7 +2396,7 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame,
BLF_disable(blf_mono_font, BLF_CLIPPING);
}
- glPopMatrix();
+ gpuPopMatrix();
}
void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy)
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index e1eaf2e1727..2fa154015fd 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -207,11 +207,10 @@ static void view3d_main_region_setup_view(Scene *scene, View3D *v3d, ARegion *ar
ED_view3d_update_viewmat(scene, v3d, ar, viewmat, winmat);
/* set for opengl */
- /* TODO(merwin): transition to GPU_matrix API */
glMatrixMode(GL_PROJECTION);
- glLoadMatrixf(rv3d->winmat);
+ gpuLoadMatrix3D(rv3d->winmat); /* XXX make a gpuLoadProjectionMatrix function? */
glMatrixMode(GL_MODELVIEW);
- glLoadMatrixf(rv3d->viewmat);
+ gpuLoadMatrix3D(rv3d->viewmat);
}
static bool view3d_stereo3d_active(const bContext *C, Scene *scene, View3D *v3d, RegionView3D *rv3d)
@@ -773,9 +772,9 @@ static bool view3d_draw_render_draw(const bContext *C, Scene *scene,
/* background draw */
glMatrixMode(GL_PROJECTION);
- glPushMatrix();
+ gpuPushMatrix();
glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gpuPushMatrix();
ED_region_pixelspace(ar);
if (clip_border) {
@@ -804,9 +803,9 @@ static bool view3d_draw_render_draw(const bContext *C, Scene *scene,
}
glMatrixMode(GL_PROJECTION);
- glPopMatrix();
+ gpuPopMatrix();
glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gpuPopMatrix();
return true;
}
@@ -1498,9 +1497,9 @@ static void view3d_draw_grid(const bContext *C, ARegion *ar)
drawgrid(&scene->unit, ar, v3d, &grid_unit);
glMatrixMode(GL_PROJECTION);
- glLoadMatrixf(rv3d->winmat);
+ gpuLoadMatrix3D(rv3d->winmat); /* XXX make a gpuLoadProjectionMatrix function? */
glMatrixMode(GL_MODELVIEW);
- glLoadMatrixf(rv3d->viewmat);
+ gpuLoadMatrix3D(rv3d->viewmat);
}
else {
drawfloor(scene, v3d, &grid_unit, false);
@@ -1786,9 +1785,9 @@ Scene *scene, SceneLayer *sl, Object *ob, Base *base, View3D *v3d,
RegionView3D *rv3d, const bool is_boundingbox, const unsigned char color[4])
{
glMatrixMode(GL_PROJECTION);
- glPushMatrix();
+ gpuPushMatrix();
glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gpuPushMatrix();
/* multiply view with object matrix.
* local viewmat and persmat, to calculate projections */
@@ -1834,9 +1833,9 @@ RegionView3D *rv3d, const bool is_boundingbox, const unsigned char color[4])
ED_view3d_clear_mats_rv3d(rv3d);
glMatrixMode(GL_PROJECTION);
- glPopMatrix();
+ gpuPopMatrix();
glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gpuPopMatrix();
}
/* ******************** info ***************** */
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index f7896de128e..43e6742061b 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -76,7 +76,6 @@
#include "IMB_imbuf.h"
#include "IMB_colormanagement.h"
-#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "WM_api.h"
@@ -103,6 +102,7 @@
#include "GPU_extensions.h"
#include "GPU_immediate.h"
#include "GPU_select.h"
+#include "GPU_matrix.h"
#include "view3d_intern.h" /* own include */
@@ -752,13 +752,13 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glMatrixMode(GL_PROJECTION);
- glPushMatrix();
+ gpuPushMatrix();
glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gpuPushMatrix();
ED_region_pixelspace(ar);
- glTranslatef(centx, centy, 0.0);
- glRotatef(RAD2DEGF(-bgpic->rotation), 0.0f, 0.0f, 1.0f);
+ gpuTranslate2f(centx, centy);
+ gpuRotate2D(RAD2DEGF(-bgpic->rotation));
if (bgpic->flag & V3D_BGPIC_FLIP_X) {
zoomx *= -1.0f;
@@ -775,9 +775,9 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
zoomx, zoomy, col);
glMatrixMode(GL_PROJECTION);
- glPopMatrix();
+ gpuPopMatrix();
glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gpuPopMatrix();
glDisable(GL_BLEND);
@@ -1190,7 +1190,7 @@ void ED_view3d_draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
glClear(GL_DEPTH_BUFFER_BIT);
- glLoadMatrixf(rv3d->viewmat);
+ gpuLoadMatrix3D(rv3d->viewmat);
v3d->zbuf = true;
glEnable(GL_DEPTH_TEST);
@@ -1228,7 +1228,7 @@ void ED_view3d_draw_depth(Scene *scene, ARegion *ar, View3D *v3d, bool alphaover
glClear(GL_DEPTH_BUFFER_BIT);
- glLoadMatrixf(rv3d->viewmat);
+ gpuLoadMatrix3D(rv3d->viewmat);
if (rv3d->rflag & RV3D_CLIPPING) {
ED_view3d_clipping_set(rv3d);
@@ -1586,9 +1586,9 @@ static void view3d_draw_objects(
VP_legacy_drawgrid(&scene->unit, ar, v3d, grid_unit);
/* XXX make function? replaces persp(1) */
glMatrixMode(GL_PROJECTION);
- glLoadMatrixf(rv3d->winmat);
+ gpuLoadMatrix3D(rv3d->winmat); /* XXX make a gpuLoadProjectionMatrix function? */
glMatrixMode(GL_MODELVIEW);
- glLoadMatrixf(rv3d->viewmat);
+ gpuLoadMatrix3D(rv3d->viewmat);
}
else if (!draw_grids_after) {
VP_legacy_drawfloor(scene, v3d, grid_unit, true);
@@ -1798,7 +1798,7 @@ void ED_view3d_draw_offscreen(
bool do_compositing = false;
RegionView3D *rv3d = ar->regiondata;
- glPushMatrix();
+ gpuPushMatrix();
/* set temporary new size */
int bwinx = ar->winx;
@@ -1884,7 +1884,7 @@ void ED_view3d_draw_offscreen(
ar->winy = bwiny;
ar->winrct = brect;
- glPopMatrix();
+ gpuPopMatrix();
UI_Theme_Restore(&theme_state);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index e1d9e78c0b2..d02759160e2 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -78,6 +78,7 @@
#include "GPU_draw.h"
#include "GPU_extensions.h"
#include "GPU_material.h"
+#include "GPU_matrix.h"
#include "GPU_shader.h"
#include "GPU_texture.h"
@@ -155,12 +156,12 @@ void GPU_render_text(
character = BLI_str_utf8_as_unicode_and_size_safe(textstr + index, &index);
if (character == '\n') {
- glTranslatef(line_start, -line_height, 0.0f);
+ gpuTranslate2f(line_start, -line_height);
line_start = 0.0f;
continue;
}
else if (character == '\t') {
- glTranslatef(advance_tab, 0.0f, 0.0f);
+ gpuTranslate2f(advance_tab, 0.0f);
line_start -= advance_tab; /* so we can go back to the start of the line */
continue;
@@ -209,10 +210,10 @@ void GPU_render_text(
}
glEnd();
- glTranslatef(advance, 0.0f, 0.0f);
+ gpuTranslate2f(advance, 0.0f);
line_start -= advance; /* so we can go back to the start of the line */
}
- glPopMatrix();
+ gpuPopMatrix();
BKE_image_release_ibuf(ima, first_ibuf, NULL);
}
@@ -419,7 +420,7 @@ void GPU_clear_tpage(bool force)
GTS.curima = NULL;
if (GTS.curtilemode != 0) {
glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
+ gpuLoadIdentity();
glMatrixMode(GL_MODELVIEW);
}
GTS.curtilemode = 0;
@@ -603,10 +604,10 @@ int GPU_verify_image(
GTS.curtileYRep != GTS.tileYRep)
{
glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
+ gpuLoadIdentity();
if (ima && (ima->tpageflag & IMA_TILES))
- glScalef(ima->xrep, ima->yrep, 1.0f);
+ gpuScale2f(ima->xrep, ima->yrep);
glMatrixMode(GL_MODELVIEW);
}
@@ -2095,7 +2096,7 @@ void GPU_end_object_materials(void)
/* resetting the texture matrix after the scaling needed for tiled textures */
if (GTS.tilemode) {
glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
+ gpuLoadIdentity();
glMatrixMode(GL_MODELVIEW);
}
}
@@ -2172,8 +2173,8 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[4][
Lamp *la = base->object->data;
/* setup lamp transform */
- glPushMatrix();
- glLoadMatrixf((float *)viewmat);
+ gpuPushMatrix();
+ gpuLoadMatrix3D(viewmat);
/* setup light */
GPULightData light = {0};
@@ -2207,7 +2208,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[4][
GPU_basic_shader_light_set(count, &light);
- glPopMatrix();
+ gpuPopMatrix();
count++;
if (count == 8)
@@ -2285,7 +2286,7 @@ void GPU_state_init(void)
glDepthRange(0.0, 1.0);
glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
+ gpuLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glFrontFace(GL_CCW);
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c
index 87d734dd40b..e807c5523a6 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -225,9 +225,9 @@ void GPU_texture_bind_as_framebuffer(GPUTexture *tex)
GG.currentfb = fb->object;
glMatrixMode(GL_PROJECTION);
- glPushMatrix();
+ gpuPushMatrix();
glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gpuPushMatrix();
}
void GPU_framebuffer_slots_bind(GPUFrameBuffer *fb, int slot)
@@ -263,9 +263,9 @@ void GPU_framebuffer_slots_bind(GPUFrameBuffer *fb, int slot)
GG.currentfb = fb->object;
glMatrixMode(GL_PROJECTION);
- glPushMatrix();
+ gpuPushMatrix();
glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gpuPushMatrix();
}
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
@@ -310,9 +310,9 @@ void GPU_framebuffer_texture_unbind(GPUFrameBuffer *UNUSED(fb), GPUTexture *UNUS
{
/* restore matrix */
glMatrixMode(GL_PROJECTION);
- glPopMatrix();
+ gpuPopMatrix();
glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gpuPopMatrix();
/* restore attributes */
glPopAttrib();
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 0f99f139cb0..d3095affb83 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -89,7 +89,9 @@
#include "BLF_api.h"
#include "BIF_glutil.h" /* for paint cursor */
+
#include "GPU_immediate.h"
+#include "GPU_matrix.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@@ -3079,8 +3081,8 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
/* set up rotation if available */
if (rc->rot_prop) {
rot = RNA_property_float_get(&rc->rot_ptr, rc->rot_prop);
- glPushMatrix();
- glRotatef(RAD2DEGF(rot), 0, 0, 1);
+ gpuPushMatrix();
+ gpuRotate2D(RAD2DEGF(rot));
}
/* draw textured quad */
@@ -3102,7 +3104,7 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
/* undo rotation */
if (rc->rot_prop)
- glPopMatrix();
+ gpuPopMatrix();
}
else {
/* flat color if no texture available */
@@ -3170,7 +3172,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
/* Keep cursor in the original place */
x = rc->initial_mouse[0] - ar->winrct.xmin;
y = rc->initial_mouse[1] - ar->winrct.ymin;
- glTranslatef((float)x, (float)y, 0.0f);
+ gpuTranslate2f((float)x, (float)y);
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
@@ -3178,7 +3180,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
/* apply zoom if available */
if (rc->zoom_prop) {
RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
- glScalef(zoom[0], zoom[1], 1);
+ gpuScale2fv(zoom);
}
/* draw rotated texture */
@@ -3195,23 +3197,23 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
immUniformColor3fvAlpha(col, 0.5);
if (rc->subtype == PROP_ANGLE) {
- glPushMatrix();
+ gpuPushMatrix();
/* draw original angle line */
- glRotatef(RAD2DEGF(rc->initial_value), 0, 0, 1);
+ gpuRotate2D(RAD2DEGF(rc->initial_value));
immBegin(GL_LINES, 2);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
immEnd();
/* draw new angle line */
- glRotatef(RAD2DEGF(rc->current_value - rc->initial_value), 0, 0, 1);
+ gpuRotate2D(RAD2DEGF(rc->current_value - rc->initial_value));
immBegin(GL_LINES, 2);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
immEnd();
- glPopMatrix();
+ gpuPopMatrix();
}
/* draw circles on top */
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 75e82a18994..926220f8c6c 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -64,6 +64,8 @@
#include "BIF_gl.h"
#include "BIF_glutil.h"
+#include "GPU_matrix.h"
+
#include "DNA_scene_types.h"
#include "ED_datafiles.h" /* for fonts */
#include "GHOST_C-api.h"
@@ -191,8 +193,8 @@ static void playanim_gl_matrix(void)
{
/* unified matrix, note it affects offset for drawing */
glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
+ gpuLoadIdentity();
+ glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); /* XXX revisit this when 2D matrix API is complete */
glMatrixMode(GL_MODELVIEW);
}
@@ -355,11 +357,11 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
fac = 2.0f * fac - 1.0f;
glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
+ gpuPushMatrix();
+ gpuLoadIdentity();
glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ gpuPushMatrix();
+ gpuLoadIdentity();
glColor4f(0.0f, 1.0f, 0.0f, 1.0f);
@@ -368,9 +370,9 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
glVertex2f(fac, 1.0f);
glEnd();
- glPopMatrix();
+ gpuPopMatrix();
glMatrixMode(GL_PROJECTION);
- glPopMatrix();
+ gpuPopMatrix();
glMatrixMode(GL_MODELVIEW);
}