- removed temporal patch from myortho2() in mywindow.c, and changed

all calls to ortho2 with correctness offset of 0.375 instead of 0.5.
  this efficiently solves bug in drawing UV lines as reported.

cvS: ----------------------------------------------------------------------
This commit is contained in:
2003-11-18 11:22:17 +00:00
parent 683b51fe83
commit bc22e2242a
16 changed files with 29 additions and 33 deletions

View File

@@ -455,7 +455,7 @@ void drawbutspace(ScrArea *sa, void *spacedata)
sbuts->mainbo= sbuts->mainb;
sbuts->tabo= sbuts->tab[sbuts->mainb];
myortho2(-0.5, (float)(sa->winx)-0.5, -0.5, (float)(sa->winy)-0.5);
myortho2(-0.375, (float)(sa->winx)-0.375, -0.375, (float)(sa->winy)-0.375);
draw_area_emboss(sa);
myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);

View File

@@ -125,7 +125,7 @@ void meshactionbuts(SpaceAction *saction, Key *key)
* correctly *grumble*
*/
mywinset(curarea->win);
myortho2(-0.5, curarea->winx-0.5, -0.5, curarea->winy-0.5);
myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
sprintf(str, "actionbuttonswin %d", curarea->win);
block= uiNewBlock (&curarea->uiblocks, str,
@@ -615,7 +615,7 @@ void drawactionspace(ScrArea *sa, void *spacedata)
/* Draw scroll */
mywinset(curarea->win); // reset scissor too
if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
myortho2(-0.5, curarea->winx-0.5, -0.5, curarea->winy-0.5);
myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
if(G.v2d->scroll) drawscroll(0);
}
@@ -630,7 +630,7 @@ void drawactionspace(ScrArea *sa, void *spacedata)
}
mywinset(curarea->win); // reset scissor too
myortho2(-0.5, curarea->winx-0.5, -0.5, curarea->winy-0.5);
myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
draw_area_emboss(sa);
curarea->win_swap= WIN_BACK_OK;
}

View File

@@ -516,7 +516,7 @@ void drawimagespace(ScrArea *sa, void *spacedata)
calc_image_view(G.sima, 'f'); /* float */
}
myortho2(-0.5, sa->winx-0.5, -0.5, sa->winy-0.5);
myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
draw_area_emboss(sa);
myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
}

View File

