Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualJoyal

Posted 15 March 2013 - 07:42 AM

Since MS announced that they are not give more support to XNA , for me was an opportunity to start to learn DirectX , so i wanted to learn DX11,

i was following this tutorials 

 

http://www.rastertek.com/tutdx11.html

 

i want to build a simple 2D engine while im learning with basic thing,like render an sprite based on a spritesheet, ,animate it, scale, rotation, flip image

 

I started creating some simple basic structure, 

- Engine Class, this hold the initialization of the Window basically

- RenderManager class, this hold all the DX stuff, initialize it, create the swapchain, store the device , etc

 

So now my next step is create the Sprite class , i wanted to create an method called "Quad2D" inside my RenderManager, so i can use it on my render method in my sprite class

 

//This is not actual code, is just oh i want to approach this
class Sprite{

public void Render(RenderManager *rm){
  
    rm->Quad2D(Texture,Position,Width,Height);

}
}

i have some experience with OpenGL and Directx9 , it was easy to approach this, i just need to create an Array with the vertex, send to the VertexBuffer, bind the Texture, and done, 

 

but because now DX10 and DX11 not used fixed pipeline, and you need create this with more advanced stuff (Shaders),

i stopped in here http://www.rastertek.com/dx11tut11.html , i can see how to render the image and everything, but i was thinking, do i need to create an separate Class just to render a Quad? if so, this is going to compile the shader everytime is used?, well one solution maybe is just declare an static atribute for the ps and vs to share the same compile shader

 

so i want to hear your suggestion, how do you manage your Sprite class? 

 

if it necessary, i can attach my source code, but it doesnt has too much, just open a window

 

Note: i want to know how to do it in DX11, please dont reply, (used DX9,OpenGL,DX10, etc..)


#1Joyal

Posted 15 March 2013 - 07:28 AM

Since MS announced that they are not give more support to XNA , for me was an opportunity to start to learn DirectX , so i wanted to learn DX11,

i was following this tutorials 

 

http://www.rastertek.com/tutdx11.html

 

i want to build a simple 2D engine while im learning with basic thing,like render an sprite based on a spritesheet, ,animate it, scale, rotation, flip image

 

I started creating some simple basic structure, 

- Engine Class, this hold the initialization of the Window basically

- RenderManager class, this hold all the DX stuff, initialize it, create the swapchain, store the device , etc

 

So now my next step is create the Sprite class , i wanted to create an method called "Quad2D" inside my RenderManager, so i can use it on my render method in my sprite class

 

//This is not actual code, is just oh i want to approach this
class Sprite{

public void Render(RenderManager *rm){
  
    rm->Quad2D(Texture,Position,Width,Height);

}
}

i have some experience with OpenGL and Directx9 , it was easy to approach this, i just need to create an Array with the vertex, send to the VertexBuffer, bind the Texture, and done, 

 

but because now DX10 and DX11 not used fixed pipeline, and you need create this with more advanced stuff (Shaders),

i stopped in here http://www.rastertek.com/dx11tut11.html , i can see how to render the image and everything, but i was thinking, do i need to create an separate Class just to render a Quad? if so, this is going to compile the shader everytime is used?, well one solution maybe is just static to share the same compile shader

 

so i want to hear your suggestion, how do you manage your Sprite class? 

 

if it necessary, i can attach my source code, but it doesnt has too much, just open a window

 

Note: i want to know how to do it in DX11, please dont reply, (used DX9,OpenGL,DX10, etc..)

 

 


PARTNERS