forked from enlightenment/efl
parent
855ccdc507
commit
29d8242835
|
@ -173,33 +173,24 @@ void __evas_calc_tex_and_poly(Evas_GL_Image *im, int x, double *x1, double *x2,
|
||||||
*x2 = (double)w;
|
*x2 = (double)w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __evas_gl_render_to_window(Evas_GL_Image *im,
|
void __evas_gl_set_conect_for_dest(Evas_GL_Image *im, Display *disp, Window w,
|
||||||
Display *disp, Window w, int win_w, int win_h,
|
int win_w, int win_h)
|
||||||
int src_x, int src_y, int src_w, int src_h,
|
|
||||||
int dst_x, int dst_y, int dst_w, int dst_h)
|
|
||||||
{
|
{
|
||||||
int x, y, i;
|
if (im->buffer.dest != w)
|
||||||
double dx, dy, dw, dh;
|
{
|
||||||
|
im->buffer.dest = w;
|
||||||
if (im->state != EVAS_STATE_TEXTURE)
|
|
||||||
__evas_gl_move_state_data_to_texture(im);
|
|
||||||
glXMakeCurrent(disp, w, im->context);
|
glXMakeCurrent(disp, w, im->context);
|
||||||
/*
|
|
||||||
glClearColor(0.7, 0.7, 0.7, 1.0);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
*/
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glShadeModel(GL_FLAT);
|
glShadeModel(GL_FLAT);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
||||||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||||
/* why doesnt scissor work ? */
|
/* why doesnt scissor work ? */
|
||||||
/*
|
/*
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
glScissor(dst_x, win_h - dst_y - 1, dst_w, dst_h);
|
glScissor(dst_x, win_h - dst_y - 1, dst_w, dst_h);
|
||||||
*/
|
*/
|
||||||
/* translate all poly coords in ints to normal X coord space */
|
|
||||||
glViewport(0, 0, win_w, win_h);
|
glViewport(0, 0, win_w, win_h);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
@ -208,6 +199,21 @@ void __evas_gl_render_to_window(Evas_GL_Image *im,
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glScalef(1, -1, 1);
|
glScalef(1, -1, 1);
|
||||||
glTranslatef(0, -win_h, 0);
|
glTranslatef(0, -win_h, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __evas_gl_render_to_window(Evas_GL_Image *im,
|
||||||
|
Display *disp, Window w, int win_w, int win_h,
|
||||||
|
int src_x, int src_y, int src_w, int src_h,
|
||||||
|
int dst_x, int dst_y, int dst_w, int dst_h)
|
||||||
|
{
|
||||||
|
int x, y, i;
|
||||||
|
double dx, dy, dw, dh;
|
||||||
|
int done = 1;
|
||||||
|
|
||||||
|
if (im->state != EVAS_STATE_TEXTURE)
|
||||||
|
__evas_gl_move_state_data_to_texture(im);
|
||||||
|
__evas_gl_set_conect_for_dest(im, disp, w, win_w, win_h);
|
||||||
/* project src and dst rects to overall dest rect */
|
/* project src and dst rects to overall dest rect */
|
||||||
dw = (((double)dst_w * (double)im->w)/ (double)src_w);
|
dw = (((double)dst_w * (double)im->w)/ (double)src_w);
|
||||||
dx = (double)dst_x - (((double)dst_w * (double)src_x)/ (double)src_w);
|
dx = (double)dst_x - (((double)dst_w * (double)src_x)/ (double)src_w);
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct _evas_gl_image
|
||||||
Display *display;
|
Display *display;
|
||||||
XVisualInfo *visual_info;
|
XVisualInfo *visual_info;
|
||||||
Colormap colormap;
|
Colormap colormap;
|
||||||
Window window;
|
Window window, dest;
|
||||||
} buffer;
|
} buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,6 +57,8 @@ void __evas_gl_copy_image_rect_to_texture(Evas_GL_Image *im, int x, int y,
|
||||||
void __evas_gl_move_state_data_to_texture(Evas_GL_Image *im);
|
void __evas_gl_move_state_data_to_texture(Evas_GL_Image *im);
|
||||||
void __evas_calc_tex_and_poly(Evas_GL_Image *im, int x, double *x1, double *x2,
|
void __evas_calc_tex_and_poly(Evas_GL_Image *im, int x, double *x1, double *x2,
|
||||||
int *tx, int *txx, double *dtx, double *dtxx, int tw, int w, int edge);
|
int *tx, int *txx, double *dtx, double *dtxx, int tw, int w, int edge);
|
||||||
|
void __evas_gl_set_conect_for_dest(Evas_GL_Image *im, Display *disp, Window w,
|
||||||
|
int win_w, int win_h);
|
||||||
void __evas_gl_render_to_window(Evas_GL_Image *im,
|
void __evas_gl_render_to_window(Evas_GL_Image *im,
|
||||||
Display *disp, Window w, int win_w, int win_h,
|
Display *disp, Window w, int win_w, int win_h,
|
||||||
int src_x, int src_y, int src_w, int src_h,
|
int src_x, int src_y, int src_w, int src_h,
|
||||||
|
|
|
@ -33,11 +33,20 @@ main(int argc, char **argv)
|
||||||
XMapWindow(d, win);
|
XMapWindow(d, win);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
double a = 0.0;
|
int a = -4096;
|
||||||
Evas_GL_Image *i, *bg;
|
Evas_GL_Image *i[10], *bg;
|
||||||
|
|
||||||
bg = __evas_gl_image_new_from_file(d, "/usr/share/pixmaps/backgrounds/Propaganda/Vol6/8a.jpg");
|
bg = __evas_gl_image_new_from_file(d, "/usr/share/pixmaps/backgrounds/Propaganda/Vol6/8a.jpg");
|
||||||
i = __evas_gl_image_new_from_file(d, "/usr/share/pixmaps/gnome-gmush.png");
|
i[0] = __evas_gl_image_new_from_file(d, "/usr/share/pixmaps/gnome-gmush.png");
|
||||||
|
i[1] = __evas_gl_image_new_from_file(d, "/usr/share/pixmaps/gnome-term.png");
|
||||||
|
i[2] = __evas_gl_image_new_from_file(d, "/usr/share/pixmaps/gnome-word.png");
|
||||||
|
i[3] = __evas_gl_image_new_from_file(d, "/usr/share/pixmaps/gnome-help.png");
|
||||||
|
i[4] = __evas_gl_image_new_from_file(d, "/usr/share/pixmaps/gnome-info.png");
|
||||||
|
i[5] = __evas_gl_image_new_from_file(d, "/usr/share/pixmaps/gnome-modem.png");
|
||||||
|
i[6] = __evas_gl_image_new_from_file(d, "/usr/share/pixmaps/gnome-money.png");
|
||||||
|
i[7] = __evas_gl_image_new_from_file(d, "/usr/share/pixmaps/gnome-mouse.png");
|
||||||
|
i[8] = __evas_gl_image_new_from_file(d, "/usr/share/pixmaps/gnome-stones.png");
|
||||||
|
i[9] = __evas_gl_image_new_from_file(d, "/usr/share/pixmaps/gnome-balsa2.png");
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
int x, y, j;
|
int x, y, j;
|
||||||
|
@ -49,17 +58,25 @@ main(int argc, char **argv)
|
||||||
0, 0, bg->w, bg->h,
|
0, 0, bg->w, bg->h,
|
||||||
x, y, bg->w, bg->h);
|
x, y, bg->w, bg->h);
|
||||||
}
|
}
|
||||||
for (j = 0; j < 32; j++)
|
for (j = 0, y = 0; y < 128; y++)
|
||||||
{
|
{
|
||||||
x = 400 + (cos((a + ((double)j / 10))) * (1 * a));
|
for (x = 0; x < 128; x++, j++)
|
||||||
y = 300 + (sin((a + ((double)j / 10))) * (1 * a));
|
{
|
||||||
__evas_gl_render_to_window(i, d, win, 800, 600,
|
int xx, yy;
|
||||||
0, 0, i->w, i->h,
|
|
||||||
x, y, i->w, i->h);
|
xx = (x * 64) + a;
|
||||||
|
yy = (y * 64) + a;
|
||||||
|
if ((xx > -64) && (xx < 800) && (yy > -64) && (yy < 600))
|
||||||
|
__evas_gl_render_to_window(i[j], d, win, 800, 600,
|
||||||
|
0, 0, i[j]->w, i[j]->h,
|
||||||
|
xx, yy, i[j]->w, i[j]->h);
|
||||||
|
if (j == 9) j = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* __evas_sync(d);*/
|
/* __evas_sync(d);*/
|
||||||
__evas_flush_draw(d, win);
|
__evas_flush_draw(d, win);
|
||||||
a += 0.1;
|
a++;
|
||||||
|
if (a == 0) a = -4096;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue