Multiple Textures on One Quad?

Started by
5 comments, last by markypooch 11 years ago

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

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.

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++

The example you provided seems like the right direction but since I am using D3D11 I dont know how applicable D3D9 is

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.

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.

Thank you both very much it looks like it worksbiggrin.png

This topic is closed to new replies.

Advertisement