- OSX bugfix: drawing selection code for vpaint and faceselect happens in AUX

buffers now. It only works nice at OSX (tested, linux and windows do not
  support it nicely)
  This fixes the annoying flashing during paint or select
This commit is contained in:
2003-06-11 15:43:20 +00:00
parent 47e7e146ba
commit 51c8bb6077
6 changed files with 46 additions and 13 deletions

View File

@@ -703,7 +703,9 @@ void backdrawview3d(int test)
return;
}
}
#ifdef __APPLE__
glDrawBuffer(GL_AUX0);
#endif
if(G.vd->drawtype > OB_WIRE) G.zbuf= TRUE;
curarea->win_swap &= ~WIN_BACK_OK;
@@ -758,6 +760,10 @@ void backdrawview3d(int test)
G.zbuf= FALSE;
glDisable(GL_DEPTH_TEST);
glEnable(GL_DITHER);
#ifdef __APPLE__
glDrawBuffer(GL_BACK); /* we were in aux buffers */
#endif
}

View File

@@ -445,8 +445,13 @@ TFace* face_pick(Mesh *me, short x, short y)
backdrawview3d(0);
}
/* Read the pixel under the cursor */
#ifdef __APPLE__
glReadBuffer(GL_AUX0);
#endif
glReadPixels(x+curarea->winrct.xmin, y+curarea->winrct.ymin, 1, 1,
GL_RGBA, GL_UNSIGNED_BYTE, &col);
glReadBuffer(GL_BACK);
/* Unbelievable! */
if (G.order==B_ENDIAN) {
SWITCH_INT(col);
@@ -532,9 +537,12 @@ void face_borderselect()
val= get_border(&rect, 3);
/* why readbuffer here? shouldn't be necessary */
glReadBuffer(GL_BACK);
/* why readbuffer here? shouldn't be necessary (maybe a flush or so) */
glReadBuffer(GL_BACK);
#ifdef __APPLE__
glReadBuffer(GL_AUX0); /* apple only */
#endif
if(val) {
selar= MEM_callocN(me->totface+1, "selar");
@@ -571,6 +579,9 @@ void face_borderselect()
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWIMAGE, 0);
}
#ifdef __APPLE__
glReadBuffer(GL_BACK);
#endif
}
#define TEST_STRUBI 1

View File

@@ -903,6 +903,7 @@ void screenmain(void)
{
int has_input= 1;
int firsttime = 1;
while (1) {
unsigned short event;
short val, towin;
@@ -917,7 +918,7 @@ void screenmain(void)
}
window_make_active(mainwin);
if (event==INPUTCHANGE) {
has_input= val;
}
@@ -1638,7 +1639,7 @@ void add_to_mainqueue(Window *win, void *user_data, short evt, short val, char a
statechanged= 1;
if (U.flag&NONUMPAD) {
if (U.flag & NONUMPAD) {
evt= convert_for_nonumpad(evt);
}

View File

@@ -485,9 +485,14 @@ static int event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) {
/*
* XXX quick hack so OSX version works better
* when the window is clicked on (focused).
* when the window is clicked on (focused).
*
* it used to pass on the old win->lmouse value,
* which causes a wrong click in Blender.
* Actually, a 'focus' click should not be passed
* on to blender... (ton)
*/
if(1) {
if(1) { /* enables me to add locals */
int cx, cy, wx, wy;
GHOST_GetCursorPosition(g_system, &wx, &wy);

View File

@@ -109,13 +109,14 @@ static void screen_swapbuffers_REDRAW(bScreen *sc)
sa= sa->next;
}
if(sa==0) return;
sa= sc->areabase.first;
while(sa) {
swap= sa->win_swap;
if( (swap & WIN_BACK_OK) == 0) {
scrarea_do_windraw(sa);
doswap= 1;
sa->win_swap= swap | WIN_BACK_OK;
}

View File

@@ -596,8 +596,12 @@ static int sample_backbuf_area(int x, int y)
y2= y+Gvp.size;
CLAMP(y1, 0, curarea->winy);
CLAMP(y2, 0, curarea->winy);
#ifdef __APPLE__
glReadBuffer(GL_AUX0);
#endif
glReadPixels(x1+curarea->winrct.xmin, y1+curarea->winrct.ymin, x2-x1+1, y2-y1+1, GL_RGBA, GL_UNSIGNED_BYTE, rect);
glReadBuffer(GL_BACK);
if(G.order==B_ENDIAN) IMB_convert_rgba_to_abgr( (int)(4*Gvp.size*Gvp.size), rect);
rt= rect;
@@ -632,8 +636,13 @@ static unsigned int sample_backbuf(int x, int y)
x+= curarea->winrct.xmin;
y+= curarea->winrct.ymin;
#ifdef __APPLE__
glReadBuffer(GL_AUX0);
#endif
glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
glReadBuffer(GL_BACK);
if(G.order==B_ENDIAN) SWITCH_INT(col);
return framebuffer_to_index(col);
@@ -1074,8 +1083,8 @@ void vertex_paint()
scrarea_do_windraw(curarea);
screen_swapbuffers();
backdrawview3d(0);
draw_sel_circle(mval, 0, Gvp.size, Gvp.size, 0);
backdrawview3d(0);
mvalo[0]= mval[0];
mvalo[1]= mval[1];