From 2e8ecb5dbe8b8578b80e8ae4d3e0a2bd0670d864 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 16 Jan 2005 02:31:39 +0000 Subject: [PATCH] Removed some debug checks, added some bug fixes, should be a mite bit more robust now. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@796 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/gl/gl_rmain.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index 808fb6100..392d4ffba 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -184,34 +184,22 @@ void GL_InitSceneProcessingShaders (void) vert = GLSlang_CreateShader(genericvert, 1);//GL_VERTEX_SHADER_ARB); frag = GLSlang_CreateShader(wwfrag, 0);//GL_FRAGMENT_SHADER_ARB); - if (qglGetError()) - Con_Printf("GL Error after initing shader object\n"); - scenepp_ww_program = GLSlang_CreateProgram(vert, frag); - if (qglGetError()) - Con_Printf("GL Error after initing shader object\n"); // scenepp_ww_parm_texturei = GLSlang_GetUniformLocation(scenepp_ww_program, "texture"); scenepp_ww_parm_timef = GLSlang_GetUniformLocation(scenepp_ww_program, "time"); scenepp_ww_parm_xscalef = GLSlang_GetUniformLocation(scenepp_ww_program, "xscale"); - if (qglGetError()) - Con_Printf("GL Error after initing shader object\n"); scenepp_ww_parm_yscalef = GLSlang_GetUniformLocation(scenepp_ww_program, "yscale"); scenepp_ww_parm_ampscalef = GLSlang_GetUniformLocation(scenepp_ww_program, "ampscale"); - if (qglGetError()) - Con_Printf("GL Error after initing shader object\n"); GLSlang_UseProgram(scenepp_ww_program); // GLSlang_SetUniform1i(scenepp_ww_parm_texturei, 0); - if (qglGetError()) - Con_Printf("GL Error after initing shader object\n"); - - if (qglGetError()) - Con_Printf("GL Error after initing shader object\n"); - GLSlang_UseProgram(0); + + if (qglGetError()) + Con_Printf("GL Error initing shader object\n"); } /* @@ -1770,12 +1758,18 @@ void GLR_RenderView (void) // SCENE POST PROCESSING // we check if we need to use any shaders - currently it's just waterwarp - if ((gl_config.arb_shader_objects) && (r_waterwarp.value && r_viewleaf->contents <= Q1CONTENTS_WATER)) + if ((gl_config.arb_shader_objects) && (r_waterwarp.value && r_viewleaf&&r_viewleaf->contents <= Q1CONTENTS_WATER)) { extern int char_texture; float vwidth = 1, vheight = 1; float vs, vt; + if (!glwidth || !glheight) + { + Con_Printf("Window too small!!!\n"); + return; + } + // get the powers of 2 for the size of the texture that will hold the scene while (vwidth < glwidth) { @@ -1828,7 +1822,7 @@ void GLR_RenderView (void) GLSlang_SetUniform1f(scenepp_ww_parm_xscalef, 4 / vs); GLSlang_SetUniform1f(scenepp_ww_parm_yscalef, ((4 / glwidth)*glheight)/vt); //keep the amp proportional to the size of the scene in texture coords - GLSlang_SetUniform1f(scenepp_ww_parm_ampscalef, (0.005 / 0.625) * vs); + GLSlang_SetUniform1f(scenepp_ww_parm_ampscalef, (0.005 / 0.625) * vs*r_waterwarp.value); GLSlang_SetUniform1f(scenepp_ww_parm_timef, cl.time); if (qglGetError())