• Advertisement
Sign in to follow this  

Multiple Textures on One Quad?

This topic is 1760 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everybody,

 

this is my first thread on this site so I'll try to keep it as concise as I can.

 

What I am trying to accomplish is to render more then texture( or sprite) to the same quad.

I have had limited success in this endeavor most likely due to me being new to DirectX

and Graphics in general.

 

I have tried making two vertex Buffers( One with smaller vertices) and having a draw call for each buffer to create a

page-flip like effect but the result was a flickering screen.

 

So then I tried to render a full rectangle over the originel quad while trying to make the image on the second

rectangle transparent to make it seem like their where mulitple sprites on one screen, this too resulted in a failure.

 

 

So my final question is what direction or concept should I tackle in order to accomplish mulitple DIFFERENT

textures Or sprites on one quad?

 

Should I make the image on the second rectangle transparent?

 

Any help would be appreciated smile.png

 

-Marcus

 

Share this post


Link to post
Share on other sites
Advertisement

Hi and welcome to the site!

 

Are you using shaders or the fixed function pipeline? Which version of DirectX? As a general rule, try to let people which language/library/API/platform you are working with before asking questions so they can help you better. See this sample, it may be what you need.

Share this post


Link to post
Share on other sites

Ah, my apologies I am using DirectX11 which I believe got rid of the fixed function pipeline so I have been referencing tutorials on other sites to construct

my shaders.

 

Also I am using C++

Share this post


Link to post
Share on other sites

You basically have two choices:

- Have your shader sample from the two different textures and combine them as it sees fit. If the different textures require different texture coordinates, then you'll need two separate texture coordinates in your vertices (i.e. TEXCOORD0, TEXCOORD1). 

- If you can achieve your dual texture effect as an alpha-blending operation (say all you're doing is adding the texture values together), then you can just make two draws of the same quad on top of each other with different textures.

Share this post


Link to post
Share on other sites

In that case, the sample linked to is irrelevant indeed. phil_t is correct, with the first choice he described being the more common one.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement