Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Geometry shaders


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
4 replies to this topic

#1 Naruto-kun   Members   -  Reputation: 373

Like
0Likes
Like

Posted 24 March 2014 - 09:37 AM

Hi guys

 

I have no problems drawing a fullscreen quad without setting a vertex buffer by just giving a vertex count and then handling the positions and UV coordinates in the vertex shader. However I was wondering if it may be possible to do the same on a geometry shader. I have a simple 2D control panel here where I will be drawing several small quads in certain areas so I was hoping I might be able to handle it all on the shader. Can this be done?

 

Thanks

JB



Sponsor:

#2 kauna   Crossbones+   -  Reputation: 2894

Like
0Likes
Like

Posted 24 March 2014 - 11:24 AM

Probably you can do it with GS too, but the VS solution should work as well. Can you show the vertex shader code?

 

Cheers!



#3 Naruto-kun   Members   -  Reputation: 373

Like
1Likes
Like

Posted 24 March 2014 - 11:37 AM

struct VS_Output
{  
    float4 Pos : SV_POSITION;              
    float2 Tex : TEXCOORD0;
};

VS_Output VS(uint id : SV_VertexID)
{
    VS_Output Output;
    Output.Tex = float2((id << 1) & 2, id & 2);
    Output.Pos = float4(Output.Tex * float2(2,-2) + float2(-1,1), 0, 1);
    return Output;
}


#4 kauna   Crossbones+   -  Reputation: 2894

Like
0Likes
Like

Posted 24 March 2014 - 01:56 PM

You'll need to provide some data in order to draw some GUI elements, such as position and element delta size. With that information, you should be able to modify the vertex shader so that it'll draw rectangles on the screen instead of full screen quad. 

 

But since you'll need some data for the GUI drawing, you could as well give each vertex position inside a vertex or a constant buffer.

 

Cheers!



#5 Naruto-kun   Members   -  Reputation: 373

Like
1Likes
Like

Posted 26 March 2014 - 11:51 AM

I was thinking I could handle that with constant variables initialized in shader instead of on the CPU.






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