From da85ef60f11bc70ef715fc9086607a5edc827ae6 Mon Sep 17 00:00:00 2001 From: psperl Date: Wed, 16 Jul 2008 03:53:47 +0000 Subject: [PATCH] I misspoke last commit. NOW blur is proper git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@1102 6778bc44-b910-0410-a7a0-be141de4315d --- src/projectM-engine/Renderer.cpp | 27 +++++++++++++-------------- src/projectM-engine/blur.cg | 21 +++++++++++++-------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/projectM-engine/Renderer.cpp b/src/projectM-engine/Renderer.cpp index a06efb854..64ac170a8 100644 --- a/src/projectM-engine/Renderer.cpp +++ b/src/projectM-engine/Renderer.cpp @@ -529,10 +529,10 @@ if(blur1_enabled || blur2_enabled || blur3_enabled) cgGLBindProgram(blur1Program); checkForCgError("binding blur1 program"); - float points[4][2] = {{0, 0}, - {0, 1}, - { 1, 1}, - { 1, 0}}; + float points[4][2] = {{0, 1}, + {0, 0}, + {1, 0}, + {1, 1}}; glVertexPointer(2,GL_FLOAT,0,points); @@ -555,10 +555,10 @@ if(blur1_enabled || blur2_enabled || blur3_enabled) cgGLBindProgram(blur2Program); checkForCgError("binding blur2 program"); - float points[4][2] = {{0, 0}, - {0, 0.5}, - { 0.5, 0.5}, - { 0.5, 0}}; + float points[4][2] = {{0, 0.5}, + {0, 0}, + {0.5, 0}, + {0.5, 0.5}}; glVertexPointer(2,GL_FLOAT,0,points); @@ -576,11 +576,10 @@ if(blur1_enabled || blur2_enabled || blur3_enabled) if (blur3_enabled) { cgGLSetParameter4f(cgGetNamedParameter(blur2Program, "srctexsize"), renderTarget->texsize/2, renderTarget->texsize/2, 2/(float)renderTarget->texsize,2/(float)renderTarget->texsize); - - float points[4][2] = {{0, 0}, - {0, 0.25}, - { 0.25, 0.25}, - { 0.25, 0}}; + float points[4][2] = {{0, 0.25}, + {0, 0}, + {0.25, 0}, + {0.25, 0.25}}; glVertexPointer(2,GL_FLOAT,0,points); @@ -1498,7 +1497,7 @@ void Renderer::CompositeOutput(const Pipeline* pipeline, const PipelineContext & #endif for (std::vector::const_iterator pos = pipeline->compositeDrawables.begin(); pos != pipeline->compositeDrawables.end(); ++pos) - (*pos)->Draw(renderContext); + ;//(*pos)->Draw(renderContext); } diff --git a/src/projectM-engine/blur.cg b/src/projectM-engine/blur.cg index 1417d4e59..50142f488 100644 --- a/src/projectM-engine/blur.cg +++ b/src/projectM-engine/blur.cg @@ -6,10 +6,12 @@ outtype blur1(float2 uv : TEXCOORD0, uniform sampler2D sampler_blur : TEX0) { float2 uv2 = uv.xy + srctexsize.zw*float2(1,1); -float3 val = tex2D(sampler_blur, float2(uv.x-.0015, uv.y)).xyz; -val += tex2D(sampler_blur, float2(uv.x+.0015, uv.y)).xyz; -val += tex2D(sampler_blur, float2(uv.x, uv.y + .0015)).xyz; -val += tex2D(sampler_blur, float2(uv.x, uv.y - .0015)).xyz; +float d = srctexsize.z; +d=.0015; +float3 val = tex2D(sampler_blur, float2(uv.x-d, uv.y)).xyz; +val += tex2D(sampler_blur, float2(uv.x+d, uv.y)).xyz; +val += tex2D(sampler_blur, float2(uv.x, uv.y + d)).xyz; +val += tex2D(sampler_blur, float2(uv.x, uv.y - d)).xyz; outtype OUT; OUT.color.xyz = val* 0.25; @@ -21,10 +23,13 @@ outtype blur2(float2 uv : TEXCOORD0, uniform sampler2D sampler_blur : TEX0) { float2 uv2 = uv.xy + srctexsize.zw*float2(1,0); -float3 val = tex2D(sampler_blur, float2(uv.x-.0015, uv.y)).xyz; -val += tex2D(sampler_blur, float2(uv.x+.0015, uv.y)).xyz; -val += tex2D(sampler_blur, float2(uv.x, uv.y + .0015)).xyz; -val += tex2D(sampler_blur, float2(uv.x, uv.y - .0015)).xyz; +float d = srctexsize.z; +d=.0015; + +float3 val = tex2D(sampler_blur, float2(uv.x-d, uv.y)).xyz; +val += tex2D(sampler_blur, float2(uv.x+d, uv.y)).xyz; +val += tex2D(sampler_blur, float2(uv.x, uv.y + d)).xyz; +val += tex2D(sampler_blur, float2(uv.x, uv.y - d)).xyz; val *= 0.25;