Siggraph show commit!

- pending commit for OSX intel systems, with intel graphics. These now call
  an extra swapbuffers after glFlush(). Code is ifdeffed, and doesnt affect
  other systems.

- show-off commit: option to have transparent nodes over the composite
  result. Only draws Image for active Viewer Node now, and image doesnt
  translate nor zoom (which isnt bad though).
  Set in themes the alpha color of "node backdrop" to make nodes
  transparent.
This commit is contained in:
Ton Roosendaal 2006-07-31 19:23:42 +00:00
parent e168d67b32
commit c2edcd4879
18 changed files with 90 additions and 90 deletions

@ -198,12 +198,14 @@ void gla2DGetMap(gla2DDrawInfo *di, struct rctf *rect);
void gla2DSetMap(gla2DDrawInfo *di, struct rctf *rect);
/* use this for platform hacks. for now glPointSize is solved here */
/* use this for platform hacks. glPointSize is solved here */
void bglBegin(int mode);
void bglEnd(void);
void bglVertex3fv(float *vec);
void bglVertex3f(float x, float y, float z);
void bglVertex2fv(float *vec);
/* intel gfx cards frontbuffer problem */
void bglFlush(void);
void set_inverted_drawing(int enable);

@ -125,12 +125,6 @@ int do_screenhandlers(struct bScreen *sc);
int has_screenhandler(struct bScreen *sc, short eventcode);
/***/
/**
* Draw @a text in the header of each info window
* of the given screen.
*/
void screen_draw_info_text(struct bScreen *sc, char *text);
/* return all layers of all 3d windows in a screen */
unsigned int screen_view3d_layers(void);

@ -323,6 +323,7 @@ typedef struct SpaceNode {
/* snode->flag */
#define SNODE_DO_PREVIEW 1
#define SNODE_BACKDRAW 2
#
#

@ -37,6 +37,7 @@
#include "DNA_action_types.h"
#include "DNA_ipo_types.h"
#include "DNA_ID.h"
#include "DNA_image_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
@ -76,6 +77,7 @@
#include "MEM_guardedalloc.h"
#include "RE_pipeline.h"
#include "IMB_imbuf_types.h"
#include "blendef.h"
#include "butspace.h"
@ -1117,6 +1119,33 @@ static void draw_nodespace_grid(SpaceNode *snode)
glEnd();
}
static void draw_nodespace_back(ScrArea *sa, SpaceNode *snode)
{
Image *ima;
draw_nodespace_grid(snode);
if(snode->flag & SNODE_BACKDRAW) {
ima= (Image *)find_id("IM", "Viewer Node");
if(ima && ima->ibuf) {
/* somehow the offset has to be calculated inverse */
glaDefine2DArea(&sa->winrct);
/* ortho at pixel level curarea */
myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
if(ima->ibuf->rect)
glaDrawPixelsSafe((sa->winx-ima->ibuf->x)/2, (sa->winy-ima->ibuf->y)/2, ima->ibuf->x, ima->ibuf->y, ima->ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ima->ibuf->rect);
else
glaDrawPixelsSafe((sa->winx-ima->ibuf->x)/2, (sa->winy-ima->ibuf->y)/2, ima->ibuf->x, ima->ibuf->y, ima->ibuf->x, GL_RGBA, GL_FLOAT, ima->ibuf->rect_float);
/* sort this out, this should not be needed */
myortho2(snode->v2d.cur.xmin, snode->v2d.cur.xmax, snode->v2d.cur.ymin, snode->v2d.cur.ymax);
bwin_clear_viewmat(sa->win); /* clear buttons view */
glLoadIdentity();
}
}
}
static void nodeshadow(rctf *rct, float radius, float aspect, int select)
{
@ -1545,9 +1574,11 @@ static void node_draw_basis(ScrArea *sa, SpaceNode *snode, bNode *node)
snode_drawstring(snode, node->name, (int)(iconofs - rct->xmin-18.0f));
/* body */
BIF_ThemeColor(TH_NODE);
BIF_ThemeColor4(TH_NODE);
glEnable(GL_BLEND);
uiSetRoundBox(8);
uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax-NODE_DY, BASIS_RAD);
glDisable(GL_BLEND);
/* scaling indicator */
node_scaling_widget(TH_NODE, snode->aspect, rct->xmax-BASIS_RAD*snode->aspect, rct->ymin, rct->xmax, rct->ymin+BASIS_RAD*snode->aspect);
@ -1958,7 +1989,7 @@ void drawnodespace(ScrArea *sa, void *spacedata)
snode->curfont= uiSetCurFont_ext(snode->aspect);
/* backdrop */
draw_nodespace_grid(snode);
draw_nodespace_back(sa, snode);
/* nodes */
snode_set_context(snode);

