Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


#ActualSteve_Segreto

Posted 04 December 2012 - 12:01 AM

Hello Alan, welcome to Gamedev.
Answers to your questions:
1. DrawPrimitive() – it takes a buffer of vertices and draws the specified primitive (the first parameter). If you are rendering, for example, three triangles, DrawPrimitive() draws one triangle defined by points (counting from zero) 0, 1, 2, second triangle defined by points 3, 4, 5 and third triangle defined by 6, 7, 8. What the people tried to tell you is that you should put those points into one continuous (without gaps) buffer and call DrawPrimitive() once instead of calling it for every triangle.
2. Two different objects (like human or ball) should be drawn with one DrawPrimitive() each (there is a technique called instancing to go around that, but that is a very advanced topic). An important thing is that every object should (ideally) have only one texture, so you can draw it in one function call. It becomes problematic with more textures.


I would disagree with your statement that 2 different objects should be drawn with one Draw call each, especially if Alan is using 2-d rendering, in which case he might easily be able to create a Texture Atlas with all his textures on it and indeed organize his 2-d scene into 1 draw call instead of one for each tile.

#1Steve_Segreto

Posted 04 December 2012 - 12:00 AM

Hello Alan, welcome to Gamedev.
Answers to your questions:
1. DrawPrimitive() – it takes a buffer of vertices and draws the specified primitive (the first parameter). If you are rendering, for example, three triangles, DrawPrimitive() draws one triangle defined by points (counting from zero) 0, 1, 2, second triangle defined by points 3, 4, 5 and third triangle defined by 6, 7, 8. What the people tried to tell you is that you should put those points into one continuous (without gaps) buffer and call DrawPrimitive() once instead of calling it for every triangle.
2. Two different objects (like human or ball) should be drawn with one DrawPrimitive() each (there is a technique called instancing to go around that, but that is a very advanced topic). An important thing is that every object should (ideally) have only one texture, so you can draw it in one function call. It becomes problematic with more textures.


I would disagree with your statement that 2 different objects should be drawn with one Draw call each, especially if Alan is using 2-d rendering, in which case he might easily be able to create a Texture Atlas with all his textures on it and indeed organize his 2-d scene into 1 draw call.

PARTNERS