Game Development Reference
In-Depth Information
n m_PixelShader is an instantiation of the GameCode4_Hlsl_VertexShader
class.
n m_pVertexBuffer and m_pIndexBuffer are ID3D11Buffer objects initial-
ized as you saw in the last chapter.
n pScene and pNode are cameos from the next chapter, and they describe the
scene your game is drawing and the particular object being rendered by the
shader.
The vertex and index buffer are set, and then the primitive topology is set. The topol-
ogy in this example is a triangle list, but many others are also supported. The topol-
ogy defines how the indexes refer into your vertex buffer, and if you are clever, you
can use this to optimize the size of your index buffer or draw different primitives like
lines instead of triangles. Definitely look further into topics written specifically for
Direct3D 11 or into the samples to learn more.
Shaders—It's Just the Beginning
You
ve seen enough to be really dangerous in Direct3D 11 and perhaps even be dan-
gerous in any other renderer you choose, such as OpenGL. The concepts I presented
are the same. The only things different are the function calls, the coordinate systems,
the texturing support, how they expect your geometry, and so on. This chapter
'
'
s goal
was pretty aggressive, but even so I
ve only scratched the surface.
I suggest that you go play around a bit in Direct3D 11
'
'
s sample projects and get your
bearings. With what you learned, you ' ll probably be more at ease with them, and
maybe you won
t get as lost as I did when I first learned Direct3D 11. Even while
writing this topic, I spent plenty of hours cursing at E_INVALIDARG errors and
black screens. With any luck, you
'
ve got just enough knowledge in your head to per-
form some of your own twisting and cursing, but hopefully a little less that I did.
'
Further Reading
n Programming Vertex and Pixel Shaders, Wolfgang Engel
n Practical Rendering and Computation with Direct3D 11,
Jason Zink, Matt
Pettineo, Jack Hoxley
 
 
 
Search WWH ::




Custom Search