ooooops - fix gl engine to handle window resizes..... :)

SVN revision: 4230
This commit is contained in:
Carsten Haitzler 2001-02-16 01:33:14 +00:00
parent a9e141362a
commit 72981477de
2 changed files with 20 additions and 15 deletions

View File

@ -246,11 +246,7 @@ __evas_gl_window_current(Display *disp, Window win, int w, int h)
if (!glw) return NULL;
if (glw != __evas_current)
{
double dr, dg, db, da;
__evas_current = glw;
glw->w = w;
glw->h = h;
glXMakeCurrent(glw->disp, glw->win, glw->context->context);
glShadeModel(GL_FLAT);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
@ -258,15 +254,6 @@ __evas_gl_window_current(Display *disp, Window win, int w, int h)
glEnable(GL_LINE_SMOOTH);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glViewport(0, 0, glw->w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, glw->w, 0, glw->h, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glScalef(1, -1, 1);
glTranslatef(0, - glw->h, 0);
if (glw->context->dither) glEnable(GL_DITHER);
else glDisable(GL_DITHER);
if (glw->context->blend)
@ -294,6 +281,22 @@ __evas_gl_window_current(Display *disp, Window win, int w, int h)
if (glw->context->bound_texture)
glBindTexture(GL_TEXTURE_2D, glw->context->bound_texture->texture);
}
if ((glw->w != w) || (glw->h != h))
{
double dr, dg, db, da;
glw->w = w;
glw->h = h;
glViewport(0, 0, glw->w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, glw->w, 0, glw->h, -1, 1);
printf("%i %i\n", glw->w, glw->h);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glScalef(1, -1, 1);
glTranslatef(0, - glw->h, 0);
}
return glw;
}

View File

@ -562,6 +562,7 @@ evas_move(Evas e, Evas_Object o, double x, double y)
if (!e) return;
if (!o) return;
if ((o->type == OBJECT_LINE)) return;
if ((x == o->current.x) && (y == o->current.y)) return;
if ((o->current.visible) &&
(_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)))
event_update = 1;
@ -607,11 +608,12 @@ evas_resize(Evas e, Evas_Object o, double w, double h)
if ((o->type == OBJECT_LINE)) return;
if ((o->type == OBJECT_TEXT)) return;
if ((o->type == OBJECT_POLYGON)) return;
if (w < 0) w = 0;
if (h < 0) h = 0;
if ((w == o->current.w) && (h == o->current.h)) return;
if ((o->current.visible) &&
(_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)))
event_update = 1;
if (w < 0) w = 0;
if (h < 0) h = 0;
o->current.w = w;
o->current.h = h;
o->changed = 1;