static void dstrukt(Framebuffer *src, float blockpow, float sinpow, float linepow, float colorsep, float t) { glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); gluePrepareflags(0); glClear(GL_COLOR_BUFFER_BIT); glueSet2d(GLUE_NO_DEPTH); glUseProgramObjectARB(shader_dstrukt); glueGlsl_bindtex(shader_dstrukt, "t_color", src->texnum, 0, GL_TEXTURE_2D, GLUE_NO_MIPMAP|GLUE_CLAMP); glueGlsl_bindtex(shader_dstrukt, "t_noise", noisetex->texnum, 1, GL_TEXTURE_2D, GLUE_NO_MIPMAP|GLUE_NEAREST); glUniform1fARB(glGetUniformLocationARB(shader_dstrukt, "blockpow"), blockpow); glUniform1fARB(glGetUniformLocationARB(shader_dstrukt, "sinpow"), sinpow); glUniform1fARB(glGetUniformLocationARB(shader_dstrukt, "linepow"), linepow); glUniform1fARB(glGetUniformLocationARB(shader_dstrukt, "colorsep"), colorsep); glUniform1fARB(glGetUniformLocationARB(shader_dstrukt, "time"), t); glue2dquad(); glUseProgramObjectARB(0); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); }
static void ssaocombinefilter(Framebuffer *src, Framebuffer *ssao) { glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); gluePrepareflags(0); glClear(GL_COLOR_BUFFER_BIT); glueSet2d(GLUE_NO_DEPTH); glUseProgramObjectARB(shader_ssaocombine); glUniform2fARB(glGetUniformLocationARB(shader_ssaocombine, "pixel"), 1.0/(float)ssao->xres, 1.0/(float)ssao->yres); glueGlsl_bindtex(shader_ssaocombine, "colortex", src->texnum, 0, GL_TEXTURE_2D, GLUE_CLAMP|GLUE_NO_MIPMAP); glueGlsl_bindtex(shader_ssaocombine, "ssaotex", ssao->texnum, 1, GL_TEXTURE_2D, GLUE_CLAMP|GLUE_NO_MIPMAP); glueGlsl_bindtex(shader_ssaocombine, "depthtex", src->texnum2, 2, GL_TEXTURE_2D, GLUE_CLAMP|GLUE_NO_MIPMAP|GLUE_NEAREST); //glueGlsl_bindtex(shader_ssaocombine, "depthtex", mrtfbo->texnum2, 0, GL_TEXTURE_2D, GLUE_CLAMP|GLUE_NO_MIPMAP|GLUE_NEAREST); glue2dquad(); glUseProgramObjectARB(0); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); }
static void ssaofilter(Framebuffer *mrtfbo, Texture *noise, float t, float ballsize, float darken) { glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); gluePrepareflags(0); glClear(GL_COLOR_BUFFER_BIT); glueSet2d(GLUE_NO_DEPTH); glUseProgramObjectARB(shader_ssao); glUniform1fARB(glGetUniformLocationARB(shader_ssao, "t"), t); glUniform1fARB(glGetUniformLocationARB(shader_ssao, "ballsize"), ballsize); glUniform1fARB(glGetUniformLocationARB(shader_ssao, "darken"), darken); glUniform2fARB(glGetUniformLocationARB(shader_ssao, "pixel"), 1.0/(float)mrtfbo->xres, 1.0/(float)mrtfbo->yres); //glueGlsl_bindtex(shader_ssao, "colortex", mrtfbo->texnum, 0, GL_TEXTURE_2D, GLUE_CLAMP|GLUE_NO_MIPMAP|GLUE_NEAREST); glueGlsl_bindtex(shader_ssao, "depthtex", mrtfbo->texnum2, 0, GL_TEXTURE_2D, GLUE_CLAMP|GLUE_NO_MIPMAP|GLUE_NEAREST); glueGlsl_bindtex(shader_ssao, "noise", noise->texnum, 1, GL_TEXTURE_2D, GLUE_NO_MIPMAP|GLUE_NEAREST); glue2dquad(); glUseProgramObjectARB(0); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); }
glue_static void glueShowalphabuffer(void) { glueSet2d(0); //glDisable(GL_TEXTURE_2D); glueDisabletexture(); glColor4f(1, 1, 1, 1); glEnable(GL_BLEND); glBlendFunc(GL_DST_ALPHA, GL_ZERO); glue2dquad(); }
void blurfilter(Framebuffer *src, Framebuffer *work, float pixel, int rad, float minus) { int x; glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glueBeginrender(work); gluePrepareflags(0); glClear(GL_COLOR_BUFFER_BIT); glueSet2d(GLUE_NO_DEPTH); glueDisabletexture(); glUseProgramObjectARB(shader_blur); glueGlsl_bindtex(shader_blur, "t_color", src->texnum, 0, GL_TEXTURE_2D, GLUE_CLAMP|GLUE_NO_MIPMAP); glUniform2fARB(glGetUniformLocationARB(shader_blur, "direction"), pixel/src->xres, 0.0); glUniform1iARB(glGetUniformLocationARB(shader_blur, "radius"), rad); glUniform1fARB(glGetUniformLocationARB(shader_blur, "minus"), minus); glue2dquad(); glUseProgramObjectARB(0); glueEndrender(); glClear(GL_COLOR_BUFFER_BIT); glueSet2d(GLUE_NO_DEPTH); glUseProgramObjectARB(shader_blur); glueGlsl_bindtex(shader_blur, "t_color", work->texnum, 0, GL_TEXTURE_2D, GLUE_CLAMP|GLUE_NO_MIPMAP); glUniform2fARB(glGetUniformLocationARB(shader_blur, "direction"), 0, pixel/work->yres); float radmultiplier=(float)work->yres/(float)src->yres; // glueNoticef("blur multiplier shit %5.2f", radmultiplier); glUniform1iARB(glGetUniformLocationARB(shader_blur, "radius"), rad*radmultiplier); glue2dquad(); glUseProgramObjectARB(0); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); }
glue_static void glueClear(float *color) { static int frame=0; /* if (glueLoadOK==1 && frame++<8) { glViewport(0, 0, glueXres, glueYres); glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); } */ glueViewport(); glClearColor(0, 0, 0, 0); glClearDepth(1.0); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); #if GLUE_USE_SHADOWS==1 glClearStencil(0); glClear(GL_STENCIL_BUFFER_BIT); #endif if (color!=black) { gluePush(); glueSetmatrices2d(0); glDisable(GL_FOG); glDisable(GL_TEXTURE_2D); glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); glColor4f(color[0], color[1], color[2], color[3]); glue2dquad(); gluePop(); } }
static void alphafade(Texture *src, float limit, float ramp) { glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glueSet2d(GLUE_NO_DEPTH|GLUE_BLEND_ALPHAADD); glUseProgramObjectARB(shader_alphafade); glueGlsl_bindtex(shader_alphafade, "t_color", src->texnum, 0, GL_TEXTURE_2D, GLUE_NO_MIPMAP); glUniform1fARB(glGetUniformLocationARB(shader_alphafade, "limit"), limit); glUniform1fARB(glGetUniformLocationARB(shader_alphafade, "ramp"), ramp); glue2dquad(); glUseProgramObjectARB(0); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); }