Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7558371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:21:17+00:00 2026-05-30T12:21:17+00:00

Okay first up I am using: DirectX 10 C++ Okay this is a bit

  • 0

Okay first up I am using:

  • DirectX 10
  • C++

Okay this is a bit of a bizarre one to me, I wouldn’t usually ask the question, but I’ve been forced by circumstance. I have two triangles (not a quad for reasons I wont go into!) full screen, aligned to screen through the fact they are not transformed.

In the DirectX vertex declaration I am passing a 3 component float (Pos x,y,z) and 2 component float (Texcoord x,y). Texcoord z is reserved for texture2d arrays, which I’m currently defaulting to 0 in the the pixel shader.

I wrote this to achieve the simple task:

float fStartX = -1.0f;
float fEndX = 1.0f;
float fStartY = 1.0f;
float fEndY = -1.0f;
float fStartU = 0.0f;
float fEndU = 1.0f;
float fStartV = 0.0f;
float fEndV = 1.0f;
vmvUIVerts.push_back(CreateVertex(fStartX, fStartY, 0, fStartU, fStartV));
vmvUIVerts.push_back(CreateVertex(fEndX, fStartY, 0, fEndU, fStartV));
vmvUIVerts.push_back(CreateVertex(fEndX, fEndY, 0, fEndU, fEndV));
vmvUIVerts.push_back(CreateVertex(fStartX, fStartY, 0, fStartU, fStartV));
vmvUIVerts.push_back(CreateVertex(fEndX, fEndY, 0, fEndU, fEndV));
vmvUIVerts.push_back(CreateVertex(fStartX, fEndY, 0, fStartU, fEndV));

IA Layout: (Update)

D3D10_INPUT_ELEMENT_DESC ieDesc[2] = {
    { "POSITION",   0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
    { "TEXCOORD",   0, DXGI_FORMAT_R32G32B32_FLOAT, 0,12, D3D10_INPUT_PER_VERTEX_DATA, 0 }
};

Data reaches the vertex shader in the following format: (Update)

struct VS_INPUT
{ 
    float3 fPos          :POSITION;
    float3 fTexcoord     :TEXCOORD0;
}

Within my Vertex and Pixel shader not a lot is happening for this particular draw call, the pixel shader does most of the work sampling from a texture using the specified UV coordinates. However, this isn’t working quite as expected, it appears that I am getting only 1 pixel of the sampled texture.

The workaround was in the pixel shader to do the following: (Update)

sampler s0                      : register(s0);
Texture2DArray<float4> meshTex  : register(t0);
float4 psMain(in VS_OUTPUT vOut) : SV_TARGET
{
    float4 Color;
    vOut.fTexcoord.z = 0;
    vOut.fTexcoord.x = vOut.fPosObj.x * 0.5f;
    vOut.fTexcoord.y = vOut.fPosObj.y * 0.5f;
    vOut.fTexcoord.x += 0.5f;
    vOut.fTexcoord.y += 0.5f;
    Color = quadTex.Sample(s0, vOut.fTexcoord);
    Color.a = 1.0f;
    return Color;
}

It was also worth noting that this worked with the following VS out struct defined in the shaders:

struct VS_OUTPUT
{
    float4 fPos          :POSITION0; // SV_POSITION wont work in this case
    float3 fTexcoord    :TEXCOORD0;
}

Now I have a texture that’s stretched to fit the entire screen, both triangles already cover this, but why did the texture UV’s not get used as expected?

To clarify I am using a point sampler and have tried both clamp and wrapping UV.

I was a bit curious and found a solution / workaround mentioned above, however I’d prefer not to have to do it if anyone knows why it’s happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:21:19+00:00Added an answer on May 30, 2026 at 12:21 pm

    Okay well, for one, the texture coordinates outside of 0..1 range get clamped. I made the mistake of assuming that by going to clip space -1 to +1 that the texture coordinates would be too. This is not the case, they still go from 0.0 to 1.0.

    The reason why the code in the pixel shader worked, was because it was using the clip space x,y,z coordinates to automatically overwrite these texture coordinates; an oversight on my part. However, the pixel shader code results in texture stretch on a full screen ‘quad’, so it might be useful to someone somewhere 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay at first I thought this would be pretty straightforward. But I can't think
Okay this is a fairly broad question. This is my first App and I'm
Okay this could very likely be a silly question. I am using Entity Framework
Using Informix C++ interface, the first query is fine, but the second yields this
Okay, so this is my first project using PHP and MySQL and I thought
First of all, I am using PhpMyAdmin , is this okay or not? Because
I'm using QueryPath and PHP. This finds the .eventdate okay, but doesn't return anything
Okay this may seem too simple of a question but I've wasted enough time
Okay, this one is REALLY weird. I'm using .net for my backend and Flex
Okay, so I'm doing my first foray into using the ADO.NET Entity Framework. My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.