Render_Engine *re;
re = (Render_Engine *)data;
- return evas_gl_common_image_surface_new(re->win->gl_context, w, h, alpha);
+ return evas_gl_common_image_surface_new(re->win->gl_context, w, h, alpha, EINA_FALSE);
}
static void
struct _Evas_GL_Texture_Pool
{
Evas_Engine_GL_Context *gc;
- GLuint texture, fb;
+ GLuint texture, fb, stencil;
GLuint intformat, format, dataformat;
int w, h;
int references;
void evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt);
Evas_GL_Texture *evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im, Eina_Bool disable_atlas);
Evas_GL_Texture *evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, Evas_GL_Image *im);
-Evas_GL_Texture *evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha);
+Evas_GL_Texture *evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int stencil);
Evas_GL_Texture *evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im);
void evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im);
void evas_gl_common_texture_upload(Evas_GL_Texture *tex, RGBA_Image *im, unsigned int bytes_count);
void evas_gl_common_image_scale_hint_set(Evas_GL_Image *im, int hint);
void evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint);
void evas_gl_common_image_cache_flush(Evas_Engine_GL_Context *gc);
-Evas_GL_Image *evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha);
+Evas_GL_Image *evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int stencil);
void evas_gl_common_image_dirty(Evas_GL_Image *im, unsigned int x, unsigned int y, unsigned int w, unsigned int h);
void evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im);
void evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int npoints, RGBA_Map_Point *p, int smooth, int level);
gc->shared->references++;
_evas_gl_common_viewport_set(gc,1);
- gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1);
+ gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1, EINA_FALSE);
TRACE_EFL_END();
}
Evas_GL_Image *
-evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha)
+evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int stencil)
{
Evas_GL_Image *im;
im->alpha = alpha;
im->w = w;
im->h = h;
- im->tex = evas_gl_common_texture_render_new(gc, w, h, alpha);
+ im->tex = evas_gl_common_texture_render_new(gc, w, h, alpha, stencil);
im->tex_only = 1;
return im;
}
}
static Evas_GL_Texture_Pool *
-_pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format)
+_pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format, int stencil)
{
Evas_GL_Texture_Pool *pt;
int fnum;
// note: should check fbo completeness
}
+ if (stencil)
+ {
+ glGenRenderbuffers(1, &(pt->stencil));
+ glBindRenderbuffer(GL_RENDERBUFFER, pt->stencil);
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, pt->w, pt->h);
+ glBindRenderbuffer(GL_RENDERBUFFER, 0);
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, pt->stencil);
+ }
+
glsym_glBindFramebuffer(GL_FRAMEBUFFER, fnum);
glBindTexture(gc->state.current.tex_target, gc->state.current.cur_tex);
glDeleteTextures(1, &(pt->texture));
if (pt->gc->state.current.cur_tex == pt->texture)
pt->gc->state.current.cur_tex = 0;
+ if (pt->stencil)
+ {
+ glDeleteRenderbuffers(1, &(pt->stencil));
+ pt->stencil = 0;
+ }
if (pt->fb)
{
glsym_glDeleteFramebuffers(1, &(pt->fb));
}
Evas_GL_Texture *
-evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha)
+evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int stencil)
{
Evas_GL_Texture *tex;
int lformat;
if (!tex) return NULL;
tex->pt = _pool_tex_render_new(gc, w, h,
*matching_format[lformat].intformat,
- *matching_format[lformat].format);
+ *matching_format[lformat].format, stencil);
if (!tex->pt)
{
evas_gl_common_texture_light_free(tex);
// FIXME: why a 'render' new here ??? Should already have been allocated, quite a weird path.
tex->pt = _pool_tex_render_new(tex->gc, tex->w, tex->h,
*matching_format[lformat].intformat,
- *matching_format[lformat].format);
+ *matching_format[lformat].format, EINA_FALSE);
}
// If image was preloaded then we need a ptt
if (!tex->pt) return;
h = im1->w;
}
- im2 = evas_gl_common_image_surface_new(gl_context, w, h, alpha);
+ im2 = evas_gl_common_image_surface_new(gl_context, w, h, alpha, EINA_FALSE);
evas_gl_common_context_target_surface_set(gl_context, im2);
re->window_use(re->software.ob);
gl_context = re->window_gl_context_get(re->software.ob);
- return evas_gl_common_image_surface_new(gl_context, w, h, alpha);
+ return evas_gl_common_image_surface_new(gl_context, w, h, alpha, EINA_FALSE);
}
static void *