@ -4069,7 +4069,7 @@ void draw_object_ext(Base *base)
G.f &= ~G_DRAW_EXT;
glFlush(); /* reveil frontbuffer drawing */
bglFlush(); /* reveil frontbuffer drawing */
glDrawBuffer(GL_BACK);
if(G.vd->zbuf) {

@ -64,6 +64,7 @@
#include "BKE_main.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "BIF_keyval.h"
#include "BIF_interface.h"
#include "BIF_drawtext.h"
@ -820,6 +821,7 @@ static void do_textscroll(SpaceText *st, int mode)
glDrawBuffer(GL_FRONT);
uiEmboss(st->txtbar.xmin, st->txtbar.ymin, st->txtbar.xmax, st->txtbar.ymax, st->flags & ST_SCROLL_SELECT);
bglFlush();
glDrawBuffer(GL_BACK);
getmouseco_areawin(mval);
@ -857,6 +859,7 @@ static void do_textscroll(SpaceText *st, int mode)
glDrawBuffer(GL_FRONT);
uiEmboss(st->txtbar.xmin, st->txtbar.ymin, st->txtbar.xmax, st->txtbar.ymax, st->flags & ST_SCROLL_SELECT);
bglFlush();
glDrawBuffer(GL_BACK);
}

@ -506,7 +506,7 @@ static CutCurve *get_mouse_trail(int *len, char mode)
if( event==ESCKEY || event==RIGHTMOUSE ) {
if (curve) MEM_freeN(curve);
*len=0;
glFlush();
bglFlush();
glDrawBuffer(GL_BACK);
return(NULL);
break;
@ -586,7 +586,7 @@ static CutCurve *get_mouse_trail(int *len, char mode)
}
}
glFlush();
bglFlush();
glDrawBuffer(GL_BACK);
persp(PERSP_VIEW);

@ -696,7 +696,7 @@ static void unified_select_draw(EditVert *eve, EditEdge *eed, EditFace *efa)
glPointSize(1.0);
glPopMatrix();
glFlush();
bglFlush();
glDrawBuffer(GL_BACK);
if(G.vd->flag & V3D_CLIPPING)

