Hi!!! first sorry ym english
I addapt this shader “box-max.cg” , to scale the neogeo pocket games from 160x152 to 320x152, my screen resolution is 640x240
if i mix this shader with a PNG overlay, i can get the game in middle of screen, and custom borders, and still have progressive in my CRT
The problem is that this shader only work in OpenGL, but i need to use Direct3D 9
In D3D9, the shader dont work, and dont do any scaling
Any ideas? im doing something wrong? if not… someone can addapt to D3D?
Thanks a lot
/*
Author: Themaister
License: Public domain
*/
struct input
{
float2 video_size;
float2 texture_size;
float2 output_size;
float frame_count;
float frame_direction;
float frame_rotation;
};
float min(float2 x)
{
if (x.x > x.y)
return x.y;
else
return x.x;
}
void main_vertex
(
float4 position : POSITION,
out float4 oPosition : POSITION,
uniform float4x4 modelViewProj,
float4 color : COLOR,
out float4 oColor : COLOR,
float2 tex : TEXCOORD,
out float2 oTex : TEXCOORD,
uniform input IN
)
{
oPosition = mul(modelViewProj, position);
oColor = color;
float2 box_scale = floor(IN.output_size / IN.video_size);
box_scale = float2(min(box_scale*2), min(box_scale));
float2 scale = (IN.output_size / IN.video_size) / box_scale;
float2 middle = 0.5 * IN.video_size / IN.texture_size;
float2 diff = tex.xy - middle;
oTex = middle + diff * scale;
}
float4 main_fragment (float2 tex : TEXCOORD, uniform sampler2D s0 : TEXUNIT0) : COLOR
{
return tex2D(s0, tex);
}