Any Advice for Converting to 2D Rendering?

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Any Advice for Converting to 2D Rendering?

      I am thinking about using SDL to render 2D scenes instead of 3D. I plan on modifying the engine to accommodate this and adding support in the application layer because I plan on using emscripten to cross compile the game I make to be used on the web.

      Does anyone have any advice on how to best convert the engine to use 2D rendering? The reason I'm asking is because I want to try to use the best practices that were detailed in the book.

      I'm just not entirely sure what the biggest differences (in terms of engine architecture) that I should pay attention to when using a 2D renderer as opposed to a 3D renderer.

      If anyone could shed some light on this I would really appreciate it.
    • I have done just that, you will want to set up scene nodes for rendering textured quads (sprites), the way I went about the actor side was creating a sprite render component that gave you the interface for loading up a sprite and interfacing with it's scene node.
      PC - Custom Built
      CPU: 3rd Gen. Intel i7 3770 3.4Ghz
      GPU: ATI Radeon HD 7959 3GB
      RAM: 16GB

      Laptop - Alienware M17x
      CPU: 3rd Gen. Intel i7 - Ivy Bridge
      GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
      RAM: 8GB Dual Channel DDR3 @ 1600mhz
    • Yeah, you are going to have to sort your sprites as well, the book describes it for 3D and it is exactly the same in 2D, draw opaque sprites front to back, and translucent/transparent sprites back to front.

      You are also DEFINITELY going to want to batch your draw calls, my first attempt at sprite rendering was very slow, try to group your rendering together into categories, in the case of sprites, grouping them by texture will save alot of expensive texture switching by only binding the texture once, you can than use a vertex buffer to batch your vertices.

      Wait you said you are using SDL...so yeah none of that partains to SDL, but instead of erasing that I'll leave it in case it is helpful.
      PC - Custom Built
      CPU: 3rd Gen. Intel i7 3770 3.4Ghz
      GPU: ATI Radeon HD 7959 3GB
      RAM: 16GB

      Laptop - Alienware M17x
      CPU: 3rd Gen. Intel i7 - Ivy Bridge
      GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
      RAM: 8GB Dual Channel DDR3 @ 1600mhz