@ -75,6 +75,7 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise
#include "BIF_cursors.h"
#include "BIF_editmesh.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "BIF_graphics.h"
#include "BIF_interface.h"
#include "BIF_mywindow.h"
@ -4583,7 +4584,7 @@ void bevel_menu()
setlinestyle(0);
persp(PERSP_VIEW);
glFlush(); // flush display for frontbuffer
bglFlush(); // flush display for frontbuffer
glDrawBuffer(GL_BACK);
}
while(qtest()) {

@ -712,7 +712,7 @@ void splash(void *data, int datasize, char *string)
BMF_DrawString(font, string);
}
glFlush();
bglFlush();
glDrawBuffer(GL_BACK);
IMB_freeImBuf(bbuf);
@ -2750,7 +2750,7 @@ static void joinarea_interactive(ScrArea *area, ScrEdge *onedge)
scrarea_draw_shape_dark(scr,'d');
else if(scr==down)
scrarea_draw_shape_dark(scr,'u');
glFlush();
bglFlush();
/* "never ending loop" of interactive selection */
while(!ok) {
@ -2793,7 +2793,7 @@ static void joinarea_interactive(ScrArea *area, ScrEdge *onedge)
/* cancel joining of joining */
if(val && (event==ESCKEY || event==RIGHTMOUSE)) ok= -1;
glFlush();
bglFlush();
}
glReadBuffer(GL_BACK);
@ -3074,12 +3074,12 @@ static void splitarea_interactive(ScrArea *area, ScrEdge *onedge)
if(val && (event==ESCKEY || event==RIGHTMOUSE)) {
ok= -1;
}
glFlush();
bglFlush();
}
if (!first) {
scrarea_draw_splitpoint(sa, dir, fac);
glFlush();
bglFlush();
}
glReadBuffer(GL_BACK);
glDrawBuffer(GL_BACK);
@ -3390,7 +3390,7 @@ static void moveareas(ScrEdge *edge)
delta= (dir=='h')?(mval[1]-mvalo[1]):(mval[0]-mvalo[0]);
delta= CLAMPIS(delta, -smaller, bigger);
draw_front_xor_dirdist_line(dir, edge_position+delta, edge_start, edge_end);
glFlush();
bglFlush();
}
else if (event==LEFTMOUSE) {
doit= 1;
@ -3405,7 +3405,7 @@ static void moveareas(ScrEdge *edge)
}
draw_front_xor_dirdist_line(dir, edge_position+delta, edge_start, edge_end);
glFlush();
bglFlush();
glReadBuffer(GL_BACK);
glDrawBuffer(GL_BACK);
@ -3638,47 +3638,6 @@ void initscreen(void)
default_twosplit();
}
/***/
void screen_draw_info_text(bScreen *sc, char *text) {
Window *oldactwin= winlay_get_active_window();
ScrArea *sa;
/*
* Because this is called from within rendering
* internals it is possible our window is not
* active.
*/
window_make_active(mainwin);
for (sa= sc->areabase.first; sa; sa= sa->next) {
if (sa->spacetype==SPACE_INFO) {
int x= sa->headbutlen - 28;
int y= 6;
areawinset(sa->headwin);
glDrawBuffer(GL_FRONT);
cpack(0xA08060);
glRecti(x-11, y-6, x+55, y+13);
cpack(0x909090);
glRecti(x+55, y-6, x+1280, y+14);
cpack(0x0);
glRasterPos2i(x, y);
BMF_DrawString(G.fonts, text);
glFlush();
glDrawBuffer(GL_BACK);
sa->head_swap= WIN_FRONT_OK;
}
}
if (oldactwin && oldactwin!=mainwin) window_make_active(oldactwin);
}
static int curcursor;
int get_cursor(void) {

@ -68,6 +68,7 @@
#include "BKE_utildefines.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "BIF_interface.h"
#include "BIF_screen.h"
#include "BIF_drawimage.h"
@ -911,6 +912,7 @@ void uvedit_selectionCB(short selecting, Object *editobj, short *mval, float rad
else { /* force_draw() is no good here... */
glDrawBuffer(GL_FRONT);
draw_tfaces();
bglFlush();
glDrawBuffer(GL_BACK);
}
}

@ -766,7 +766,7 @@ int gesture(void)
if(i) {
if(lasso) draw_lasso_select(mcords, i, 0);
else sdrawXORline(mcords[i-1][0], mcords[i-1][1], mcords[i][0], mcords[i][1]);
glFlush();
bglFlush();
}
i++;
}
@ -1777,7 +1777,7 @@ void borderselect(void)
}
}
/* frontbuffer flush */
glFlush();
bglFlush();
MEM_freeN(vbuffer);

@ -32,6 +32,7 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include <stdio.h>
#include <math.h>
#include "MEM_guardedalloc.h"
@ -46,6 +47,7 @@
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "BIF_mywindow.h"
/* Invert line handling */
@ -621,6 +623,24 @@ void bglPolygonOffset(float dist)
}
}
static int is_a_really_crappy_intel_card(void)
{
static int well_is_it= -1;
/* Do you understand the implication? Do you? */
if (well_is_it==-1)
well_is_it= (strcmp((char*) glGetString(GL_VENDOR), "Intel Inc.") == 0);
return well_is_it;
}
void bglFlush(void)
{
glFlush();
#ifdef __APPLE__
if(is_a_really_crappy_intel_card())
myswapbuffers(); //hack to get mac intel graphics to show frontbuffer
#endif
}

@ -602,6 +602,8 @@ void node_buttons(ScrArea *sa)
xco+= 80;
uiDefButBitS(block, TOG, R_COMP_FREE, B_NOP, "Free Unused", xco+5,0,80,19, &G.scene->r.scemode, 0.0f, 0.0f, 0, 0, "Free Nodes that are not used while composite");
xco+= 80;
uiDefButBitS(block, TOG, SNODE_BACKDRAW, B_NOP, "Backdrop", xco+5,0,80,19, &snode->flag, 0.0f, 0.0f, 0, 0, "Use active Viewer Node output as backdrop");
xco+= 80;
}
/* always as last */

