Directx10

Started by
4 comments, last by Real_Noname 10 years, 7 months ago

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

Advertisement

Do you mean draw on each individual pixel?

Or sprites (2D Textures on screen)? (Great Open Source, http://directxtk.codeplex.com/)

If you mean actually rendering a mesh, then you'll need to create a shader, which is relatively similar to the effects framework. http://msdn.microsoft.com/en-us/library/windows/desktop/bb509703(v=vs.85).aspx

-MIGI0027

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

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

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

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

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?

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!

//====== POWER IN CODE =======

// Homepage: http://en.coderulers.info

This topic is closed to new replies.

Advertisement