Jump to content
  • Advertisement
Sign in to follow this  
null434

Directx10

This topic is 2133 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

Can I make points displayed on screen without technique and effect like directx 9? If so, what is the way to do that?

Share this post


Link to post
Share on other sites
Advertisement

I have set up one input layout and one vertex buffer that contains only three vertices. I wonder if i can only use that to draw the three vertices on the screen without using shader. I didn't declare ID3D10Effect or ID3D10EffectTechnique..

Share this post


Link to post
Share on other sites

No, you need at least a basic shader to render anything in D3D10 and beyond. There is no fixed function pipeline anymore.

Share this post


Link to post
Share on other sites

Thanks for the replies. There's another quesiton.. I used FX Composer 2.5 to create a fx.file in which the shader code is following:

cbuffer cbObject
{
float4x4 gWVP;
};
 
void VS(float3 iPosL : POSITION,
             out float4 oPosH : SV_POSITION)
{
oPosH = mul(float4(iPosL, 1.0f), gWVP);
}
 
float4 PS(float4 oPosH : SV_POSITION) :SV_TARGET
 {
 return oPosH;
 }
 
technique10 ColorTech
{
pass PO
{
SetVertexShader( CompileShader( vs_4_0, VS() );
SetGeometryShader(NULL);
SetPixelShader(CompileShader( ps_4_0, PS() );
}
}
 
And I added the fx file in the Resource files. When I launched debugger, a series of errors appeared as following:
 
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(2): error C2146: syntax error : missing ';' before identifier 'cbObject'
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(2): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(2): error C2470: 'cbObject' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(6): error C2065: 'float3' : undeclared identifier
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(6): error C2146: syntax error : missing ')' before identifier 'iPosL'
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(6): error C2182: 'VS' : illegal use of type 'void'
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(6): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(7): error C2146: syntax error : missing ';' before identifier 'float4'
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(7): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(7): error C2146: syntax error : missing ';' before identifier 'oPosH'
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(7): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(7): error C2470: 'oPosH' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(7): error C2059: syntax error : ')'
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(8): error C2059: syntax error : '{'
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(11): error C2146: syntax error : missing ';' before identifier 'PS'
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(11): error C2086: 'int float4' : redefinition
1>          c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(7) : see declaration of 'float4'
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(11): error C2146: syntax error : missing ')' before identifier 'oPosH'
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(11): error C2059: syntax error : ')'
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(11): error C2470: 'SV_POSITION' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(12): error C2059: syntax error : '{'
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(17): error C2146: syntax error : missing ';' before identifier 'ColorTech'
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\peter\documents\visual studio 2010\projects\newpp\newpp\ew.fx(17): error C2470: 'ColorTech' : looks like a function definition, but there is no parameter list; skipping apparent body
 
Is it the problem that I integrated the fx file in the wrong way?

Share this post


Link to post
Share on other sites

C++ is NOT C#!

 

You cannot add an FX files to resources and expect it to just work. You first need to compile your effect (trough cmd line tool or with D3DCompile) and then load it as a "Shader Resouce" - THEN you can load it to your device - everything must be coded!

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!