@ -300,18 +300,6 @@ static uiOverDraw *ui_begin_overdraw(int minx, int miny, int maxx, int maxy)
return od;
}
#ifdef __APPLE__
static int is_a_really_crappy_intel_card(void) {
static int well_is_it= -1;
/* Do you understand the implication? Do you? */
if (well_is_it==-1)
well_is_it= (strcmp((char*) glGetString(GL_VENDOR), "Intel Inc.") == 0);
return well_is_it;
}
#endif
static void ui_flush_overdraw(uiOverDraw *od)
{
@ -322,11 +310,7 @@ static void ui_flush_overdraw(uiOverDraw *od)
glRasterPos2s(od->x, od->y);
myglCopyPixels(od->x, od->y, od->sx, od->sy, GL_COLOR);
glEnable(GL_DITHER);
glFlush();
#ifdef __APPLE__
if (is_a_really_crappy_intel_card())
myswapbuffers(); //hack to get mac intel graphics to show menus
#endif
bglFlush();
glDrawBuffer(GL_BACK);
}
@ -371,7 +355,7 @@ static void ui_end_overdraw(uiOverDraw *od)
glRasterPos2s(od->x, od->y);
glDrawPixels(od->sx, od->sy, GL_RGBA, GL_UNSIGNED_BYTE, od->rect);
glFlush();
bglFlush();
glDrawBuffer(GL_BACK);
glEnable(GL_DITHER);
@ -394,7 +378,7 @@ void ui_block_flush_back(uiBlock *block)
/* exception, when we cannot use backbuffer for draw... */
if(block->flag & UI_BLOCK_FRONTBUFFER) {
glFlush();
bglFlush();
glDrawBuffer(GL_BACK);
block->needflush= 0;
return;
@ -423,7 +407,7 @@ void ui_block_flush_back(uiBlock *block)
myglCopyPixels(minx, miny, sizex, sizey, GL_COLOR);
#endif
glEnable(GL_DITHER);
glFlush();
bglFlush();
glDrawBuffer(GL_BACK);
mywinset(block->win);
@ -4051,7 +4035,7 @@ static void ui_do_active_linklines(uiBlock *block, short *mval)
}
but= but->next;
}
glFlush();
bglFlush();
glDrawBuffer(GL_BACK);
}
}

@ -382,7 +382,7 @@ static void previewrender_progress(RenderResult *rr, volatile rcti *renrect)
glDrawBuffer(GL_FRONT);
glaDrawPixelsSafe_to32(ofsx, ofsy, rr->rectx, rr->recty, rr->rectx, rl->rectf);
glFlush();
bglFlush();
glDrawBuffer(GL_BACK);
}
@ -626,7 +626,7 @@ static void view3d_previewrender_progress(RenderResult *rr, volatile rcti *renre
glDrawBuffer(GL_FRONT);
glaDefine2DArea(&curarea->winrct);
glaDrawPixelsSafe_to32(ofsx, ofsy, rr->rectx, rr->recty, rr->rectx, rl->rectf);
glFlush();
bglFlush();
glDrawBuffer(GL_BACK);
}

@ -2421,7 +2421,7 @@ static void info_user_themebuts(uiBlock *block, short y1, short y2, short y3)
}
else {
uiBlockBeginAlign(block);
if ELEM7(th_curcol, TH_PANEL, TH_LAMP, TH_FACE, TH_FACE_SELECT, TH_MENU_BACK, TH_MENU_HILITE, TH_MENU_ITEM) {
if ELEM8(th_curcol, TH_PANEL, TH_LAMP, TH_FACE, TH_FACE_SELECT, TH_MENU_BACK, TH_MENU_HILITE, TH_MENU_ITEM, TH_NODE) {
uiDefButC(block, NUMSLI, B_UPDATE_THEME,"A ", 465,y3+25,200,20, col+3, 0.0, 255.0, B_THEMECOL, 0, "");
}
uiDefButC(block, NUMSLI, B_UPDATE_THEME,"R ", 465,y3,200,20, col, 0.0, 255.0, B_THEMECOL, 0, "");

@ -64,6 +64,7 @@
#include "BIF_editview.h" /* arrows_move_cursor */
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "BIF_mywindow.h"
#include "BIF_resources.h"
#include "BIF_screen.h"
@ -135,7 +136,7 @@ static void helpline(TransInfo *t, float *vec)
setlinestyle(0);
persp(PERSP_VIEW);
glFlush(); // flush display for frontbuffer
bglFlush(); // flush display for frontbuffer
glDrawBuffer(GL_BACK);
}
}