0

I currently have an image that is 16384px x 16384px I have broken this into 16 smaller images with the size of 4096px x 4096px and compressed them into DDS.

I have a 4x4 grid made up of 32 triangles (16 squares). At the moment I can assign 1 of the 16 textures to all the triangles with 1 set of UV coordinates.

Is the only way to use separate files is to have separate buffers? Which means I need 32 buffers in total, because I would need 1 for the vertexes and 1 for the UV's. That seems nuts. I can't seem to find any information on this problem at all.

  • Because only few quads will be visible, you should issue separate draw calls for the visible ones. Specify the appropriate texture each time. – Nico Schertler Jan 11 '14 at 09:44
  • Regarding your update: I haven't said anything about using multiple VBs. You can have all data in one VB (even position data and uv data) and draw only the necessary part. You could also use custom shaders to pick the correct texture or use 3d textures. But I don't see why this would be necessary. It might even be less performant. – Nico Schertler Jan 11 '14 at 12:37
  • I'm just not understanding what your saying. I thought you were just talking about not showing quads that weren't on screen in the first comment which I was going worry about later, I just want my quads to display my textures first. Are you saying I should just load 1 big image and divide it amongst the quads? I tried that, its too big and just crashes with memory exceptions when trying to load it. Otherwise I have no understand of what your conveying sorry. – The Empire Strikes Back Jan 11 '14 at 14:11
  • All draw methods take an offset and length parameter with which you can specify which part of the vertex buffer to draw. – Nico Schertler Jan 11 '14 at 15:25
  • Yeah I realized that after I went to bed, and your whole answer just clicked, I had forgotten about. Thanks for that, should fix my problem, if you want to throw that in answer, I'll mark it. – The Empire Strikes Back Jan 12 '14 at 00:34
  • Actually, glDrawElements doesn't appear to have the offset parameter? – The Empire Strikes Back Jan 12 '14 at 00:38
  • Actually I just found glDrawRangeElements. Think that should fix that problem. – The Empire Strikes Back Jan 12 '14 at 00:39
  • `GL.DrawElements(PrimitiveType.Triangles, 32 * 6, DrawElementsType.UnsignedShort, 0)` Works, but `GL.DrawRangeElements(PrimitiveType.Triangles, 0, indices.Length - 1, indices.Length, DrawElementsType.UnsignedShort, 0)` won't work, what am I doing wrong? – The Empire Strikes Back Jan 12 '14 at 01:48
  • Fixed it, had to change the last parameter to `New IntPtr(0)` – The Empire Strikes Back Jan 12 '14 at 02:03

0 Answers0