fix rendering of very large maps
This commit is contained in:
@@ -273,14 +273,14 @@ namespace OpenRA.Renderer.Glsl
|
||||
public void DrawIndexedPrimitives( PrimitiveType pt, Range<int> vertices, Range<int> indices )
|
||||
{
|
||||
Gl.glDrawElements( ModeFromPrimitiveType( pt ), indices.End - indices.Start,
|
||||
Gl.GL_UNSIGNED_SHORT, new IntPtr( indices.Start * 2 ) );
|
||||
Gl.GL_UNSIGNED_INT, new IntPtr( indices.Start * 4 ) );
|
||||
CheckGlError();
|
||||
}
|
||||
|
||||
public void DrawIndexedPrimitives( PrimitiveType pt, int numVerts, int numPrimitives )
|
||||
{
|
||||
Gl.glDrawElements( ModeFromPrimitiveType( pt ), numPrimitives * IndicesPerPrimitive( pt ),
|
||||
Gl.GL_UNSIGNED_SHORT, IntPtr.Zero );
|
||||
Gl.glDrawElements( ModeFromPrimitiveType( pt ), numPrimitives * IndicesPerPrimitive( pt ),
|
||||
Gl.GL_UNSIGNED_INT, IntPtr.Zero);
|
||||
CheckGlError();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ using System;
|
||||
using OpenRA.FileFormats.Graphics;
|
||||
using Tao.OpenGl;
|
||||
|
||||
using ElemType = System.UInt32;
|
||||
|
||||
namespace OpenRA.Renderer.Glsl
|
||||
{
|
||||
public class IndexBuffer : IIndexBuffer, IDisposable
|
||||
@@ -24,18 +26,18 @@ namespace OpenRA.Renderer.Glsl
|
||||
GraphicsDevice.CheckGlError();
|
||||
Bind();
|
||||
Gl.glBufferData(Gl.GL_ELEMENT_ARRAY_BUFFER,
|
||||
new IntPtr(2 * size),
|
||||
new ushort[ size ],
|
||||
new IntPtr(sizeof(ElemType) * size),
|
||||
new ElemType[ size ],
|
||||
Gl.GL_DYNAMIC_DRAW);
|
||||
GraphicsDevice.CheckGlError();
|
||||
}
|
||||
|
||||
public void SetData(ushort[] data, int length)
|
||||
}
|
||||
|
||||
public void SetData(ElemType[] data, int length)
|
||||
{
|
||||
Bind();
|
||||
Gl.glBufferSubData(Gl.GL_ELEMENT_ARRAY_BUFFER,
|
||||
IntPtr.Zero,
|
||||
new IntPtr(2 * length),
|
||||
IntPtr.Zero,
|
||||
new IntPtr(sizeof(ElemType) * length),
|
||||
data);
|
||||
GraphicsDevice.CheckGlError();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user