move GL20 object into GraphicsDevice object
This commit is contained in:
parent
ec724c78e5
commit
bd55407132
|
@ -46,7 +46,8 @@ namespace Blarg.GameFramework
|
|||
{
|
||||
Logger.Info(LOG_TAG, "Initializing application objects.");
|
||||
Services = new ServiceContainer();
|
||||
GraphicsDevice = new GraphicsDevice();
|
||||
GraphicsDevice = new GraphicsDevice(GL);
|
||||
GraphicsDevice.OnInit();
|
||||
}
|
||||
|
||||
protected void OnShutdown()
|
||||
|
|
|
@ -102,14 +102,14 @@ namespace Blarg.GameFramework.Graphics
|
|||
}
|
||||
|
||||
if (_providedRenderState != null)
|
||||
_providedRenderState.Apply();
|
||||
_providedRenderState.Apply(GraphicsDevice);
|
||||
else
|
||||
_defaultRenderState.Apply();
|
||||
_defaultRenderState.Apply(GraphicsDevice);
|
||||
|
||||
if (_providedBlendState != null)
|
||||
_providedBlendState.Apply();
|
||||
_providedBlendState.Apply(GraphicsDevice);
|
||||
else
|
||||
_defaultBlendState.Apply();
|
||||
_defaultBlendState.Apply(GraphicsDevice);
|
||||
|
||||
GraphicsDevice.BindShader(_shader);
|
||||
_shader.SetModelViewMatrix(GraphicsDevice.ViewContext.ModelViewMatrix);
|
||||
|
|
|
@ -50,11 +50,14 @@ namespace Blarg.GameFramework.Graphics
|
|||
DestinationBlendFactor = destinationFactor;
|
||||
}
|
||||
|
||||
public void Apply()
|
||||
public void Apply(GraphicsDevice graphicsDevice)
|
||||
{
|
||||
if (graphicsDevice == null)
|
||||
throw new ArgumentNullException("graphicsDevice");
|
||||
|
||||
if (Blending)
|
||||
{
|
||||
Platform.GL.glEnable(GL20.GL_BLEND);
|
||||
graphicsDevice.GL.glEnable(GL20.GL_BLEND);
|
||||
|
||||
var source = GL20.GL_ONE;
|
||||
var dest = GL20.GL_ZERO;
|
||||
|
@ -95,10 +98,10 @@ namespace Blarg.GameFramework.Graphics
|
|||
case BlendFactor.ConstantColor: dest = GL20.GL_CONSTANT_COLOR; break;
|
||||
}
|
||||
|
||||
Platform.GL.glBlendFunc(source, dest);
|
||||
graphicsDevice.GL.glBlendFunc(source, dest);
|
||||
}
|
||||
else
|
||||
Platform.GL.glDisable(GL20.GL_BLEND);
|
||||
graphicsDevice.GL.glDisable(GL20.GL_BLEND);
|
||||
}
|
||||
|
||||
private void Init()
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
var usage = GLUsageHint;
|
||||
var target = GLTarget;
|
||||
|
||||
Platform.GL.glBindBuffer(target, ID);
|
||||
Platform.GraphicsDevice.GL.glBindBuffer(target, ID);
|
||||
|
||||
if (SizeInBytes != currentSizeInBytes)
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
SizeInBytes = currentSizeInBytes;
|
||||
|
||||
// and then allocate + update
|
||||
Platform.GL.glBufferData<T>(target, SizeInBytes, Data, usage);
|
||||
Platform.GraphicsDevice.GL.glBufferData<T>(target, SizeInBytes, Data, usage);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -124,18 +124,18 @@ namespace Blarg.GameFramework.Graphics
|
|||
// previous contents allowing it to do some extra optimizations which is
|
||||
// fine since our glBufferSubData call is going to completely replace
|
||||
// the contents anyway
|
||||
Platform.GL.glBufferData(target, SizeInBytes, IntPtr.Zero, usage);
|
||||
Platform.GL.glBufferSubData<T>(target, 0, SizeInBytes, Data);
|
||||
Platform.GraphicsDevice.GL.glBufferData(target, SizeInBytes, IntPtr.Zero, usage);
|
||||
Platform.GraphicsDevice.GL.glBufferSubData<T>(target, 0, SizeInBytes, Data);
|
||||
}
|
||||
|
||||
Platform.GL.glBindBuffer(target, 0);
|
||||
Platform.GraphicsDevice.GL.glBindBuffer(target, 0);
|
||||
|
||||
IsDirty = false;
|
||||
}
|
||||
|
||||
protected void CreateBufferObject()
|
||||
{
|
||||
ID = Platform.GL.glGenBuffers();
|
||||
ID = Platform.GraphicsDevice.GL.glGenBuffers();
|
||||
|
||||
SizeBufferObject();
|
||||
|
||||
|
@ -148,7 +148,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (IsInvalidated)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
Platform.GL.glDeleteBuffers(ID);
|
||||
Platform.GraphicsDevice.GL.glDeleteBuffers(ID);
|
||||
|
||||
ID = -1;
|
||||
IsClientSide = true;
|
||||
|
@ -171,9 +171,9 @@ namespace Blarg.GameFramework.Graphics
|
|||
SizeInBytes = NumElements * ElementWidthInBytes;
|
||||
|
||||
// resize the buffer object without initializing it's data
|
||||
Platform.GL.glBindBuffer(target, ID);
|
||||
Platform.GL.glBufferData(target, SizeInBytes, IntPtr.Zero, usage);
|
||||
Platform.GL.glBindBuffer(target, 0);
|
||||
Platform.GraphicsDevice.GL.glBindBuffer(target, ID);
|
||||
Platform.GraphicsDevice.GL.glBufferData(target, SizeInBytes, IntPtr.Zero, usage);
|
||||
Platform.GraphicsDevice.GL.glBindBuffer(target, 0);
|
||||
|
||||
IsDirty = true;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (!IsInvalidated)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
ID = Platform.GL.glGenFramebuffers();
|
||||
ID = GraphicsDevice.GL.glGenFramebuffers();
|
||||
|
||||
_fixedWidth = width;
|
||||
_fixedHeight = height;
|
||||
|
@ -103,7 +103,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
texture.Value.Dispose();
|
||||
_attachedTextures.Clear();
|
||||
|
||||
Platform.GL.glDeleteFramebuffers(ID);
|
||||
GraphicsDevice.GL.glDeleteFramebuffers(ID);
|
||||
ID = -1;
|
||||
}
|
||||
if (GraphicsDevice.ViewContext == _attachedViewContext)
|
||||
|
@ -180,7 +180,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
GraphicsDevice.UnregisterManagedResource(texture);
|
||||
|
||||
GraphicsDevice.BindFramebuffer(this);
|
||||
Platform.GL.glFramebufferTexture2D(GL20.GL_FRAMEBUFFER, attachmentType, GL20.GL_TEXTURE_2D, texture.ID, 0);
|
||||
GraphicsDevice.GL.glFramebufferTexture2D(GL20.GL_FRAMEBUFFER, attachmentType, GL20.GL_TEXTURE_2D, texture.ID, 0);
|
||||
GraphicsDevice.UnbindFramebuffer(this);
|
||||
|
||||
_attachedTextures.Add(format, texture);
|
||||
|
@ -238,7 +238,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
GraphicsDevice.UnregisterManagedResource(renderbuffer);
|
||||
|
||||
GraphicsDevice.BindFramebuffer(this);
|
||||
Platform.GL.glFramebufferRenderbuffer(GL20.GL_FRAMEBUFFER, attachmentType,GL20.GL_RENDERBUFFER, renderbuffer.ID);
|
||||
GraphicsDevice.GL.glFramebufferRenderbuffer(GL20.GL_FRAMEBUFFER, attachmentType,GL20.GL_RENDERBUFFER, renderbuffer.ID);
|
||||
GraphicsDevice.UnbindFramebuffer(this);
|
||||
|
||||
_attachedRenderbuffers.Add(format, renderbuffer);
|
||||
|
@ -282,7 +282,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
}
|
||||
|
||||
GraphicsDevice.BindFramebuffer(this);
|
||||
Platform.GL.glFramebufferTexture2D(GL20.GL_FRAMEBUFFER, attachmentType, GL20.GL_TEXTURE_2D, 0, 0);
|
||||
GraphicsDevice.GL.glFramebufferTexture2D(GL20.GL_FRAMEBUFFER, attachmentType, GL20.GL_TEXTURE_2D, 0, 0);
|
||||
GraphicsDevice.UnbindFramebuffer(this);
|
||||
|
||||
_attachedTextures.Remove(format);
|
||||
|
@ -310,7 +310,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
}
|
||||
|
||||
GraphicsDevice.BindFramebuffer(this);
|
||||
Platform.GL.glFramebufferRenderbuffer(GL20.GL_FRAMEBUFFER, attachmentType, GL20.GL_RENDERBUFFER, 0);
|
||||
GraphicsDevice.GL.glFramebufferRenderbuffer(GL20.GL_FRAMEBUFFER, attachmentType, GL20.GL_RENDERBUFFER, 0);
|
||||
GraphicsDevice.UnbindFramebuffer(this);
|
||||
|
||||
_attachedRenderbuffers.Remove(format);
|
||||
|
@ -357,7 +357,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
GraphicsDevice.UnregisterManagedResource(newTexture);
|
||||
|
||||
GraphicsDevice.BindFramebuffer(this);
|
||||
Platform.GL.glFramebufferTexture2D(GL20.GL_FRAMEBUFFER, attachmentType, GL20.GL_TEXTURE_2D, newTexture.ID, 0);
|
||||
GraphicsDevice.GL.glFramebufferTexture2D(GL20.GL_FRAMEBUFFER, attachmentType, GL20.GL_TEXTURE_2D, newTexture.ID, 0);
|
||||
GraphicsDevice.UnbindFramebuffer(this);
|
||||
|
||||
_attachedTextures[key] = newTexture;
|
||||
|
@ -395,7 +395,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
GraphicsDevice.UnregisterManagedResource(newRenderbuffer);
|
||||
|
||||
GraphicsDevice.BindFramebuffer(this);
|
||||
Platform.GL.glFramebufferRenderbuffer(GL20.GL_FRAMEBUFFER, attachmentType, GL20.GL_RENDERBUFFER, newRenderbuffer.ID);
|
||||
GraphicsDevice.GL.glFramebufferRenderbuffer(GL20.GL_FRAMEBUFFER, attachmentType, GL20.GL_RENDERBUFFER, newRenderbuffer.ID);
|
||||
GraphicsDevice.UnbindFramebuffer(this);
|
||||
|
||||
_attachedRenderbuffers[key] = newRenderbuffer;
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
shader.SetModelViewMatrix(ref modelView);
|
||||
shader.SetProjectionMatrix(ref projection);
|
||||
|
||||
_renderState.Apply();
|
||||
_renderState.Apply(GraphicsDevice);
|
||||
|
||||
GraphicsDevice.BindVertexBuffer(_vertices);
|
||||
GraphicsDevice.RenderLines(0, numLinesToRender);
|
||||
|
|
|
@ -17,6 +17,8 @@ namespace Blarg.GameFramework.Graphics
|
|||
const int SolidColorTextureWidth = 8;
|
||||
const int SolidColorTextureHeight = 8;
|
||||
|
||||
public readonly GL20 GL;
|
||||
|
||||
List<GraphicsContextResource> _managedResources;
|
||||
Dictionary<int, Texture> _solidColorTextures;
|
||||
VertexBuffer _boundVertexBuffer;
|
||||
|
@ -72,18 +74,46 @@ namespace Blarg.GameFramework.Graphics
|
|||
}
|
||||
}
|
||||
|
||||
public GraphicsDevice()
|
||||
public GraphicsDevice(GL20 gl)
|
||||
{
|
||||
ScreenOrientation = ScreenOrientation.Rotation0;
|
||||
if (gl == null)
|
||||
throw new ArgumentNullException("gl");
|
||||
|
||||
GL = gl;
|
||||
ScreenOrientation = ScreenOrientation.Rotation0;
|
||||
}
|
||||
|
||||
private void LoadStandardShaders()
|
||||
{
|
||||
DebugShader = new DebugShader(this);
|
||||
SimpleColorShader = new SimpleColorShader(this);
|
||||
SimpleColorTextureShader = new SimpleColorTextureShader(this);
|
||||
SimpleTextureShader = new SimpleTextureShader(this);
|
||||
SimpleTextureVertexLerpShader = new SimpleTextureVertexLerpShader(this);
|
||||
SimpleTextureVertexSkinningShader = new SimpleTextureVertexSkinningShader(this);
|
||||
Sprite2DShader = new Sprite2DShader(this);
|
||||
Sprite3DShader = new Sprite3DShader(this);
|
||||
}
|
||||
|
||||
private void LoadStandardFonts()
|
||||
{
|
||||
var sansSerifFontStream = ResourceUtils.GetResource("Blarg.GameFramework.Resources.Fonts.Vera.ttf");
|
||||
SansSerifFont = SpriteFontTrueTypeLoader.Load(this, sansSerifFontStream, 16, SansSerifFont);
|
||||
|
||||
var monospaceFontStream = ResourceUtils.GetResource("Blarg.GameFramework.Resources.Fonts.VeraMono.ttf");
|
||||
MonospaceFont = SpriteFontTrueTypeLoader.Load(this, monospaceFontStream, 16, MonospaceFont);
|
||||
}
|
||||
|
||||
public void OnInit()
|
||||
{
|
||||
_boundTextures = new Texture[MaxTextureUnits];
|
||||
_enabledVertexAttribIndices = new Stack<int>(MaxGpuAttributeSlots);
|
||||
|
||||
string vendor = Platform.GL.glGetString(GL20.GL_VENDOR);
|
||||
string renderer = Platform.GL.glGetString(GL20.GL_RENDERER);
|
||||
string version = Platform.GL.glGetString(GL20.GL_VERSION);
|
||||
string extensions = Platform.GL.glGetString(GL20.GL_EXTENSIONS);
|
||||
string shadingLangVersion = Platform.GL.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION);
|
||||
string vendor = GL.glGetString(GL20.GL_VENDOR);
|
||||
string renderer = GL.glGetString(GL20.GL_RENDERER);
|
||||
string version = GL.glGetString(GL20.GL_VERSION);
|
||||
string extensions = GL.glGetString(GL20.GL_EXTENSIONS);
|
||||
string shadingLangVersion = GL.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION);
|
||||
|
||||
Platform.Logger.Info(LOG_TAG, "GL_VENDOR = {0}", vendor);
|
||||
Platform.Logger.Info(LOG_TAG, "GL_RENDERER = {0}", renderer);
|
||||
|
@ -119,27 +149,6 @@ namespace Blarg.GameFramework.Graphics
|
|||
DebugRenderer = new GeometryDebugRenderer(this);
|
||||
}
|
||||
|
||||
private void LoadStandardShaders()
|
||||
{
|
||||
DebugShader = new DebugShader(this);
|
||||
SimpleColorShader = new SimpleColorShader(this);
|
||||
SimpleColorTextureShader = new SimpleColorTextureShader(this);
|
||||
SimpleTextureShader = new SimpleTextureShader(this);
|
||||
SimpleTextureVertexLerpShader = new SimpleTextureVertexLerpShader(this);
|
||||
SimpleTextureVertexSkinningShader = new SimpleTextureVertexSkinningShader(this);
|
||||
Sprite2DShader = new Sprite2DShader(this);
|
||||
Sprite3DShader = new Sprite3DShader(this);
|
||||
}
|
||||
|
||||
private void LoadStandardFonts()
|
||||
{
|
||||
var sansSerifFontStream = ResourceUtils.GetResource("Blarg.GameFramework.Resources.Fonts.Vera.ttf");
|
||||
SansSerifFont = SpriteFontTrueTypeLoader.Load(this, sansSerifFontStream, 16, SansSerifFont);
|
||||
|
||||
var monospaceFontStream = ResourceUtils.GetResource("Blarg.GameFramework.Resources.Fonts.VeraMono.ttf");
|
||||
MonospaceFont = SpriteFontTrueTypeLoader.Load(this, monospaceFontStream, 16, MonospaceFont);
|
||||
}
|
||||
|
||||
public void OnLostContext()
|
||||
{
|
||||
Platform.Logger.Info(LOG_TAG, "Cleaning up objects/state specific to the lost OpenGL context.");
|
||||
|
@ -160,8 +169,8 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
_activeViewContext.OnNewContext();
|
||||
|
||||
RenderState.Default.Apply();
|
||||
BlendState.Default.Apply();
|
||||
RenderState.Default.Apply(this);
|
||||
BlendState.Default.Apply(this);
|
||||
|
||||
UnbindVertexBuffer();
|
||||
UnbindIndexBuffer();
|
||||
|
@ -203,14 +212,14 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
public void OnRender(float delta)
|
||||
{
|
||||
int error = Platform.GL.glGetError();
|
||||
int error = GL.glGetError();
|
||||
System.Diagnostics.Debug.Assert(error == GL20.GL_NO_ERROR);
|
||||
if (error != GL20.GL_NO_ERROR)
|
||||
{
|
||||
Platform.Logger.Error("OPENGL", "OpenGL error \"{0}\"", error.ToString());
|
||||
|
||||
// keep checking for and reporting errors until there are no more left
|
||||
while ((error = Platform.GL.glGetError()) != GL20.GL_NO_ERROR)
|
||||
while ((error = GL.glGetError()) != GL20.GL_NO_ERROR)
|
||||
Platform.Logger.Error("OPENGL", "OpenGL error \"{0}\"", error.ToString());
|
||||
}
|
||||
|
||||
|
@ -231,7 +240,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
{
|
||||
var color = new Color(r, g, b, a);
|
||||
Clear(ref color);
|
||||
Platform.GL.glClearColor(r, g, b, a);
|
||||
GL.glClearColor(r, g, b, a);
|
||||
}
|
||||
|
||||
public void Clear(Color color)
|
||||
|
@ -241,8 +250,8 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
public void Clear(ref Color color)
|
||||
{
|
||||
Platform.GL.glClearColor(color.R, color.G, color.B, color.A);
|
||||
Platform.GL.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
|
||||
GL.glClearColor(color.R, color.G, color.B, color.A);
|
||||
GL.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
public void SetTextureParameters(TextureParameters parameters)
|
||||
|
@ -315,8 +324,8 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
if (texture != _boundTextures[unit])
|
||||
{
|
||||
Platform.GL.glActiveTexture(GL20.GL_TEXTURE0 + unit);
|
||||
Platform.GL.glBindTexture(GL20.GL_TEXTURE_2D, texture.ID);
|
||||
GL.glActiveTexture(GL20.GL_TEXTURE0 + unit);
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, texture.ID);
|
||||
|
||||
_boundTextures[unit] = texture;
|
||||
}
|
||||
|
@ -327,8 +336,8 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (unit < 0 || unit >= MaxTextureUnits)
|
||||
throw new ArgumentOutOfRangeException("unit");
|
||||
|
||||
Platform.GL.glActiveTexture(GL20.GL_TEXTURE0 + unit);
|
||||
Platform.GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
GL.glActiveTexture(GL20.GL_TEXTURE0 + unit);
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
|
||||
_boundTextures[unit] = null;
|
||||
}
|
||||
|
@ -352,14 +361,14 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
if (_boundRenderbuffer != renderbuffer)
|
||||
{
|
||||
Platform.GL.glBindRenderbuffer(GL20.GL_RENDERBUFFER, renderbuffer.ID);
|
||||
GL.glBindRenderbuffer(GL20.GL_RENDERBUFFER, renderbuffer.ID);
|
||||
_boundRenderbuffer = renderbuffer;
|
||||
}
|
||||
}
|
||||
|
||||
public void UnbindRenderbuffer()
|
||||
{
|
||||
Platform.GL.glBindRenderbuffer(GL20.GL_RENDERBUFFER, 0);
|
||||
GL.glBindRenderbuffer(GL20.GL_RENDERBUFFER, 0);
|
||||
_boundRenderbuffer = null;
|
||||
}
|
||||
|
||||
|
@ -379,14 +388,14 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
if (_boundFramebuffer != framebuffer)
|
||||
{
|
||||
Platform.GL.glBindFramebuffer(GL20.GL_FRAMEBUFFER, framebuffer.ID);
|
||||
GL.glBindFramebuffer(GL20.GL_FRAMEBUFFER, framebuffer.ID);
|
||||
_boundFramebuffer = framebuffer;
|
||||
}
|
||||
}
|
||||
|
||||
public void UnbindFramebuffer()
|
||||
{
|
||||
Platform.GL.glBindFramebuffer(GL20.GL_FRAMEBUFFER, 0);
|
||||
GL.glBindFramebuffer(GL20.GL_FRAMEBUFFER, 0);
|
||||
_boundFramebuffer = null;
|
||||
}
|
||||
|
||||
|
@ -422,7 +431,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
public void UnbindVertexBuffer()
|
||||
{
|
||||
Platform.GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
|
||||
GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
|
||||
_boundVertexBuffer = null;
|
||||
|
||||
if (_isShaderVertexAttribsSet)
|
||||
|
@ -434,12 +443,12 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (buffer.IsDirty)
|
||||
buffer.Update();
|
||||
|
||||
Platform.GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, buffer.ID);
|
||||
GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, buffer.ID);
|
||||
}
|
||||
|
||||
private void BindVertexClientArrays(VertexBuffer buffer)
|
||||
{
|
||||
Platform.GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
|
||||
GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
public void BindIndexBuffer(IndexBuffer buffer)
|
||||
|
@ -462,7 +471,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
public void UnbindIndexBuffer()
|
||||
{
|
||||
Platform.GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
_boundIndexBuffer = null;
|
||||
}
|
||||
|
||||
|
@ -471,12 +480,12 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (buffer.IsDirty)
|
||||
buffer.Update();
|
||||
|
||||
Platform.GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, buffer.ID);
|
||||
GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, buffer.ID);
|
||||
}
|
||||
|
||||
private void BindIndexClientArray(IndexBuffer buffer)
|
||||
{
|
||||
Platform.GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
public void BindShader(Shader shader)
|
||||
|
@ -486,7 +495,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (!shader.IsReadyForUse)
|
||||
throw new InvalidOperationException("Shader hasn't been compiled and linked.");
|
||||
|
||||
Platform.GL.glUseProgram(shader.ProgramID);
|
||||
GL.glUseProgram(shader.ProgramID);
|
||||
_boundShader = shader;
|
||||
|
||||
if (_isShaderVertexAttribsSet)
|
||||
|
@ -497,7 +506,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
public void UnbindShader()
|
||||
{
|
||||
Platform.GL.glUseProgram(0);
|
||||
GL.glUseProgram(0);
|
||||
|
||||
if (_boundShader != null)
|
||||
_boundShader.OnUnbind();
|
||||
|
@ -537,7 +546,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
offset = _boundVertexBuffer.GetAttributeOffset(bufferAttribIndex);
|
||||
size = _boundVertexBuffer.GetAttributeSize(bufferAttribIndex);
|
||||
|
||||
Platform.GL.glEnableVertexAttribArray(i);
|
||||
GL.glEnableVertexAttribArray(i);
|
||||
if (_boundVertexBuffer.IsClientSide)
|
||||
{
|
||||
// pass reference to the first vertex and the first float within that vertex that is for this attribute
|
||||
|
@ -546,14 +555,14 @@ namespace Blarg.GameFramework.Graphics
|
|||
fixed (float *p = _boundVertexBuffer.Data)
|
||||
{
|
||||
float *src = p + offset;
|
||||
Platform.GL.glVertexAttribPointer(i, size, GL20.GL_FLOAT, false, _boundVertexBuffer.ElementWidthInBytes, new IntPtr((long)src));
|
||||
GL.glVertexAttribPointer(i, size, GL20.GL_FLOAT, false, _boundVertexBuffer.ElementWidthInBytes, new IntPtr((long)src));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
// pass offset in bytes (starting from zero) that corresponds with the start of this attribute
|
||||
Platform.GL.glVertexAttribPointer(i, size, GL20.GL_FLOAT, false, _boundVertexBuffer.ElementWidthInBytes, (IntPtr)(offset * sizeof(float)));
|
||||
GL.glVertexAttribPointer(i, size, GL20.GL_FLOAT, false, _boundVertexBuffer.ElementWidthInBytes, (IntPtr)(offset * sizeof(float)));
|
||||
|
||||
_enabledVertexAttribIndices.Push(i);
|
||||
}
|
||||
|
@ -566,7 +575,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
while (_enabledVertexAttribIndices.Count > 0)
|
||||
{
|
||||
int index = _enabledVertexAttribIndices.Pop();
|
||||
Platform.GL.glDisableVertexAttribArray(index);
|
||||
GL.glDisableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
_isShaderVertexAttribsSet = false;
|
||||
|
@ -605,7 +614,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (numVertices % 3 != 0)
|
||||
throw new InvalidOperationException("Number of elements in index buffer do not perfectly make up a set of triangles.");
|
||||
|
||||
Platform.GL.glDrawElements(GL20.GL_TRIANGLES, numVertices, GL20.GL_UNSIGNED_SHORT, buffer.Data);
|
||||
GL.glDrawElements(GL20.GL_TRIANGLES, numVertices, GL20.GL_UNSIGNED_SHORT, buffer.Data);
|
||||
}
|
||||
|
||||
public void RenderTriangles()
|
||||
|
@ -624,9 +633,9 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new InvalidOperationException("Number of elements in bound index buffer do not perfectly make up a set of triangles.");
|
||||
|
||||
if (_boundIndexBuffer.IsClientSide)
|
||||
Platform.GL.glDrawElements(GL20.GL_TRIANGLES, numVertices, GL20.GL_UNSIGNED_SHORT, _boundIndexBuffer.Data);
|
||||
GL.glDrawElements(GL20.GL_TRIANGLES, numVertices, GL20.GL_UNSIGNED_SHORT, _boundIndexBuffer.Data);
|
||||
else
|
||||
Platform.GL.glDrawElements(GL20.GL_TRIANGLES, numVertices, GL20.GL_UNSIGNED_SHORT, (IntPtr)0);
|
||||
GL.glDrawElements(GL20.GL_TRIANGLES, numVertices, GL20.GL_UNSIGNED_SHORT, (IntPtr)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -635,7 +644,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (numVertices % 3 != 0)
|
||||
throw new InvalidOperationException("Number of vertices in bound vertex buffer do not perfectly make up a set of triangles.");
|
||||
|
||||
Platform.GL.glDrawArrays(GL20.GL_TRIANGLES, 0, numVertices);
|
||||
GL.glDrawArrays(GL20.GL_TRIANGLES, 0, numVertices);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -662,7 +671,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
fixed (ushort *p = _boundIndexBuffer.Data)
|
||||
{
|
||||
ushort *src = p + startVertex;
|
||||
Platform.GL.glDrawElements(GL20.GL_TRIANGLES, numVertices, GL20.GL_UNSIGNED_SHORT, new IntPtr((long)src));
|
||||
GL.glDrawElements(GL20.GL_TRIANGLES, numVertices, GL20.GL_UNSIGNED_SHORT, new IntPtr((long)src));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -670,7 +679,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
{
|
||||
// this offset needs to be in terms of bytes
|
||||
int offset = startVertex * _boundIndexBuffer.ElementWidthInBytes;
|
||||
Platform.GL.glDrawElements(GL20.GL_TRIANGLES, numVertices, GL20.GL_UNSIGNED_SHORT, (IntPtr)offset);
|
||||
GL.glDrawElements(GL20.GL_TRIANGLES, numVertices, GL20.GL_UNSIGNED_SHORT, (IntPtr)offset);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -679,7 +688,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if ((_boundVertexBuffer.NumElements - startVertex) < numVertices)
|
||||
throw new InvalidOperationException("Bound vertex buffer does not contain enough vertices.");
|
||||
|
||||
Platform.GL.glDrawArrays(GL20.GL_TRIANGLES, startVertex, numVertices);
|
||||
GL.glDrawArrays(GL20.GL_TRIANGLES, startVertex, numVertices);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -701,7 +710,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (numVertices % 2 != 0)
|
||||
throw new InvalidOperationException("Number of elements in index buffer do not perfectly make up a set of lines.");
|
||||
|
||||
Platform.GL.glDrawElements(GL20.GL_LINES, numVertices, GL20.GL_UNSIGNED_SHORT, buffer.Data);
|
||||
GL.glDrawElements(GL20.GL_LINES, numVertices, GL20.GL_UNSIGNED_SHORT, buffer.Data);
|
||||
}
|
||||
|
||||
public void RenderLines()
|
||||
|
@ -720,9 +729,9 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new InvalidOperationException("Number of elements in bound index buffer do not perfectly make up a set of lines.");
|
||||
|
||||
if (_boundIndexBuffer.IsClientSide)
|
||||
Platform.GL.glDrawElements(GL20.GL_LINES, numVertices, GL20.GL_UNSIGNED_SHORT, _boundIndexBuffer.Data);
|
||||
GL.glDrawElements(GL20.GL_LINES, numVertices, GL20.GL_UNSIGNED_SHORT, _boundIndexBuffer.Data);
|
||||
else
|
||||
Platform.GL.glDrawElements(GL20.GL_LINES, numVertices, GL20.GL_UNSIGNED_SHORT, (IntPtr)0);
|
||||
GL.glDrawElements(GL20.GL_LINES, numVertices, GL20.GL_UNSIGNED_SHORT, (IntPtr)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -731,7 +740,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (numVertices % 2 != 0)
|
||||
throw new InvalidOperationException("Number of vertices in bound vertex buffer do not perfectly make up a set of lines.");
|
||||
|
||||
Platform.GL.glDrawArrays(GL20.GL_LINES, 0, numVertices);
|
||||
GL.glDrawArrays(GL20.GL_LINES, 0, numVertices);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -758,7 +767,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
fixed (ushort *p = _boundIndexBuffer.Data)
|
||||
{
|
||||
ushort *src = p + startVertex;
|
||||
Platform.GL.glDrawElements(GL20.GL_LINES, numVertices, GL20.GL_UNSIGNED_SHORT, new IntPtr((long)src));
|
||||
GL.glDrawElements(GL20.GL_LINES, numVertices, GL20.GL_UNSIGNED_SHORT, new IntPtr((long)src));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -766,7 +775,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
{
|
||||
// this offset needs to be in terms of bytes
|
||||
int offset = startVertex * _boundIndexBuffer.ElementWidthInBytes;
|
||||
Platform.GL.glDrawElements(GL20.GL_LINES, numVertices, GL20.GL_UNSIGNED_SHORT, (IntPtr)offset);
|
||||
GL.glDrawElements(GL20.GL_LINES, numVertices, GL20.GL_UNSIGNED_SHORT, (IntPtr)offset);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -775,7 +784,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if ((_boundVertexBuffer.NumElements - startVertex) < numVertices)
|
||||
throw new InvalidOperationException("Bound vertex buffer does not contain enough vertices.");
|
||||
|
||||
Platform.GL.glDrawArrays(GL20.GL_LINES, startVertex, numVertices);
|
||||
GL.glDrawArrays(GL20.GL_LINES, startVertex, numVertices);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -795,7 +804,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
int numVertices = buffer.NumElements;
|
||||
|
||||
Platform.GL.glDrawElements(GL20.GL_POINTS, numVertices, GL20.GL_UNSIGNED_SHORT, buffer.Data);
|
||||
GL.glDrawElements(GL20.GL_POINTS, numVertices, GL20.GL_UNSIGNED_SHORT, buffer.Data);
|
||||
}
|
||||
|
||||
public void RenderPoints()
|
||||
|
@ -812,16 +821,16 @@ namespace Blarg.GameFramework.Graphics
|
|||
int numVertices = _boundIndexBuffer.NumElements;
|
||||
|
||||
if (_boundIndexBuffer.IsClientSide)
|
||||
Platform.GL.glDrawElements(GL20.GL_POINTS, numVertices, GL20.GL_UNSIGNED_SHORT, _boundIndexBuffer.Data);
|
||||
GL.glDrawElements(GL20.GL_POINTS, numVertices, GL20.GL_UNSIGNED_SHORT, _boundIndexBuffer.Data);
|
||||
else
|
||||
Platform.GL.glDrawElements(GL20.GL_POINTS, numVertices, GL20.GL_UNSIGNED_SHORT, (IntPtr)0);
|
||||
GL.glDrawElements(GL20.GL_POINTS, numVertices, GL20.GL_UNSIGNED_SHORT, (IntPtr)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// no index buffer, just render the whole vertex buffer
|
||||
int numVertices = _boundVertexBuffer.NumElements;
|
||||
|
||||
Platform.GL.glDrawArrays(GL20.GL_POINTS, 0, numVertices);
|
||||
GL.glDrawArrays(GL20.GL_POINTS, 0, numVertices);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -846,7 +855,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
fixed (ushort *p = _boundIndexBuffer.Data)
|
||||
{
|
||||
ushort *src = p + startVertex;
|
||||
Platform.GL.glDrawElements(GL20.GL_POINTS, numPoints, GL20.GL_UNSIGNED_SHORT, new IntPtr((long)src));
|
||||
GL.glDrawElements(GL20.GL_POINTS, numPoints, GL20.GL_UNSIGNED_SHORT, new IntPtr((long)src));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -854,7 +863,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
{
|
||||
// this offset needs to be in terms of bytes
|
||||
int offset = startVertex * _boundIndexBuffer.ElementWidthInBytes;
|
||||
Platform.GL.glDrawElements(GL20.GL_POINTS, numPoints, GL20.GL_UNSIGNED_SHORT, (IntPtr)offset);
|
||||
GL.glDrawElements(GL20.GL_POINTS, numPoints, GL20.GL_UNSIGNED_SHORT, (IntPtr)offset);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -863,7 +872,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if ((_boundVertexBuffer.NumElements - startVertex) < numPoints)
|
||||
throw new InvalidOperationException("Bound vertex buffer does not contain enough vertices.");
|
||||
|
||||
Platform.GL.glDrawArrays(GL20.GL_POINTS, startVertex, numPoints);
|
||||
GL.glDrawArrays(GL20.GL_POINTS, startVertex, numPoints);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace Blarg.GameFramework.Graphics.Helpers
|
|||
|
||||
public void Render()
|
||||
{
|
||||
RenderState.Default.Apply();
|
||||
RenderState.Default.Apply(GraphicsDevice);
|
||||
|
||||
GraphicsDevice.BindVertexBuffer(_horizontalPoints);
|
||||
GraphicsDevice.RenderLines(0, _horizontalPoints.NumElements / 2);
|
||||
|
|
|
@ -50,11 +50,14 @@ namespace Blarg.GameFramework.Graphics
|
|||
Init();
|
||||
}
|
||||
|
||||
public void Apply()
|
||||
public void Apply(GraphicsDevice graphicsDevice)
|
||||
{
|
||||
if (graphicsDevice == null)
|
||||
throw new ArgumentNullException("graphicsDevice");
|
||||
|
||||
if (DepthTesting)
|
||||
{
|
||||
Platform.GL.glEnable(GL20.GL_DEPTH_TEST);
|
||||
graphicsDevice.GL.glEnable(GL20.GL_DEPTH_TEST);
|
||||
|
||||
int depthFunc = GL20.GL_LESS;
|
||||
switch (DepthFunc)
|
||||
|
@ -68,25 +71,25 @@ namespace Blarg.GameFramework.Graphics
|
|||
case DepthFunc.GreaterOrEqual: depthFunc = GL20.GL_GEQUAL; break;
|
||||
case DepthFunc.Always: depthFunc = GL20.GL_ALWAYS; break;
|
||||
}
|
||||
Platform.GL.glDepthFunc(depthFunc);
|
||||
graphicsDevice.GL.glDepthFunc(depthFunc);
|
||||
}
|
||||
else
|
||||
Platform.GL.glDisable(GL20.GL_DEPTH_TEST);
|
||||
graphicsDevice.GL.glDisable(GL20.GL_DEPTH_TEST);
|
||||
|
||||
if (FaceCulling)
|
||||
{
|
||||
Platform.GL.glEnable(GL20.GL_CULL_FACE);
|
||||
graphicsDevice.GL.glEnable(GL20.GL_CULL_FACE);
|
||||
if (FaceCullingMode == CullMode.FrontAndBack)
|
||||
Platform.GL.glCullFace(GL20.GL_FRONT_AND_BACK);
|
||||
graphicsDevice.GL.glCullFace(GL20.GL_FRONT_AND_BACK);
|
||||
else if (FaceCullingMode == CullMode.Front)
|
||||
Platform.GL.glCullFace(GL20.GL_FRONT);
|
||||
graphicsDevice.GL.glCullFace(GL20.GL_FRONT);
|
||||
else
|
||||
Platform.GL.glCullFace(GL20.GL_BACK);
|
||||
graphicsDevice.GL.glCullFace(GL20.GL_BACK);
|
||||
}
|
||||
else
|
||||
Platform.GL.glDisable(GL20.GL_CULL_FACE);
|
||||
graphicsDevice.GL.glDisable(GL20.GL_CULL_FACE);
|
||||
|
||||
Platform.GL.glLineWidth(LineWidth);
|
||||
graphicsDevice.GL.glLineWidth(LineWidth);
|
||||
}
|
||||
|
||||
private void Init()
|
||||
|
|
|
@ -64,14 +64,14 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (glFormat == 0)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
ID = Platform.GL.glGenRenderbuffers();
|
||||
ID = GraphicsDevice.GL.glGenRenderbuffers();
|
||||
|
||||
Width = width;
|
||||
Height = height;
|
||||
Format = format;
|
||||
|
||||
GraphicsDevice.BindRenderbuffer(this);
|
||||
Platform.GL.glRenderbufferStorage(GL20.GL_RENDERBUFFER, glFormat, Width, Height);
|
||||
GraphicsDevice.GL.glRenderbufferStorage(GL20.GL_RENDERBUFFER, glFormat, Width, Height);
|
||||
GraphicsDevice.UnbindRenderbuffer(this);
|
||||
|
||||
Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Created renderbuffer. ID = {0}, format = {1}, size = {2}x{3}.", ID, Format.ToString(), Width, Height);
|
||||
|
@ -95,7 +95,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
{
|
||||
GraphicsDevice.UnbindRenderbuffer(this);
|
||||
|
||||
Platform.GL.glDeleteRenderbuffers(ID);
|
||||
GraphicsDevice.GL.glDeleteRenderbuffers(ID);
|
||||
|
||||
Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Deleted Renderbuffer ID = {0}.", ID);
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
// first load and compile the vertex shader
|
||||
|
||||
int vertexShaderId = Platform.GL.glCreateShader(GL20.GL_VERTEX_SHADER);
|
||||
int vertexShaderId = GraphicsDevice.GL.glCreateShader(GL20.GL_VERTEX_SHADER);
|
||||
if (vertexShaderId == 0)
|
||||
throw new Exception("Failed to create OpenGL Vertex Shader object.");
|
||||
|
||||
|
@ -169,10 +169,10 @@ namespace Blarg.GameFramework.Graphics
|
|||
string[] vertexSources = { "#define VERTEX\n", vertexShaderSource };
|
||||
int[] vertexSourcesLength = { vertexSources[0].Length, vertexSources[1].Length };
|
||||
|
||||
Platform.GL.glShaderSource(vertexShaderId, 2, vertexSources, vertexSourcesLength);
|
||||
Platform.GL.glCompileShader(vertexShaderId);
|
||||
GraphicsDevice.GL.glShaderSource(vertexShaderId, 2, vertexSources, vertexSourcesLength);
|
||||
GraphicsDevice.GL.glCompileShader(vertexShaderId);
|
||||
|
||||
int vertexShaderCompileStatus = Platform.GL.glGetShaderiv(vertexShaderId, GL20.GL_COMPILE_STATUS);
|
||||
int vertexShaderCompileStatus = GraphicsDevice.GL.glGetShaderiv(vertexShaderId, GL20.GL_COMPILE_STATUS);
|
||||
|
||||
// log compiler error
|
||||
if (vertexShaderCompileStatus == 0)
|
||||
|
@ -183,7 +183,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
// and now the fragment shader
|
||||
|
||||
int fragmentShaderId = Platform.GL.glCreateShader(GL20.GL_FRAGMENT_SHADER);
|
||||
int fragmentShaderId = GraphicsDevice.GL.glCreateShader(GL20.GL_FRAGMENT_SHADER);
|
||||
if (fragmentShaderId == 0)
|
||||
throw new Exception("Failed to create OpenGL Fragment Shader object.");
|
||||
|
||||
|
@ -192,10 +192,10 @@ namespace Blarg.GameFramework.Graphics
|
|||
string[] fragmentSources = { "#define FRAGMENT\n", fragmentShaderSource };
|
||||
int[] fragmentSourcesLength = { fragmentSources[0].Length, fragmentSources[1].Length };
|
||||
|
||||
Platform.GL.glShaderSource(fragmentShaderId, 2, fragmentSources, fragmentSourcesLength);
|
||||
Platform.GL.glCompileShader(fragmentShaderId);
|
||||
GraphicsDevice.GL.glShaderSource(fragmentShaderId, 2, fragmentSources, fragmentSourcesLength);
|
||||
GraphicsDevice.GL.glCompileShader(fragmentShaderId);
|
||||
|
||||
int fragmentShaderCompileStatus = Platform.GL.glGetShaderiv(fragmentShaderId, GL20.GL_COMPILE_STATUS);
|
||||
int fragmentShaderCompileStatus = GraphicsDevice.GL.glGetShaderiv(fragmentShaderId, GL20.GL_COMPILE_STATUS);
|
||||
|
||||
// log compiler error
|
||||
if (fragmentShaderCompileStatus == 0)
|
||||
|
@ -218,7 +218,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
private string GetShaderLog(int shaderId)
|
||||
{
|
||||
return Platform.GL.glGetShaderInfoLog(shaderId);
|
||||
return GraphicsDevice.GL.glGetShaderInfoLog(shaderId);
|
||||
}
|
||||
|
||||
private void Link()
|
||||
|
@ -228,20 +228,20 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (VertexShaderID == -1 || FragmentShaderID == -1)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
int programId = Platform.GL.glCreateProgram();
|
||||
int programId = GraphicsDevice.GL.glCreateProgram();
|
||||
if (programId == 0)
|
||||
throw new Exception("Failed to create OpenGL Shader Program object.");
|
||||
|
||||
Platform.GL.glAttachShader(programId, VertexShaderID);
|
||||
Platform.GL.glAttachShader(programId, FragmentShaderID);
|
||||
Platform.GL.glLinkProgram(programId);
|
||||
GraphicsDevice.GL.glAttachShader(programId, VertexShaderID);
|
||||
GraphicsDevice.GL.glAttachShader(programId, FragmentShaderID);
|
||||
GraphicsDevice.GL.glLinkProgram(programId);
|
||||
|
||||
int programLinkStatus = Platform.GL.glGetProgramiv(programId, GL20.GL_LINK_STATUS);
|
||||
int programLinkStatus = GraphicsDevice.GL.glGetProgramiv(programId, GL20.GL_LINK_STATUS);
|
||||
|
||||
// log linker error
|
||||
if (programLinkStatus == 0)
|
||||
{
|
||||
string log = Platform.GL.glGetProgramInfoLog(programId);
|
||||
string log = GraphicsDevice.GL.glGetProgramInfoLog(programId);
|
||||
Platform.Logger.Error("OPENGL", "Error linking program:\n{0}", log);
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (ProgramID == -1)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
int numUniforms = Platform.GL.glGetProgramiv(ProgramID, GL20.GL_ACTIVE_UNIFORMS);
|
||||
int numUniforms = GraphicsDevice.GL.glGetProgramiv(ProgramID, GL20.GL_ACTIVE_UNIFORMS);
|
||||
NumUniforms = numUniforms;
|
||||
|
||||
if (NumUniforms == 0)
|
||||
|
@ -347,8 +347,8 @@ namespace Blarg.GameFramework.Graphics
|
|||
var uniform = new ShaderUniform();
|
||||
|
||||
int uniformType;
|
||||
uniform.Name = Platform.GL.glGetActiveUniform(ProgramID, i, out uniform.Size, out uniformType);
|
||||
uniform.Location = Platform.GL.glGetUniformLocation(ProgramID, uniform.Name);
|
||||
uniform.Name = GraphicsDevice.GL.glGetActiveUniform(ProgramID, i, out uniform.Size, out uniformType);
|
||||
uniform.Location = GraphicsDevice.GL.glGetUniformLocation(ProgramID, uniform.Name);
|
||||
uniform.Type = (int)uniformType;
|
||||
|
||||
// it seems Windows/Mac (possibly Linux too) have differing opinions on
|
||||
|
@ -373,7 +373,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (ProgramID == -1)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
int numAttributes = Platform.GL.glGetProgramiv(ProgramID, GL20.GL_ACTIVE_ATTRIBUTES);
|
||||
int numAttributes = GraphicsDevice.GL.glGetProgramiv(ProgramID, GL20.GL_ACTIVE_ATTRIBUTES);
|
||||
|
||||
// sanity checking, which only matters for shader reloading (e.g. when a context is lost)
|
||||
if (_attributeMapping != null)
|
||||
|
@ -403,8 +403,8 @@ namespace Blarg.GameFramework.Graphics
|
|||
var attribute = new ShaderAttribute();
|
||||
|
||||
int attributeType;
|
||||
attribute.Name = Platform.GL.glGetActiveAttrib(ProgramID, i, out attribute.Size, out attributeType);
|
||||
attribute.Location = Platform.GL.glGetAttribLocation(ProgramID, attribute.Name);
|
||||
attribute.Name = GraphicsDevice.GL.glGetActiveAttrib(ProgramID, i, out attribute.Size, out attributeType);
|
||||
attribute.Location = GraphicsDevice.GL.glGetAttribLocation(ProgramID, attribute.Name);
|
||||
attribute.Type = (int)attributeType;
|
||||
|
||||
_attributes[i] = attribute;
|
||||
|
@ -608,7 +608,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform1f(uniform.Location, x);
|
||||
GraphicsDevice.GL.glUniform1f(uniform.Location, x);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -629,7 +629,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform1i(uniform.Location, x);
|
||||
GraphicsDevice.GL.glUniform1i(uniform.Location, x);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -650,7 +650,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform2f(uniform.Location, x, y);
|
||||
GraphicsDevice.GL.glUniform2f(uniform.Location, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -672,7 +672,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform2i(uniform.Location, x, y);
|
||||
GraphicsDevice.GL.glUniform2i(uniform.Location, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -699,7 +699,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform2f(uniform.Location, v.X, v.Y);
|
||||
GraphicsDevice.GL.glUniform2f(uniform.Location, v.X, v.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -726,7 +726,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform2i(uniform.Location, p.X, p.Y);
|
||||
GraphicsDevice.GL.glUniform2i(uniform.Location, p.X, p.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -748,7 +748,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform3f(uniform.Location, x, y, z);
|
||||
GraphicsDevice.GL.glUniform3f(uniform.Location, x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -771,7 +771,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform3i(uniform.Location, x, y, z);
|
||||
GraphicsDevice.GL.glUniform3i(uniform.Location, x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -799,7 +799,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform3f(uniform.Location, v.X, v.Y, v.Z);
|
||||
GraphicsDevice.GL.glUniform3f(uniform.Location, v.X, v.Y, v.Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -827,7 +827,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform3i(uniform.Location, p.X, p.Y, p.Z);
|
||||
GraphicsDevice.GL.glUniform3i(uniform.Location, p.X, p.Y, p.Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -850,7 +850,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform4f(uniform.Location, x, y, z, w);
|
||||
GraphicsDevice.GL.glUniform4f(uniform.Location, x, y, z, w);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -874,7 +874,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform4i(uniform.Location, x, y, z, w);
|
||||
GraphicsDevice.GL.glUniform4i(uniform.Location, x, y, z, w);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -903,7 +903,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform4f(uniform.Location, v.X, v.Y, v.Z, v.W);
|
||||
GraphicsDevice.GL.glUniform4f(uniform.Location, v.X, v.Y, v.Z, v.W);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -932,7 +932,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform4f(uniform.Location, q.X, q.Y, q.Z, q.W);
|
||||
GraphicsDevice.GL.glUniform4f(uniform.Location, q.X, q.Y, q.Z, q.W);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -961,7 +961,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform4f(uniform.Location, c.R, c.G, c.B, c.A);
|
||||
GraphicsDevice.GL.glUniform4f(uniform.Location, c.R, c.G, c.B, c.A);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -990,7 +990,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniformMatrix3fv(uniform.Location, 1, false, ref m.M11);
|
||||
GraphicsDevice.GL.glUniformMatrix3fv(uniform.Location, 1, false, ref m.M11);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1016,7 +1016,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size != 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniformMatrix4fv(uniform.Location, 1, false, ref m.M11);
|
||||
GraphicsDevice.GL.glUniformMatrix4fv(uniform.Location, 1, false, ref m.M11);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1037,7 +1037,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
throw new ArgumentException("Invalid uniform.");
|
||||
if (uniform.Size <= 1)
|
||||
throw new InvalidOperationException();
|
||||
Platform.GL.glUniform1fv(uniform.Location, x.Length, x);
|
||||
GraphicsDevice.GL.glUniform1fv(uniform.Location, x.Length, x);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1059,7 +1059,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
{
|
||||
fixed (int *p = x)
|
||||
{
|
||||
Platform.GL.glUniform1fv(uniform.Location, x.Length, new IntPtr((long)p));
|
||||
GraphicsDevice.GL.glUniform1fv(uniform.Location, x.Length, new IntPtr((long)p));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1079,7 +1079,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (uniform.Size <= 1)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
Platform.GL.glUniform2fv(uniform.Location, v.Length, ref v[0].X);
|
||||
GraphicsDevice.GL.glUniform2fv(uniform.Location, v.Length, ref v[0].X);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1097,7 +1097,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (uniform.Size <= 1)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
Platform.GL.glUniform3fv(uniform.Location, v.Length, ref v[0].X);
|
||||
GraphicsDevice.GL.glUniform3fv(uniform.Location, v.Length, ref v[0].X);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1115,7 +1115,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (uniform.Size <= 1)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
Platform.GL.glUniform4fv(uniform.Location, v.Length, ref v[0].X);
|
||||
GraphicsDevice.GL.glUniform4fv(uniform.Location, v.Length, ref v[0].X);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1133,7 +1133,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (uniform.Size <= 1)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
Platform.GL.glUniform4fv(uniform.Location, q.Length, ref q[0].X);
|
||||
GraphicsDevice.GL.glUniform4fv(uniform.Location, q.Length, ref q[0].X);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1151,7 +1151,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (uniform.Size <= 1)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
Platform.GL.glUniform4fv(uniform.Location, c.Length, ref c[0].R);
|
||||
GraphicsDevice.GL.glUniform4fv(uniform.Location, c.Length, ref c[0].R);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1169,7 +1169,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (uniform.Size <= 1)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
Platform.GL.glUniformMatrix3fv(uniform.Location, m.Length, false, ref m[0].M11);
|
||||
GraphicsDevice.GL.glUniformMatrix3fv(uniform.Location, m.Length, false, ref m[0].M11);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1187,7 +1187,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (uniform.Size <= 1)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
Platform.GL.glUniformMatrix4fv(uniform.Location, m.Length, false, ref m[0].M11);
|
||||
GraphicsDevice.GL.glUniformMatrix4fv(uniform.Location, m.Length, false, ref m[0].M11);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1224,17 +1224,17 @@ namespace Blarg.GameFramework.Graphics
|
|||
|
||||
if (VertexShaderID != -1)
|
||||
{
|
||||
Platform.GL.glDeleteShader(VertexShaderID);
|
||||
GraphicsDevice.GL.glDeleteShader(VertexShaderID);
|
||||
VertexShaderID = -1;
|
||||
}
|
||||
if (FragmentShaderID != -1)
|
||||
{
|
||||
Platform.GL.glDeleteShader(FragmentShaderID);
|
||||
GraphicsDevice.GL.glDeleteShader(FragmentShaderID);
|
||||
FragmentShaderID = -1;
|
||||
}
|
||||
if (ProgramID != -1)
|
||||
{
|
||||
Platform.GL.glDeleteProgram(ProgramID);
|
||||
GraphicsDevice.GL.glDeleteProgram(ProgramID);
|
||||
ProgramID = -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,14 +93,14 @@ namespace Blarg.GameFramework.Graphics
|
|||
}
|
||||
|
||||
if (_providedRenderState != null)
|
||||
_providedRenderState.Apply();
|
||||
_providedRenderState.Apply(GraphicsDevice);
|
||||
else
|
||||
_defaultRenderState.Apply();
|
||||
_defaultRenderState.Apply(GraphicsDevice);
|
||||
|
||||
if (_providedBlendState != null)
|
||||
_providedBlendState.Apply();
|
||||
_providedBlendState.Apply(GraphicsDevice);
|
||||
else
|
||||
_defaultBlendState.Apply();
|
||||
_defaultBlendState.Apply(GraphicsDevice);
|
||||
|
||||
GraphicsDevice.BindShader(_shader);
|
||||
_shader.SetModelViewMatrix(Matrix4x4.Identity);
|
||||
|
|
|
@ -97,15 +97,15 @@ namespace Blarg.GameFramework.Graphics
|
|||
Height = image.Height;
|
||||
Format = textureFormat;
|
||||
|
||||
ID = Platform.GL.glGenTextures();
|
||||
ID = GraphicsDevice.GL.glGenTextures();
|
||||
|
||||
GraphicsDevice.BindTexture(this, 0);
|
||||
|
||||
if (_textureParams == null)
|
||||
_textureParams = GraphicsDevice.GetCopyOfTextureParameters();
|
||||
_textureParams.Apply();
|
||||
_textureParams.Apply(GraphicsDevice);
|
||||
|
||||
Platform.GL.glTexImage2D(GL20.GL_TEXTURE_2D, 0, internalFormat, Width, Height, 0, pixelFormat, pixelType, image.Pixels);
|
||||
GraphicsDevice.GL.glTexImage2D(GL20.GL_TEXTURE_2D, 0, internalFormat, Width, Height, 0, pixelFormat, pixelType, image.Pixels);
|
||||
|
||||
Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Created texture from image. ID = {0}, bpp = {1}, size = {2}x{3}.", ID, image.BitsPerPixel, Width, Height);
|
||||
}
|
||||
|
@ -131,15 +131,15 @@ namespace Blarg.GameFramework.Graphics
|
|||
Height = height;
|
||||
Format = format;
|
||||
|
||||
ID = Platform.GL.glGenTextures();
|
||||
ID = GraphicsDevice.GL.glGenTextures();
|
||||
|
||||
GraphicsDevice.BindTexture(this, 0);
|
||||
|
||||
if (!useExistingTextureParams || _textureParams == null)
|
||||
_textureParams = GraphicsDevice.GetCopyOfTextureParameters();
|
||||
_textureParams.Apply();
|
||||
_textureParams.Apply(GraphicsDevice);
|
||||
|
||||
Platform.GL.glTexImage2D(GL20.GL_TEXTURE_2D, 0, internalFormat, Width, Height, 0, pixelFormat, pixelType, IntPtr.Zero);
|
||||
GraphicsDevice.GL.glTexImage2D(GL20.GL_TEXTURE_2D, 0, internalFormat, Width, Height, 0, pixelFormat, pixelType, IntPtr.Zero);
|
||||
|
||||
if (Format == TextureFormat.Depth)
|
||||
Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Created uninitialized texture. ID = {0}, depth component only, size = {1}x{2}", ID, Width, Height);
|
||||
|
@ -192,7 +192,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
}
|
||||
|
||||
GraphicsDevice.BindTexture(this, 0);
|
||||
Platform.GL.glTexSubImage2D(GL20.GL_TEXTURE_2D, 0, destX, destY, image.Width, image.Height, pixelFormat, pixelType, image.Pixels);
|
||||
GraphicsDevice.GL.glTexSubImage2D(GL20.GL_TEXTURE_2D, 0, destX, destY, image.Width, image.Height, pixelFormat, pixelType, image.Pixels);
|
||||
}
|
||||
|
||||
private void GetTextureSpecsFromFormat(TextureFormat textureFormat, out int bpp, out int internalFormat, out int pixelFormat, out int type)
|
||||
|
@ -271,7 +271,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
if (GraphicsDevice != null)
|
||||
GraphicsDevice.UnbindTexture(this);
|
||||
|
||||
Platform.GL.glDeleteTextures(ID);
|
||||
GraphicsDevice.GL.glDeleteTextures(ID);
|
||||
|
||||
Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Deleted Texture ID = {0}.", ID);
|
||||
|
||||
|
|
|
@ -53,8 +53,11 @@ namespace Blarg.GameFramework.Graphics
|
|||
MagFilter = magFilter;
|
||||
}
|
||||
|
||||
public void Apply()
|
||||
public void Apply(GraphicsDevice graphicsDevice)
|
||||
{
|
||||
if (graphicsDevice == null)
|
||||
throw new ArgumentNullException("graphicsDevice");
|
||||
|
||||
int minFilter = GL20.GL_NEAREST;
|
||||
int magFilter = GL20.GL_LINEAR;
|
||||
int wrapS = GL20.GL_REPEAT;
|
||||
|
@ -88,10 +91,10 @@ namespace Blarg.GameFramework.Graphics
|
|||
case WrapMode.Repeat: wrapT = GL20.GL_REPEAT; break;
|
||||
}
|
||||
|
||||
Platform.GL.glTexParameteri(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_MIN_FILTER, (int)minFilter);
|
||||
Platform.GL.glTexParameteri(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_MAG_FILTER, (int)magFilter);
|
||||
Platform.GL.glTexParameteri(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_WRAP_S, (int)wrapS);
|
||||
Platform.GL.glTexParameteri(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_WRAP_T, (int)wrapT);
|
||||
graphicsDevice.GL.glTexParameteri(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_MIN_FILTER, (int)minFilter);
|
||||
graphicsDevice.GL.glTexParameteri(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_MAG_FILTER, (int)magFilter);
|
||||
graphicsDevice.GL.glTexParameteri(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_WRAP_S, (int)wrapS);
|
||||
graphicsDevice.GL.glTexParameteri(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_WRAP_T, (int)wrapT);
|
||||
}
|
||||
|
||||
private void Init()
|
||||
|
|
|
@ -216,7 +216,7 @@ namespace Blarg.GameFramework.Graphics
|
|||
}
|
||||
|
||||
// we **do** obviously want this to be rotated (if there is a rotation)
|
||||
Platform.GL.glViewport(viewport.Left, viewport.Top, viewport.Width, viewport.Height);
|
||||
_graphicsDevice.GL.glViewport(viewport.Left, viewport.Top, viewport.Width, viewport.Height);
|
||||
|
||||
// we also **don't** want the camera to work with a rotated viewport
|
||||
if (_camera != null)
|
||||
|
|
|
@ -20,7 +20,6 @@ namespace Blarg.GameFramework
|
|||
ITouchScreen TouchScreen { get; }
|
||||
IPlatformWindow Window { get; }
|
||||
GraphicsDevice GraphicsDevice { get; }
|
||||
GL20 GL { get; }
|
||||
|
||||
int FPS { get; }
|
||||
float FrameTime { get; }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using PortableGL;
|
||||
using Blarg.GameFramework.Graphics;
|
||||
using Blarg.GameFramework.Input;
|
||||
using Blarg.GameFramework.IO;
|
||||
|
@ -70,11 +69,6 @@ namespace Blarg.GameFramework
|
|||
get { return Application.GraphicsDevice; }
|
||||
}
|
||||
|
||||
public static GL20 GL
|
||||
{
|
||||
get { return Application.GL; }
|
||||
}
|
||||
|
||||
public static void Set(IApplication application)
|
||||
{
|
||||
if (Application != null)
|
||||
|
|
Reference in a new issue