Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
PracticeDx
Commits
3d3d5e78
Commit
3d3d5e78
authored
Mar 27, 2023
by
Administrator
Browse files
texture testing is working
parent
7864abdd
Changes
2
Hide whitespace changes
Inline
Side-by-side
PracticeDx/PracticeDx.vcxproj
View file @
3d3d5e78
...
...
@@ -144,10 +144,12 @@
<FxCompile
Include=
"TexturePS.hlsl"
>
<ShaderType
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
Pixel
</ShaderType>
<ShaderModel
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
4.0
</ShaderModel>
<ObjectFileOutput
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
$(ProjectDir)%(Filename).cso
</ObjectFileOutput>
</FxCompile>
<FxCompile
Include=
"TextureVS.hlsl"
>
<ShaderModel
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
4.0
</ShaderModel>
<ShaderType
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
Vertex
</ShaderType>
<ObjectFileOutput
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
$(ProjectDir)%(Filename).cso
</ObjectFileOutput>
</FxCompile>
<FxCompile
Include=
"VertexShader.hlsl"
>
<ShaderType
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
Vertex
</ShaderType>
...
...
PracticeDx/WinMain.cpp
View file @
3d3d5e78
...
...
@@ -187,7 +187,12 @@ Microsoft::WRL::ComPtr<ID3D11PixelShader> pPixelShader;
ID3D11InputLayout
*
pInputLayout
;
/************************************
* 2.13 DefineSampler
* 2.13 DefineTexture
************************************/
Microsoft
::
WRL
::
ComPtr
<
ID3D11ShaderResourceView
>
pTextureView
;
/************************************
* 2.14 DefineSampler
************************************/
Microsoft
::
WRL
::
ComPtr
<
ID3D11SamplerState
>
pSampler
;
...
...
@@ -310,7 +315,8 @@ void DefineColorConstBuffer()
void
DefineVertexShader
()
{
// Load pixel shader file into BLOB, and create COM object of vertex shader
D3DReadFileToBlob
(
L"VertexShader.cso"
,
&
pCompiledVertexBlob
);
//D3DReadFileToBlob(L"VertexShader.cso", &pCompiledVertexBlob);
D3DReadFileToBlob
(
L"TextureVS.cso"
,
&
pCompiledVertexBlob
);
dev
->
CreateVertexShader
(
pCompiledVertexBlob
->
GetBufferPointer
(),
pCompiledVertexBlob
->
GetBufferSize
(),
nullptr
,
&
pVertexShader
);
// bind vertex shader
...
...
@@ -323,7 +329,8 @@ void DefineVertexShader()
void
DefinePixelShader
()
{
// Load vertex shader file into BLOB, and create COM object of pixel shader
D3DReadFileToBlob
(
L"PixelShader.cso"
,
&
pCompiledPixelBlob
);
//D3DReadFileToBlob(L"PixelShader.cso", &pCompiledPixelBlob);
D3DReadFileToBlob
(
L"TexturePS.cso"
,
&
pCompiledPixelBlob
);
dev
->
CreatePixelShader
(
pCompiledPixelBlob
->
GetBufferPointer
(),
pCompiledPixelBlob
->
GetBufferSize
(),
nullptr
,
&
pPixelShader
);
// bind pixel shader
...
...
@@ -339,9 +346,12 @@ void DefineInputLayout()
const
D3D11_INPUT_ELEMENT_DESC
ied
[]
=
{
//{ "Position",0,DXGI_FORMAT_R32G32_FLOAT,0,0,D3D11_INPUT_PER_VERTEX_DATA,0 },
{
"Position"
,
0
,
DXGI_FORMAT_R32G32B32_FLOAT
,
0
,
0
,
D3D11_INPUT_PER_VERTEX_DATA
,
0
},
//
{ "Position",0,DXGI_FORMAT_R32G32B32_FLOAT,0,0,D3D11_INPUT_PER_VERTEX_DATA,0 },
//{ "Color",0,DXGI_FORMAT_R32G32B32_FLOAT,0,8,D3D11_INPUT_PER_VERTEX_DATA,0 },
//{ "Color",0,DXGI_FORMAT_R32G32B32_FLOAT,0,12,D3D11_INPUT_PER_VERTEX_DATA,0 },
{
"Position"
,
0
,
DXGI_FORMAT_R32G32B32_FLOAT
,
0
,
0
,
D3D11_INPUT_PER_VERTEX_DATA
,
0
},
{
"TexCoord"
,
0
,
DXGI_FORMAT_R32G32_FLOAT
,
0
,
12
,
D3D11_INPUT_PER_VERTEX_DATA
,
0
},
};
// Create input layout, using the description Defined above
...
...
@@ -397,8 +407,17 @@ void DrawPrimitive()
devcon
->
DrawIndexed
((
UINT
)
std
::
size
(
indices
),
0u
,
0u
);
}
/************************************
* 2.13 DefineTexture
************************************/
void
DefineTexture
()
{
}
/************************************
* 2.1
3
DefineSampler
* 2.1
4
DefineSampler
************************************/
void
DefineSampler
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment