Help

  • Miran
  • Topic Author
More
2 months 3 days ago #1 by Miran Help was created by Miran
So i play fivem and im trying to get a radio that i can have on my screen just as an image. 

Every single time i try to do it it says "failiure to create texture" even though i have a texture that its supposed to go to, i will attach the .fx




texture RadioTex <
    source = "apx8000h.png";
>;

sampler2D RadioSampler {
    Texture = RadioTex;
};

uniform float2 ImagePos <
    ui_type = "drag";
    ui_label = "Image Position";
    ui_min = float2(0.0, 0.0);
    ui_max = float2(1920.0, 1080.0);
> = float2(100.0, 100.0);

uniform float ImageScale <
    ui_type = "slider";
    ui_min = 0.1;
    ui_max = 5.0;
    ui_label = "Image Scale";
> = 1.0;

uniform float ImageOpacity <
    ui_type = "slider";
    ui_min = 0.0;
    ui_max = 1.0;
    ui_label = "Image Opacity";
> = 1.0;

static const float2 ImageSize = float2(768.0, 819.0);

struct VSOUT {
    float4 pos : SV_Position;
    float2 uv  : TEXCOORD0;
};

VSOUT VS_PassThrough(float4 vpos : POSITION, float2 uv : TEXCOORD0)
{
    VSOUT o;
    o.pos = vpos;
    o.uv = uv;
    return o;
}

float4 PS_MoveableImage(VSOUT input) : SV_Target
{
    float2 screenPos = input.pos.xy;
    float2 scaledSize = ImageSize * ImageScale;

    float2 uv = (screenPos - ImagePos) / scaledSize;

    if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0)
        return float4(0.0, 0.0, 0.0, 0.0);

    float4 color = tex2D(RadioSampler, uv);
    return float4(color.rgb, color.a * ImageOpacity);
}

technique MoveableImage
{
    pass P0
    {
        VertexShader = VS_PassThrough;
        PixelShader  = PS_MoveableImage;
    }
}
 

Please Log in or Create an account to join the conversation.