Jump to content

  • Log In with Google      Sign In   
  • Create Account

Multiple Textures on One Quad?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 markypooch   Members   -  Reputation: 362

Like
0Likes
Like

Posted 26 March 2013 - 02:38 PM

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

 



Sponsor:

#2 Amr0   Members   -  Reputation: 1110

Like
0Likes
Like

Posted 26 March 2013 - 04:08 PM

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.



#3 markypooch   Members   -  Reputation: 362

Like
0Likes
Like

Posted 26 March 2013 - 04:10 PM

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



#4 markypooch   Members   -  Reputation: 362

Like
0Likes
Like

Posted 26 March 2013 - 04:12 PM

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



#5 phil_t   Crossbones+   -  Reputation: 3915

Like
1Likes
Like

Posted 26 March 2013 - 04:26 PM

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.



#6 Amr0   Members   -  Reputation: 1110

Like
1Likes
Like

Posted 26 March 2013 - 04:34 PM

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.



#7 markypooch   Members   -  Reputation: 362

Like
0Likes
Like

Posted 26 March 2013 - 05:21 PM

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






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS