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
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h2
-rw-r--r--source/blender/editors/animation/keyframes_draw.c6
-rw-r--r--source/blender/editors/interface/interface_panel.c136
-rw-r--r--source/blender/editors/mask/mask_draw.c12
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c20
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c4
-rw-r--r--source/blender/editors/space_clip/clip_draw.c83
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c18
-rw-r--r--source/blender/editors/space_clip/space_clip.c14
-rw-r--r--source/blender/editors/space_graph/graph_draw.c10
-rw-r--r--source/blender/editors/space_image/image_draw.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c2
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c2
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c4
-rw-r--r--source/blender/editors/space_view3d/drawobject.c26
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c29
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c14
-rw-r--r--source/blender/gpu/GPU_deprecated.h10
-rw-r--r--source/blender/gpu/GPU_material.h4
-rw-r--r--source/blender/gpu/intern/gpu_draw.c4
-rw-r--r--source/blender/gpu/intern/gpu_raster.c2
-rw-r--r--source/blender/gpu/intern/gpu_sprite.c2
22 files changed, 220 insertions, 186 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 216c119e837..b3db0eacb73 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -150,6 +150,8 @@ typedef int (*DMCompareDrawOptions)(void *userData, int cur_index, int next_inde
typedef void (*DMSetDrawInterpOptions)(void *userData, int index, float t);
typedef DMDrawOption (*DMSetDrawOptions)(void *userData, int index);
typedef DMDrawOption (*DMSetDrawOptionsTex)(struct MTFace *tface, const bool has_vcol, int matnr);
+typedef void (*DMForEachMappedVert)(void *, int, const float *, const float *, const short *);
+typedef void (*DMForEachMappedFaceCenter)(void *, int, const float *, const float *);
typedef enum DMDrawFlag {
DM_DRAW_USE_COLORS = 1,
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 5152113c39d..c95afe0bd8c 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -599,7 +599,7 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
* greying out protected/muted channels doesn't work correctly!
*/
inner_col[3] *= alpha;
- glColor4fv(inner_col);
+ gpuColor4fv(inner_col);
/* draw the "filled in" interior poly now */
gpuBegin(GL_QUADS);
@@ -623,7 +623,7 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
else UI_GetThemeColor4fv(TH_KEYBORDER, border_col);
border_col[3] *= alpha;
- glColor4fv(border_col);
+ gpuColor4fv(border_col);
gpuBegin(GL_LINE_LOOP);
gpuVertex2fv(_unit_diamond_shape[0]);
@@ -671,7 +671,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
UI_GetThemeColor4fv(TH_STRIP, color);
color[3] *= alpha;
- glColor4fv(color);
+ gpuColor4fv(color);
gpuSingleFilledRectf(ab->start, ypos - iconsize, ab->end, ypos + iconsize);
}
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 2b79b11acfa..427109272dc 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -51,6 +51,7 @@
#include "BKE_context.h"
#include "BKE_screen.h"
+#include "GPU_basic.h"
#include "GPU_blender_aspect.h"
#include "GPU_colors.h"
#include "GPU_primitives.h"
@@ -618,8 +619,8 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
{
glEnable(GL_BLEND);
UI_icon_draw_aspect(headrect.xmax - ((PNL_ICON * 2.2f) / block->aspect), headrect.ymin + (5.0f / block->aspect),
- (panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED,
- (block->aspect / UI_DPI_FAC), 1.0f);
+ (panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED,
+ (block->aspect / UI_DPI_FAC), 1.0f);
glDisable(GL_BLEND);
}
@@ -1338,15 +1339,15 @@ void UI_panel_category_clear_all(ARegion *ar)
/* based on uiDrawBox, check on making a version which allows us to skip some sides */
static void ui_panel_category_draw_tab(int mode, float minx, float miny, float maxx, float maxy, float rad,
- int roundboxtype,
- const bool use_highlight, const bool use_shadow,
- const unsigned char highlight_fade[3])
+ int roundboxtype,
+ const bool use_highlight, const bool use_shadow,
+ const unsigned char highlight_fade[3])
{
float vec[4][2] = {
- {0.195, 0.02},
- {0.55, 0.169},
- {0.831, 0.45},
- {0.98, 0.805}};
+ {0.195, 0.02},
+ {0.55, 0.169},
+ {0.831, 0.45},
+ {0.98, 0.805}};
int a;
/* mult */
@@ -1357,69 +1358,73 @@ static void ui_panel_category_draw_tab(int mode, float minx, float miny, float m
(void)use_shadow;
(void)use_highlight;
- glBegin(mode);
+ gpuImmediateFormat_V2();
+
+ gpuBegin(mode);
/* start with corner right-top */
if (use_highlight) {
if (roundboxtype & UI_CNR_TOP_RIGHT) {
- glVertex2f(maxx, maxy - rad);
+ gpuVertex2f(maxx, maxy - rad);
for (a = 0; a < 4; a++) {
- glVertex2f(maxx - vec[a][1], maxy - rad + vec[a][0]);
+ gpuVertex2f(maxx - vec[a][1], maxy - rad + vec[a][0]);
}
- glVertex2f(maxx - rad, maxy);
+ gpuVertex2f(maxx - rad, maxy);
}
else {
- glVertex2f(maxx, maxy);
+ gpuVertex2f(maxx, maxy);
}
/* corner left-top */
if (roundboxtype & UI_CNR_TOP_LEFT) {
- glVertex2f(minx + rad, maxy);
+ gpuVertex2f(minx + rad, maxy);
for (a = 0; a < 4; a++) {
- glVertex2f(minx + rad - vec[a][0], maxy - vec[a][1]);
+ gpuVertex2f(minx + rad - vec[a][0], maxy - vec[a][1]);
}
- glVertex2f(minx, maxy - rad);
+ gpuVertex2f(minx, maxy - rad);
}
else {
- glVertex2f(minx, maxy);
+ gpuVertex2f(minx, maxy);
}
}
if (use_highlight && !use_shadow) {
if (highlight_fade) {
- glColor3ubv(highlight_fade);
+ gpuColor3ubv(highlight_fade);
}
- glVertex2f(minx, miny + rad);
- glEnd();
+ gpuVertex2f(minx, miny + rad);
+ gpuEnd();
return;
}
/* corner left-bottom */
if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
- glVertex2f(minx, miny + rad);
+ gpuVertex2f(minx, miny + rad);
for (a = 0; a < 4; a++) {
- glVertex2f(minx + vec[a][1], miny + rad - vec[a][0]);
+ gpuVertex2f(minx + vec[a][1], miny + rad - vec[a][0]);
}
- glVertex2f(minx + rad, miny);
+ gpuVertex2f(minx + rad, miny);
}
else {
- glVertex2f(minx, miny);
+ gpuVertex2f(minx, miny);
}
/* corner right-bottom */
if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
- glVertex2f(maxx - rad, miny);
+ gpuVertex2f(maxx - rad, miny);
for (a = 0; a < 4; a++) {
- glVertex2f(maxx - rad + vec[a][0], miny + vec[a][1]);
+ gpuVertex2f(maxx - rad + vec[a][0], miny + vec[a][1]);
}
- glVertex2f(maxx, miny + rad);
+ gpuVertex2f(maxx, miny + rad);
}
else {
- glVertex2f(maxx, miny);
+ gpuVertex2f(maxx, miny);
}
- glEnd();
+ gpuEnd();
+
+ gpuImmediateUnformat();
}
@@ -1545,13 +1550,13 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
/* draw the background */
if (is_alpha) {
glEnable(GL_BLEND);
- glColor4ubv(theme_col_tab_bg);
+ gpuColor4ubv(theme_col_tab_bg);
}
else {
- glColor3ubv(theme_col_tab_bg);
+ gpuColor3ubv(theme_col_tab_bg);
}
- glRecti(v2d->mask.xmin, v2d->mask.ymin, v2d->mask.xmin + category_tabs_width, v2d->mask.ymax);
+ gpuSingleFilledRecti(v2d->mask.xmin, v2d->mask.ymin, v2d->mask.xmin + category_tabs_width, v2d->mask.ymax);
if (is_alpha) {
glDisable(GL_BLEND);
@@ -1573,38 +1578,35 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
if (is_active)
#endif
{
- glColor3ubv(is_active ? theme_col_tab_active : theme_col_tab_inactive);
+ gpuColor3ubv(is_active ? theme_col_tab_active : theme_col_tab_inactive);
ui_panel_category_draw_tab(GL_POLYGON, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
- tab_curve_radius - px, roundboxtype, true, true, NULL);
+ tab_curve_radius - px, roundboxtype, true, true, NULL);
/* tab outline */
- glColor3ubv(theme_col_tab_outline);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ gpuColor3ubv(theme_col_tab_outline);
ui_panel_category_draw_tab(GL_LINE_STRIP, rct->xmin - px, rct->ymin - px, rct->xmax - px, rct->ymax + px,
- tab_curve_radius, roundboxtype, true, true, NULL);
+ tab_curve_radius, roundboxtype, true, true, NULL);
/* tab highlight (3d look) */
- glShadeModel(GL_SMOOTH);
- glColor3ubv(is_active ? theme_col_tab_highlight : theme_col_tab_highlight_inactive);
+ GPU_aspect_enable(GPU_ASPECT_BASIC, GPU_BASIC_SMOOTH);
+ gpuColor3ubv(is_active ? theme_col_tab_highlight : theme_col_tab_highlight_inactive);
ui_panel_category_draw_tab(GL_LINE_STRIP, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
- tab_curve_radius, roundboxtype, true, false,
- is_active ? theme_col_back : theme_col_tab_inactive);
- glShadeModel(GL_FLAT);
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ tab_curve_radius, roundboxtype, true, false,
+ is_active ? theme_col_back : theme_col_tab_inactive);
+ GPU_aspect_disable(GPU_ASPECT_BASIC, GPU_BASIC_SMOOTH);
}
/* tab blackline */
if (!is_active) {
- glColor3ubv(theme_col_tab_divider);
- glRecti(v2d->mask.xmin + category_tabs_width - px,
- rct->ymin - tab_v_pad,
- v2d->mask.xmin + category_tabs_width,
- rct->ymax + tab_v_pad);
+ gpuColor3ubv(theme_col_tab_divider);
+ gpuSingleFilledRecti(v2d->mask.xmin + category_tabs_width - px,
+ rct->ymin - tab_v_pad,
+ v2d->mask.xmin + category_tabs_width,
+ rct->ymax + tab_v_pad);
}
if (do_scaletabs) {
category_draw_len = BLF_width_to_strlen(fontid, category_id_draw, category_draw_len,
- category_width, NULL);
+ category_width, NULL);
}
BLF_position(fontid, rct->xmax - text_v_ofs, rct->ymin + tab_v_pad_text, 0.0f);
@@ -1612,7 +1614,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
/* tab titles */
/* draw white shadow to give text more depth */
- glColor3ubv(theme_col_text);
+ gpuColor3ubv(theme_col_text);
/* main tab title */
BLF_draw(fontid, category_id_draw, category_draw_len);
@@ -1621,28 +1623,28 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
/* tab blackline remaining (last tab) */
if (pc_dyn->prev == NULL) {
- glColor3ubv(theme_col_tab_divider);
- glRecti(v2d->mask.xmin + category_tabs_width - px,
- rct->ymax + px,
- v2d->mask.xmin + category_tabs_width,
- v2d->mask.ymax);
+ gpuColor3ubv(theme_col_tab_divider);
+ gpuSingleFilledRecti(v2d->mask.xmin + category_tabs_width - px,
+ rct->ymax + px,
+ v2d->mask.xmin + category_tabs_width,
+ v2d->mask.ymax);
}
if (pc_dyn->next == NULL) {
- glColor3ubv(theme_col_tab_divider);
- glRecti(v2d->mask.xmin + category_tabs_width - px,
- 0,
- v2d->mask.xmin + category_tabs_width,
- rct->ymin);
+ gpuColor3ubv(theme_col_tab_divider);
+ gpuSingleFilledRecti(v2d->mask.xmin + category_tabs_width - px,
+ 0,
+ v2d->mask.xmin + category_tabs_width,
+ rct->ymin);
}
#ifdef USE_FLAT_INACTIVE
/* draw line between inactive tabs */
if (is_active == false && is_active_prev == false && pc_dyn->prev) {
- glColor3ubv(theme_col_tab_divider);
- glRecti(v2d->mask.xmin + (category_tabs_width / 5),
- rct->ymax + px,
- (v2d->mask.xmin + category_tabs_width) - (category_tabs_width / 5),
- rct->ymax + (px * 3));
+ gpuColor3ubv(theme_col_tab_divider);
+ gpuSingleFilledRecti(v2d->mask.xmin + (category_tabs_width / 5),
+ rct->ymax + px,
+ (v2d->mask.xmin + category_tabs_width) - (category_tabs_width / 5),
+ rct->ymax + (px * 3));
}
is_active_prev = is_active;
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index d2177f637e7..d91dc03c107 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -693,7 +693,7 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
int format;
if (overlay_mode == MASK_OVERLAY_ALPHACHANNEL) {
- glColor3f(1.0f, 1.0f, 1.0f);
+ gpuColor3P(CPACK_WHITE);
format = GL_LUMINANCE;
}
else {
@@ -703,14 +703,14 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
format = GL_ALPHA;
}
- glPushMatrix();
- glTranslatef(x, y, 0);
- glScalef(zoomx, zoomy, 0);
+ gpuPushMatrix();
+ gpuTranslate(x, y, 0);
+ gpuScale(zoomx, zoomy, 0);
if (stabmat) {
- glMultMatrixf(stabmat);
+ gpuMultMatrix(stabmat[0]);
}
glaDrawPixelsTex(0.0f, 0.0f, width, height, format, GL_FLOAT, GL_NEAREST, buffer);
- glPopMatrix();
+ gpuPopMatrix();
if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) {
glDisable(GL_BLEND);
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 0249a0c6720..7b85748eae2 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -952,21 +952,21 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
}
if (kcd->prev.vert) {
- glColor3ubv(kcd->colors.point);
- glPointSize(11);
+ gpuColor3ubv(kcd->colors.point);
+ GPU_point_size(11);
- glBegin(GL_POINTS);
- glVertex3fv(kcd->prev.cage);
- glEnd();
+ gpuBegin(GL_POINTS);
+ gpuVertex3fv(kcd->prev.cage);
+ gpuEnd();
}
if (kcd->prev.bmface) {
- glColor3ubv(kcd->colors.curpoint);
- glPointSize(9);
+ gpuColor3ubv(kcd->colors.curpoint);
+ GPU_point_size(9);
- glBegin(GL_POINTS);
- glVertex3fv(kcd->prev.cage);
- glEnd();
+ gpuBegin(GL_POINTS);
+ gpuVertex3fv(kcd->prev.cage);
+ gpuEnd();
}
if (kcd->curr.edge) {
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 16ec02be69a..edc7fe8fb32 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -774,12 +774,12 @@ static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush,
gpuImmediateUnformat();
if (do_pop)
- glPopMatrix();
+ gpuPopMatrix();
// SSS Disable Texturing
GPU_aspect_disable(GPU_ASPECT_BASIC, GPU_BASIC_TEXTURE_2D);
- gpuBindTexture(GL_TEXTURE_2D, 0); /* restore default */
+ gpuBindTexture(GL_TEXTURE_2D, 0); /* restore default */ // XXX jwilkins: shouldn't bother to do this with texture binding
}
}
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index c97782adfd8..014ebee0bd2 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -65,6 +65,7 @@
#include "GPU_primitives.h"
#include "GPU_raster.h"
#include "GPU_sprite.h"
+#include "GPU_state_latch.h"
#include "BIF_glutil.h"
@@ -1155,17 +1156,15 @@ static void draw_plane_marker_image(Scene *scene,
if (plane_track->image_opacity != 1.0f || ibuf->planes == 32) {
transparent = true;
glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glColor4f(1.0, 1.0, 1.0, plane_track->image_opacity);
+ gpuColor4P(CPACK_WHITE, plane_track->image_opacity);
- last_texid = glaGetOneInteger(GL_TEXTURE_2D);
+ last_texid = gpuGetTextureBinding2D(); // XXX jwilkins: don't bother
glEnable(GL_TEXTURE_2D);
glGenTextures(1, (GLuint *)&texid);
- glBindTexture(GL_TEXTURE_2D, texid);
+ gpuBindTexture(GL_TEXTURE_2D, texid);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -1173,19 +1172,19 @@ static void draw_plane_marker_image(Scene *scene,
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, GL_RGBA,
GL_UNSIGNED_BYTE, display_buffer);
- glPushMatrix();
- glMultMatrixf(gl_matrix);
+ gpuPushMatrix();
+ gpuMultMatrix(gl_matrix[0]);
- glBegin(GL_QUADS);
- glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f, 0.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex2f(1.0f, 0.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex2f(1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex2f(0.0f, 1.0f);
- glEnd();
+ gpuBegin(GL_TRIANGLE_STRIP);
+ gpuTexCoord2f(0.0f, 0.0f); gpuVertex2f(0.0f, 0.0f);
+ gpuTexCoord2f(1.0f, 0.0f); gpuVertex2f(1.0f, 0.0f);
+ gpuTexCoord2f(1.0f, 1.0f); gpuVertex2f(1.0f, 1.0f);
+ gpuTexCoord2f(0.0f, 1.0f); gpuVertex2f(0.0f, 1.0f);
+ gpuEnd();
- glPopMatrix();
+ gpuPopMatrix();
- glBindTexture(GL_TEXTURE_2D, last_texid);
+ gpuBindTexture(GL_TEXTURE_2D, last_texid); // XXX jwilkins: not needed
glDisable(GL_TEXTURE_2D);
if (transparent) {
@@ -1215,10 +1214,10 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane
float color[3], selected_color[3];
plane_track_colors(is_active_track, color, selected_color);
if (is_selected_track) {
- glColor3fv(selected_color);
+ gpuColor3fv(selected_color);
}
else {
- glColor3fv(color);
+ gpuColor3fv(color);
}
}
@@ -1230,45 +1229,47 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane
draw_plane_marker_image(scene, plane_track, plane_marker);
}
+ GPU_raster_begin();
+
if (draw_outline) {
if (!tiny) {
- glLineWidth(3.0f);
+ gpuLineWidth(3.0f);
}
}
else if (tiny) {
- glLineStipple(3, 0xaaaa);
- glEnable(GL_LINE_STIPPLE);
+ GPU_aspect_enable(GPU_ASPECT_RASTER, GPU_RASTER_STIPPLE);
+ gpuLineStipple(3, 0xaaaa);
}
if (draw_plane_quad) {
/* Draw rectangle itself. */
- glBegin(GL_LINE_LOOP);
- glVertex2fv(plane_marker->corners[0]);
- glVertex2fv(plane_marker->corners[1]);
- glVertex2fv(plane_marker->corners[2]);
- glVertex2fv(plane_marker->corners[3]);
- glEnd();
+ gpuBegin(GL_LINE_LOOP);
+ gpuVertex2fv(plane_marker->corners[0]);
+ gpuVertex2fv(plane_marker->corners[1]);
+ gpuVertex2fv(plane_marker->corners[2]);
+ gpuVertex2fv(plane_marker->corners[3]);
+ gpuEnd();
/* Draw axis. */
if (!draw_outline) {
float end_point[2];
- glPushAttrib(GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT);
+ glPushAttrib(GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT); // XXX jwilkins: arg...
getArrowEndPoint(width, height, sc->zoom, plane_marker->corners[0], plane_marker->corners[1], end_point);
- glColor3f(1.0, 0.0, 0.0f);
- glBegin(GL_LINES);
- glVertex2fv(plane_marker->corners[0]);
- glVertex2fv(end_point);
- glEnd();
+ gpuColor3P(CPACK_RED); // XXX jwilkins: shouldn't this be a theme color?
+ gpuBegin(GL_LINES);
+ gpuVertex2fv(plane_marker->corners[0]);
+ gpuVertex2fv(end_point);
+ gpuEnd();
getArrowEndPoint(width, height, sc->zoom, plane_marker->corners[0], plane_marker->corners[3], end_point);
- glColor3f(0.0, 1.0, 0.0f);
- glBegin(GL_LINES);
- glVertex2fv(plane_marker->corners[0]);
- glVertex2fv(end_point);
- glEnd();
+ gpuColor3P(CPACK_GREEN); // XXX jwilkins: shouldn't this be a theme color?
+ gpuBegin(GL_LINES);
+ gpuVertex2fv(plane_marker->corners[0]);
+ gpuVertex2fv(end_point);
+ gpuEnd();
- glPopAttrib();
+ glPopAttrib(); // XXX jwilkins: /sigh
}
}
@@ -1283,12 +1284,14 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane
if (draw_outline) {
if (!tiny) {
- glLineWidth(1.0f);
+ gpuLineWidth(1.0f);
}
}
else if (tiny) {
- glDisable(GL_LINE_STIPPLE);
+ GPU_aspect_disable(GPU_ASPECT_RASTER, GPU_RASTER_STIPPLE);
}
+
+ GPU_raster_end();
}
static void draw_plane_marker_outline(SpaceClip *sc, Scene *scene, MovieTrackingPlaneTrack *plane_track,
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index 9dace522a72..7bb6350c2f7 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -223,7 +223,7 @@ static void tracking_error_segment_point_cb(void *userdata,
sub_v2_v2v2(delta, reprojected_position, marker_position);
reprojection_error = len_v2(delta) * weight;
- glVertex2f(scene_framenr, reprojection_error);
+ gpuVertex2f(scene_framenr, reprojection_error);
}
}
@@ -235,24 +235,24 @@ static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack *
if (track == data->active_track) {
col[3] = 1.0f;
- glLineWidth(2.0f);
+ gpuLineWidth(2.0f);
}
else {
col[3] = 0.5f;
- glLineWidth(1.0f);
+ gpuLineWidth(1.0f);
}
- glColor4fv(col);
+ gpuColor4fv(col);
- glBegin(GL_LINE_STRIP);
+ gpuBegin(GL_LINE_STRIP);
}
}
static void tracking_error_segment_end_cb(void *UNUSED(userdata), int coord)
{
if (coord == 1) {
- glEnd();
- glLineWidth(1.0f);
+ gpuEnd();
+ gpuLineWidth(1.0f);
}
}
@@ -328,6 +328,8 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL);
UI_view2d_grid_free(grid);
+ GPU_raster_begin();
+
if (clip) {
if (sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION)
draw_tracks_motion_curves(v2d, sc);
@@ -339,6 +341,8 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
draw_frame_curves(sc);
}
+ GPU_raster_end();
+
/* frame range */
clip_draw_sfra_efra(v2d, scene);
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index d27956f6a24..464a1526347 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -60,7 +60,7 @@
#include "IMB_imbuf.h"
-#include "GPU_glew.h"
+#include "GPU_matrix.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -1207,13 +1207,13 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
show_cursor |= sc->around == V3D_CURSOR;
if (show_cursor) {
- glPushMatrix();
- glTranslatef(x, y, 0);
- glScalef(zoomx, zoomy, 0);
- glMultMatrixf(sc->stabmat);
- glScalef(width, height, 0);
+ gpuPushMatrix();
+ gpuTranslate(x, y, 0);
+ gpuScale(zoomx, zoomy, 0);
+ gpuMultMatrix(sc->stabmat[0]);
+ gpuScale(width, height, 0);
draw_image_cursor(ar, sc->cursor);
- glPopMatrix();
+ gpuPopMatrix();
}
clip_draw_cache_and_notes(C, sc, ar);
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 3e8d9cfe936..c40517d949a 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -616,7 +616,7 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie
}
gpuEnd();
- glPopMatrix();
+ gpuPopMatrix();
}
/* helper func - draw one repeat of an F-Curve */
@@ -773,7 +773,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
}
gpuEnd();
- glPopMatrix();
+ gpuPopMatrix();
}
/* Debugging -------------------------------- */
@@ -1051,8 +1051,8 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
short mapping_flag = ANIM_get_normalization_flags(ac);
float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag);
- glPushMatrix();
- glScalef(1.0f, unit_scale, 1.0f);
+ gpuPushMatrix();
+ gpuScale(1.0f, unit_scale, 1.0f);
if (fcu->bezt) {
int do_handles = draw_fcurve_handles_check(sipo, fcu);
@@ -1071,7 +1071,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
draw_fcurve_samples(sipo, ar, fcu);
}
- glPopMatrix();
+ gpuPopMatrix();
}
}
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 22969a67cc5..04219119d12 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -360,7 +360,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
glDisable(GL_BLEND);
}
else {
- glColor3fv(finalcol);
+ gpuColor3fv(finalcol);
gpuSingleFilledRecti(color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 6c85d1a6375..0643e1c5697 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1082,7 +1082,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
}
/* without this colors can flicker from previous opengl state */
- glColor4ub(255, 255, 255, 255);
+ gpuColor3P(CPACK_WHITE);
UI_view2d_totRect_set(v2d, viewrectx + 0.5f, viewrecty + 0.5f);
UI_view2d_curRect_validate(v2d);
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 2c994af7126..614cb53a5fe 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -1126,7 +1126,7 @@ static void draw_b_bone_boxes(const short dt, bPoseChannel *pchan, float xwidth,
for (a = 0; a < segments; a++) {
gpuPushMatrix();
- gpuMultMatrix(bbone[a].mat);
+ gpuMultMatrix(bbone[a].mat[0]);
gpuScale(xwidth, dlen, zwidth);
if (dt == OB_SOLID) {
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index a65e969ffb2..6da006718ce 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -835,7 +835,7 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d
gpuImmediateFormat_C4_V3();
dm->drawMappedFaces(
dm,
- wpaint__setSolidDrawOptions_facemask,
+ (DMSetDrawOptions)wpaint__setSolidDrawOptions_facemask,
GPU_enable_material,
NULL,
me,
@@ -1183,7 +1183,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
/* hide faces in face select mode */
if (me->editflag & (ME_EDIT_PAINT_VERT_SEL | ME_EDIT_PAINT_FACE_SEL))
- facemask = wpaint__setSolidDrawOptions_facemask;
+ facemask = (DMSetDrawOptions)wpaint__setSolidDrawOptions_facemask;
if (ob->mode & OB_MODE_WEIGHT_PAINT) {
if (use_light) {
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 22903e8f5b2..5794a17a1c1 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1258,7 +1258,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
}
/* and back to viewspace */
- glPushMatrix();
+ gpuPushMatrix();
gpuLoadMatrix(rv3d->viewmat[0]);
copy_v3_v3(vec, ob->obmat[3]);
@@ -1303,7 +1303,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
gpuColor3ubv(ob_wire_col);
}
/* and finally back to org object space! */
- glPopMatrix();
+ gpuPopMatrix();
GPU_raster_end();
}
@@ -2248,7 +2248,7 @@ static void draw_dm_edges_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *ba
data.eed_act = eed_act;
gpuImmediateFormat_C4_V3();
- dm->drawMappedEdges(dm, draw_dm_edges_sel__setDrawOptions, &data);
+ dm->drawMappedEdges(dm, (DMSetDrawOptions)draw_dm_edges_sel__setDrawOptions, &data);
gpuImmediateUnformat();
}
@@ -2555,7 +2555,7 @@ static void draw_dm_bweights(BMEditMesh *em, Scene *scene, DerivedMesh *dm)
gpuImmediateFormat_C4_V3();
GPU_sprite_size(UI_GetThemeValuef(TH_VERTEX_SIZE) + 2);
GPU_sprite_begin();
- dm->foreachMappedVert(dm, draw_dm_bweights__mapFunc, &data, DM_FOREACH_NOP);
+ dm->foreachMappedVert(dm, (DMForEachMappedVert)draw_dm_bweights__mapFunc, &data, DM_FOREACH_NOP);
GPU_sprite_end();
GPU_sprite_size(1);
gpuImmediateUnformat();
@@ -2570,7 +2570,7 @@ static void draw_dm_bweights(BMEditMesh *em, Scene *scene, DerivedMesh *dm)
if (data.cd_layer_offset != -1) {
gpuImmediateFormat_C4_V3();
gpuLineWidth(3.0);
- dm->drawMappedEdges(dm, draw_dm_bweights__setDrawOptions, &data);
+ dm->drawMappedEdges(dm, (DMSetDrawOptions)draw_dm_bweights__setDrawOptions, &data);
gpuLineWidth(1.0);
gpuImmediateUnformat();
}
@@ -3167,7 +3167,7 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
draw_mesh_paint_weight_faces(finalDM, true, draw_em_fancy__setFaceOpts, me->edit_btmesh);
ED_view3d_polygon_offset(rv3d, 1.0);
- glDepthMask(0);
+ gpuDepthMask(GL_FALSE);
}
else {
glEnable(GL_DEPTH_TEST);
@@ -7846,8 +7846,8 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset)
}
typedef struct mesh_wire_options {
- BMEditMesh* bm; /* correct this type */
- size_t offset;
+ BMesh* bm;
+ size_t offset;
} mesh_wire_options;
static DMDrawOption bbs_mesh_wire__setDrawOptions(mesh_wire_options *opts, int index)
@@ -7871,7 +7871,7 @@ static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, size_t offset)
opts.offset = offset;
gpuImmediateFormat_C4_V3();
- dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, &opts);
+ dm->drawMappedEdges(dm, (DMSetDrawOptions)bbs_mesh_wire__setDrawOptions, &opts);
gpuImmediateUnformat();
}
@@ -7925,7 +7925,7 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
dm->drawMappedFaces(
dm,
- bbs_mesh_solid__setSolidDrawOptions,
+ (DMSetDrawOptions)bbs_mesh_solid__setSolidDrawOptions,
GPU_enable_material,
NULL,
&opts,
@@ -7940,7 +7940,7 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
GPU_sprite_size(UI_GetThemeValuef(TH_FACEDOT_SIZE));
GPU_sprite_begin();
- dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, &opts, DM_FOREACH_NOP);
+ dm->foreachMappedFaceCenter(dm, (DMForEachMappedFaceCenter)bbs_mesh_solid__drawCenter, &opts, DM_FOREACH_NOP);
GPU_sprite_end();
GPU_sprite_size(1);
@@ -7983,7 +7983,7 @@ static void bbs_mesh_solid_verts(Scene *scene, Object *ob)
DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
gpuColor3P(CPACK_BLACK);
- dm->drawMappedFaces(dm, bbs_mesh_solid_hide2__setDrawOpts, GPU_enable_material, NULL, me, 0);
+ dm->drawMappedFaces(dm, (DMSetDrawOptions)bbs_mesh_solid_hide2__setDrawOpts, GPU_enable_material, NULL, me, 0);
bbs_obmode_mesh_verts(ob, dm, 1);
bm_vertoffs = me->totvert + 1;
@@ -7998,7 +7998,7 @@ static void bbs_mesh_solid_faces(Scene *scene, Object *ob)
gpuImmediateFormat_C4_V3();
if ((me->editflag & ME_EDIT_PAINT_FACE_SEL))
- dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, GPU_enable_material, NULL, me, 0);
+ dm->drawMappedFaces(dm, (DMSetDrawOptions)bbs_mesh_solid_hide__setDrawOpts, GPU_enable_material, NULL, me, 0);
else
dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, GPU_enable_material, NULL, me, 0);
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index e65cd3cb7e4..71169ba617f 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -59,6 +59,9 @@
#include "view3d_intern.h" /* own include */
+#include "GPU_colors.h"
+#include "GPU_immediate.h"
+
#define EARTH_GRAVITY 9.80668f /* m/s2 */
/* prototypes */
@@ -315,25 +318,29 @@ static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *ar, void *a
yoff = walk->ar->winy / 2;
}
- cpack(0);
+ gpuImmediateFormat_V2();
+
+ gpuColor3P(CPACK_BLACK);
- glBegin(GL_LINES);
+ gpuBegin(GL_LINES);
/* North */
- glVertex2i(xoff, yoff + inner_length);
- glVertex2i(xoff, yoff + outter_length);
+ gpuVertex2i(xoff, yoff + inner_length);
+ gpuVertex2i(xoff, yoff + outter_length);
/* East */
- glVertex2i(xoff + inner_length, yoff);
- glVertex2i(xoff + outter_length, yoff);
+ gpuVertex2i(xoff + inner_length, yoff);
+ gpuVertex2i(xoff + outter_length, yoff);
/* South */
- glVertex2i(xoff, yoff - inner_length);
- glVertex2i(xoff, yoff - outter_length);
+ gpuVertex2i(xoff, yoff - inner_length);
+ gpuVertex2i(xoff, yoff - outter_length);
/* West */
- glVertex2i(xoff - inner_length, yoff);
- glVertex2i(xoff - outter_length, yoff);
- glEnd();
+ gpuVertex2i(xoff - inner_length, yoff);
+ gpuVertex2i(xoff - outter_length, yoff);
+ gpuEnd();
+
+ gpuImmediateUnformat();
}
static void walk_update_header(bContext *C, WalkInfo *walk)
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index dbc5c88769a..ffdf12a425e 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -462,7 +462,7 @@ static void draw_uvs_looptri(BMEditMesh *em, unsigned int *r_loop_index, const i
unsigned int j;
for (j = 0; j < 3; j++) {
MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(em->looptris[i][j], cd_loop_uv_offset);
- glVertex2fv(luv->uv);
+ gpuVertex2fv(luv->uv);
}
i++;
} while (i != em->tottri && (f == em->looptris[i][0]->f));
@@ -557,20 +557,20 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
if (tf == activetf) {
/* only once */
- glEnable(GL_POLYGON_STIPPLE);
- glPolygonStipple(GPU_stipple_quarttone);
+ GPU_aspect_enable(GPU_ASPECT_RASTER, GPU_RASTER_STIPPLE);
+ gpuPolygonStipple(GPU_stipple_quarttone);
UI_ThemeColor4(TH_EDITMESH_ACTIVE);
}
else {
- glColor4ubv((GLubyte *)(is_select ? col2 : col1));
+ gpuColor4ubv((GLubyte *)(is_select ? col2 : col1));
}
- glBegin(GL_TRIANGLES);
+ gpuBegin(GL_TRIANGLES);
draw_uvs_looptri(em, &i, cd_loop_uv_offset);
- glEnd();
+ gpuEnd();
if (tf == activetf) {
- glDisable(GL_POLYGON_STIPPLE);
+ GPU_aspect_disable(GPU_ASPECT_RASTER, GPU_RASTER_STIPPLE);
}
}
else {
diff --git a/source/blender/gpu/GPU_deprecated.h b/source/blender/gpu/GPU_deprecated.h
index 7cf0ceddd52..33ae7efec65 100644
--- a/source/blender/gpu/GPU_deprecated.h
+++ b/source/blender/gpu/GPU_deprecated.h
@@ -633,4 +633,14 @@
#undef glClipPlane
#define glClipPlane DO_NOT_USE_glClipPlane
+#undef glPointSize
+#define glPointSize DO_NOT_USE_glPointSize
+
+#undef glLineStipple
+#define glLineStipple DO_NOT_USE_glLineStipple
+#undef glPolygonStipple
+#define glPolygonStipple DO_NOT_USE_glPolygonStipple
+#undef glLineWidth
+#define glLineWidth DO_NOT_USE_glLineWidth
+
#endif /* _GPU_DEPRECATED_H_ */
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index 933d0a4d0cd..d16bcce7b5a 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -34,7 +34,9 @@
#include "DNA_listBase.h"
-#include "BLI_sys_types.h" /* for bool, size_t */
+#include "BLI_sys_types.h" /* for bool */
+
+#include <string.h> /* for size_t */
#ifdef __cplusplus
extern "C" {
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 2e7b783fd74..0b5118bcfb3 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1102,7 +1102,7 @@ static bool GPU_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x,
float *fscalerect = MEM_mallocN(rectw*recth*sizeof(*fscalerect)*4, "fscalerect");
gluScaleImage(GL_RGBA, w, h, GL_FLOAT, frect, rectw, recth, GL_FLOAT, fscalerect);
- glBindTexture(GL_TEXTURE_2D, ima->bindcode);
+ gpuBindTexture(GL_TEXTURE_2D, ima->bindcode);
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, rectw, recth, GL_RGBA,
GL_FLOAT, fscalerect);
@@ -1122,7 +1122,7 @@ static bool GPU_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x,
bilinear_interpolation_color_wrap(ibuf, (unsigned char *)(p + i + j * (rectw)), NULL, u, v);
}
}
- glBindTexture(GL_TEXTURE_2D, ima->bindcode);
+ gpuBindTexture(GL_TEXTURE_2D, ima->bindcode);
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, rectw, recth, GL_RGBA,
GL_UNSIGNED_BYTE, scalerect);
diff --git a/source/blender/gpu/intern/gpu_raster.c b/source/blender/gpu/intern/gpu_raster.c
index 6a67654d722..7526cfc7e55 100644
--- a/source/blender/gpu/intern/gpu_raster.c
+++ b/source/blender/gpu/intern/gpu_raster.c
@@ -29,6 +29,8 @@
* \ingroup gpu
*/
+#define GPU_MANGLE_DEPRECATED 0
+
/* my interface */
#include "intern/gpu_raster_intern.h"
diff --git a/source/blender/gpu/intern/gpu_sprite.c b/source/blender/gpu/intern/gpu_sprite.c
index 675bfc48eca..8d24832d6cc 100644
--- a/source/blender/gpu/intern/gpu_sprite.c
+++ b/source/blender/gpu/intern/gpu_sprite.c
@@ -29,6 +29,8 @@
* \ingroup gpu
*/
+#define GPU_MANGLE_DEPRECATED 0
+
/* my interface */
#include "intern/gpu_sprite_intern.h"