@@ -142,7 +142,7 @@ void viewgate(short sx, short sy, short ex, short ey)
wx = curarea->winrct.xmin; wy = curarea->winrct.ymin;
glViewport(wx+sx, wy+sy, (wx+ex )-(wx+sx)+1, (wy+ey )-(wy+sy)+1);
glScissor(wx+sx, wy+sy, (wx+ex )-(wx+sx)+1, (wy+ey )-(wy+sy)+1);
myortho2((float)sx-0.5 , (float)ex-0.5, (float)sy-0.5, (float)ey-0.5);
myortho2((float)sx-0.375 , (float)ex-0.375, (float)sy-0.375, (float)ey-0.375);
}
void areaview (void)
@@ -151,7 +151,7 @@ void areaview (void)
wx = curarea->winrct.xmin; wy = curarea->winrct.ymin;
glViewport(wx, wy, curarea->winx, curarea->winy);
glScissor(wx, wy, curarea->winx, curarea->winy);
myortho2(-0.5, (float)(curarea->winx)-0.5, -0.5, (float)(curarea->winy)-0.5);
myortho2(-0.375, (float)(curarea->winx)-0.375, -0.375, (float)(curarea->winy)-0.375);
}
@@ -867,7 +867,7 @@ void drawimaselspace(ScrArea *sa, void *spacedata)
simasel= curarea->spacedata.first;
/* ortho: xmin xmax, ymin, ymax! */
myortho2(-0.5, (float)(curarea->winx)-0.5, -0.5, (float)(curarea->winy)-0.5);
myortho2(-0.375, (float)(curarea->winx)-0.375, -0.375, (float)(curarea->winy)-0.375);
if (simasel->fase == 0){
checkdir(simasel->dir);

View File

@@ -1676,7 +1676,7 @@ void drawipospace(ScrArea *sa, void *spacedata)
if(sa->winx>SCROLLB+10 && sa->winy>SCROLLH+10) {
/* ortho at pixel level sa */
myortho2(-0.5, sa->winx-0.5, -0.5, sa->winy-0.5);
myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
if(v2d->scroll) {
drawscroll(disptype);
@@ -1691,7 +1691,7 @@ void drawipospace(ScrArea *sa, void *spacedata)
draw_ipogrid();
}
myortho2(-0.5, sa->winx-0.5, -0.5, sa->winy-0.5);
myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
draw_area_emboss(sa);
/* it is important to end a view in a transform compatible with buttons */

View File

@@ -447,7 +447,7 @@ void drawnlaspace(ScrArea *sa, void *spacedata)
/* Draw scroll */
mywinset(curarea->win); // reset scissor too
if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
myortho2(-0.5, curarea->winx-0.5, -0.5, curarea->winy-0.5);
myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
if(G.v2d->scroll) drawscroll(0);
}
@@ -455,7 +455,7 @@ void drawnlaspace(ScrArea *sa, void *spacedata)
draw_nlatree();
mywinset(curarea->win); // reset scissor too
myortho2(-0.5, sa->winx-0.5, -0.5, sa->winy-0.5);
myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
draw_area_emboss(sa);
curarea->win_swap= WIN_BACK_OK;

View File

@@ -423,7 +423,7 @@ void drawoopsspace(ScrArea *sa, void *spacedata)
/* ortho at pixel level curarea */
myortho2(-0.5, sa->winx-0.5, -0.5, sa->winy-0.5);
myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
if(G.v2d->scroll) {
drawscroll(0);
}

View File

@@ -646,7 +646,7 @@ void drawseqspace(ScrArea *sa, void *spacedata)
mywinset(curarea->win);
/* ortho at pixel level curarea */
myortho2(-0.5, curarea->winx-0.5, -0.5, curarea->winy-0.5);
myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
if(G.v2d->scroll) {

View File

@@ -229,7 +229,7 @@ void drawsoundspace(ScrArea *sa, void *spacedata)
mywinset(curarea->win);
/* ortho at pixel level curarea */
myortho2(-0.5, curarea->winx-0.5, -0.5, curarea->winy-0.5);
myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
if(G.v2d->scroll) {
@@ -237,7 +237,7 @@ void drawsoundspace(ScrArea *sa, void *spacedata)
}
}
myortho2(-0.5, curarea->winx-0.5, -0.5, curarea->winy-0.5);
myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
draw_area_emboss(sa);
curarea->win_swap= WIN_BACK_OK;
}

View File

@@ -552,7 +552,7 @@ void drawtextspace(ScrArea *sa, void *spacedata)
BIF_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
myortho2(-0.5, (float)(sa->winx)-0.5, -0.5, (float)(sa->winy)-0.5);
myortho2(-0.375, (float)(sa->winx)-0.375, -0.375, (float)(sa->winy)-0.375);
draw_area_emboss(sa);

View File

