Pete´s Messageboard... No ISO/BIOS requests!

Homepage Members Register Login Search Old board


Neuer Thread ...


AuthorTopics » Book an abo for this threadClose Thread Move Thread Fix the thread Print view Delete this thread

guest ...
Real addict
.........

...

Status:Offline
Date registered: 30.07.2004
Post:856
Send Message
...   Created on 23.09.2005 - 14:07Jump to top Quote this post Report this post Edit Delete


A 2D scaler.

vertex file


uniform vec4 OGL2Param;
uniform vec4 OGL2Size;
varying vec2 dg2;
void main()

{
float x = (OGL2Size.x/2048.0)*OGL2Param.x;
float y = (OGL2Size.y/1024.0)*OGL2Param.y;
vec2 dg1 = vec2( x,y);
dg2 = vec2(-x,y);
vec2 dx = vec2(x,0.0);
vec2 dy = vec2(0.0,y);
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1].xy = gl_TexCoord[0].xy - dy;
gl_TexCoord[2].xy = gl_TexCoord[0].xy + dy;
gl_TexCoord[3].xy = gl_TexCoord[0].xy - dx;
gl_TexCoord[4].xy = gl_TexCoord[0].xy + dx;
gl_TexCoord[5].xy = gl_TexCoord[0].xy - dg1;
gl_TexCoord[6].xy = gl_TexCoord[0].xy + dg1;
}


fragment file


// 2xGLSL shader - by guest(r)

uniform sampler2D OGL2Texture;
uniform vec4 OGL2Param;
varying vec2 dg2;

void main()
{
vec2 c1 = gl_TexCoord[0].xy - dg2;
vec2 c2 = gl_TexCoord[0].xy + dg2;

vec3 c00 = texture2D(OGL2Texture, gl_TexCoord[5].xy).xyz;
vec3 c10 = texture2D(OGL2Texture, gl_TexCoord[1].xy).xyz;
vec3 c20 = texture2D(OGL2Texture, c1).xyz;
vec3 c01 = texture2D(OGL2Texture, gl_TexCoord[3].xy).xyz;
vec3 c11 = texture2D(OGL2Texture, gl_TexCoord[0].xy).xyz;
vec3 c21 = texture2D(OGL2Texture, gl_TexCoord[4].xy).xyz;
vec3 c02 = texture2D(OGL2Texture, c2).xyz;
vec3 c12 = texture2D(OGL2Texture, gl_TexCoord[2].xy).xyz;
vec3 c22 = texture2D(OGL2Texture, gl_TexCoord[6].xy).xyz;

vec3 dottie = vec3(1.0,1.0,1.0);

float k00=dot(abs(c22-c11),dottie);
float k20=dot(abs(c02-c11),dottie);
float k02=dot(abs(c20-c11),dottie);
float k22=dot(abs(c00-c11),dottie);

float w1 = max(k00,k20);
float w2 = max(k20,k22);
float w3 = max(k02,k22);
float w4 = max(k00,k02);

float kd1=step(0.0001,(k00+k22)*(k20+k02));

gl_FragColor.xyz = (1.0-kd1)*c11+kd1*(w1*c10+w2*c21+w3*c12+w4*c01)/(w1+w2+w3+w4);
}




If you experience any black-pixel problems, you coud use this fragment file.


fragment file - optional

// 2xGLSL shader - by guest(r)

uniform sampler2D OGL2Texture;
uniform vec4 OGL2Param;
varying vec2 dg2;

void main()
{
vec2 c1 = gl_TexCoord[0].xy - dg2;
vec2 c2 = gl_TexCoord[0].xy + dg2;

vec3 c00 = texture2D(OGL2Texture, gl_TexCoord[5].xy).xyz;
vec3 c10 = texture2D(OGL2Texture, gl_TexCoord[1].xy).xyz;
vec3 c20 = texture2D(OGL2Texture, c1).xyz;
vec3 c01 = texture2D(OGL2Texture, gl_TexCoord[3].xy).xyz;
vec3 c11 = texture2D(OGL2Texture, gl_TexCoord[0].xy).xyz;
vec3 c21 = texture2D(OGL2Texture, gl_TexCoord[4].xy).xyz;
vec3 c02 = texture2D(OGL2Texture, c2).xyz;
vec3 c12 = texture2D(OGL2Texture, gl_TexCoord[2].xy).xyz;
vec3 c22 = texture2D(OGL2Texture, gl_TexCoord[6].xy).xyz;

vec3 dottie = vec3(1.0,1.0,1.0);

float k00=dot(abs(c22-c11),dottie);
float k20=dot(abs(c02-c11),dottie);
float k02=dot(abs(c20-c11),dottie);
float k22=dot(abs(c00-c11),dottie);

float w1 = max(k00,k20) + 0.00000001;
float w2 = max(k20,k22);
float w3 = max(k02,k22);
float w4 = max(k00,k02);

float kd1=step(0.0001,(k00+k22)*(k20+k02));

gl_FragColor.xyz = (1.0-kd1)*c11+kd1*(w1*c10+w2*c21+w3*c12+w4*c01)/(w1+w2+w3+w4);
}

[Dieser Beitrag wurde am 10.10.2005 - 16:51 von guest aktualisiert]





Similarly threads:
Topics Created by Replies Boardname
2xGLSL_Filter shader - by guest(r) guest 7 pete_bernert
4xGLSL_Filter shader - by guest(r) guest 0 pete_bernert
2xGLSL_HqFilter shader - by guest(r) guest 2 pete_bernert
Natural Vision Shader + AA Shader v2.o = Best Shader for 2d !! zaykho 10 pete_bernert
4-in-1 Shader v1.10 MegaManJuno 3 pete_bernert
Neuer Thread ...





Masthead

This forum is a free service of razyboard.com powered by:
Geizkragen Price Comparison. Top product in the price comparison: Krups Nespresso Essenza (XN2001)
Do you want a free forum in less than two minutes? Then click here!



Verwandte Suchbegriffe:
2xglsl | 2xglsl shader | guest.r shader | ogl2param | ogl2param pete | 2xglsl pete
blank