@@ -366,9 +366,9 @@ void scrarea_do_headchange(ScrArea *area)
float ofs= area->headbutofs;
if (area->headertype==HEADERDOWN) {
bwin_ortho2(area->headwin, -0.5+ofs, area->headrct.xmax-area->headrct.xmin-0.5+ofs, -3.5, area->headrct.ymax-area->headrct.ymin-3.5);
bwin_ortho2(area->headwin, -0.375+ofs, area->headrct.xmax-area->headrct.xmin-0.375+ofs, -3.375, area->headrct.ymax-area->headrct.ymin-3.375);
} else if (area->headertype==HEADERTOP) {
bwin_ortho2(area->headwin, -0.5+ofs, area->headrct.xmax-area->headrct.xmin-0.5+ofs, -2.5, area->headrct.ymax-area->headrct.ymin-2.5);
bwin_ortho2(area->headwin, -0.375+ofs, area->headrct.xmax-area->headrct.xmin-0.375+ofs, -2.375, area->headrct.ymax-area->headrct.ymin-2.375);
}
}
@@ -1780,7 +1780,7 @@ static bScreen *addscreen(char *name) /* use setprefsize() if you want somethin
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
myortho2(-0.5, sc->sizex-0.5, -0.5, sc->sizey-0.5);
myortho2(-0.375, sc->sizex-0.375, -0.375, sc->sizey-0.375);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
@@ -2930,7 +2930,7 @@ void drawscreen(void)
ScrArea *sa;
mywinset(G.curscreen->mainwin);
myortho2(-0.5, (float)G.curscreen->sizex-0.5, -0.5, (float)G.curscreen->sizey-0.5);
myortho2(-0.375, (float)G.curscreen->sizex-0.375, -0.375, (float)G.curscreen->sizey-0.375);
sa= G.curscreen->areabase.first;
while(sa) {

View File

@@ -1141,7 +1141,7 @@ void drawfilespace(ScrArea *sa, void *spacedata)
char name[20];
char *menu;
myortho2(-0.5, sa->winx-0.5, -0.5, sa->winy-0.5);
myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
BIF_GetThemeColor3fv(TH_HEADER, col); // basic undrawn color is border
glClearColor(col[0], col[1], col[2], 0.0);
@@ -1197,7 +1197,7 @@ void drawfilespace(ScrArea *sa, void *spacedata)
/* others diskfree etc ? */
scrarea_queue_headredraw(curarea);
myortho2(-0.5, (float)(sa->winx)-0.5, -0.5, (float)(sa->winy)-0.5);
myortho2(-0.375, (float)(sa->winx)-0.375, -0.375, (float)(sa->winy)-0.375);
draw_area_emboss(sa);
curarea->win_swap= WIN_BACK_OK;

View File

@@ -427,15 +427,11 @@ void mywinposition(int winid, int xmin, int xmax, int ymin, int ymax) /* watch:
void bwin_ortho(int winid, float x1, float x2, float y1, float y2, float n, float f)
{
bWindow *bwin= bwin_from_winid(winid);
float offs= 0.125;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// in blender it's always called with -0.5... according to opengl
// manual it should be (-)0.375 for correctness.
//offs= 0.01*G.rt;
glOrtho(x1+offs, x2+offs, y1+offs, y2+offs, n, f);
glOrtho(x1, x2, y1, y2, n, f);
glGetFloatv(GL_PROJECTION_MATRIX, (float *)bwin->winmat);
glMatrixMode(GL_MODELVIEW);

View File

@@ -2450,7 +2450,7 @@ void drawinfospace(ScrArea *sa, void *spacedata)
uiDrawBlock(block);
myortho2(-0.5, (float)(sa->winx)-0.5, -0.5, (float)(sa->winy)-0.5);
myortho2(-0.375, (float)(sa->winx)-0.375, -0.375, (float)(sa->winy)-0.375);
draw_area_emboss(sa);
myortho2(0.0, 1280.0, 0.0, curarea->winy/fac);
sa->win_swap= WIN_BACK_OK;

View File

@@ -124,7 +124,7 @@ void scrarea_do_winchange(ScrArea *area)
st->winchange(area, area->spacedata.first);
} else {
if (!BLI_rcti_is_empty(&area->winrct)) {
bwin_ortho2(area->win, -0.5, area->winrct.xmax-area->winrct.xmin-0.5, -0.5, area->winrct.ymax-area->winrct.ymin-0.5);
bwin_ortho2(area->win, -0.375, area->winrct.xmax-area->winrct.xmin-0.375, -0.375, area->winrct.ymax-area->winrct.ymin-0.375);
glLoadIdentity();
}
}

View File

@@ -94,7 +94,7 @@ void persp_general(int a)
glPushMatrix();
glMatrixMode(GL_MODELVIEW);
myortho2(-0.5, ((float)(curarea->winx))-0.5, -0.5, ((float)(curarea->winy))-0.5);
myortho2(-0.375, ((float)(curarea->winx))-0.375, -0.375, ((float)(curarea->winy))-0.375);
glLoadIdentity();
}
else if(a== 1) {
@@ -117,7 +117,7 @@ void persp(int a)
mygetmatrix(G.vd->viewmat1);
}
else if(a== PERSP_WIN) { // only set
myortho2(-0.5, (float)(curarea->winx)-0.5, -0.5, (float)(curarea->winy)-0.5);
myortho2(-0.375, (float)(curarea->winx)-0.375, -0.375, (float)(curarea->winy)-0.375);
glLoadIdentity();
}
else if(a== PERSP_VIEW) {