port Tao.OpenGl to OpenTK.Graphics.OpenGL and avoid Arb

closes #4540
This commit is contained in:
Matthias Mailänder
2014-05-04 09:57:25 +02:00
parent 4c8ce8afc0
commit dc2d1287a7
15 changed files with 166 additions and 193 deletions

View File

@@ -100,8 +100,8 @@ distributed under the MIT license.
Using SharpFont created by Robert Rouhani and Using SharpFont created by Robert Rouhani and
distributed under the MIT license. distributed under the MIT license.
Using the Tao framework and distributed under Using the Open Toolkit distributed under the
the MIT license. MIT license.
Using SDL2# created by Ethan Lee and released Using SDL2# created by Ethan Lee and released
under the zlib license. under the zlib license.

View File

@@ -98,7 +98,7 @@ rsdl2_SRCS := $(shell find OpenRA.Renderer.Sdl2/ -iname '*.cs')
rsdl2_TARGET = OpenRA.Renderer.Sdl2.dll rsdl2_TARGET = OpenRA.Renderer.Sdl2.dll
rsdl2_KIND = library rsdl2_KIND = library
rsdl2_DEPS = $(game_TARGET) rsdl2_DEPS = $(game_TARGET)
rsdl2_LIBS = $(COMMON_LIBS) thirdparty/Tao/Tao.OpenGl.dll thirdparty/SDL2-CS.dll $(rsdl2_DEPS) rsdl2_LIBS = $(COMMON_LIBS) thirdparty/SDL2-CS.dll $(rsdl2_DEPS)
rnull_SRCS := $(shell find OpenRA.Renderer.Null/ -iname '*.cs') rnull_SRCS := $(shell find OpenRA.Renderer.Null/ -iname '*.cs')
rnull_TARGET = OpenRA.Renderer.Null.dll rnull_TARGET = OpenRA.Renderer.Null.dll
@@ -276,7 +276,6 @@ endif
dependencies: dependencies:
@ $(CP_R) thirdparty/*.dl* . @ $(CP_R) thirdparty/*.dl* .
@ $(CP_R) thirdparty/Tao/* .
@ $(CP_R) thirdparty/${platformdeps}/* . @ $(CP_R) thirdparty/${platformdeps}/* .
version: mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/modchooser/mod.yaml version: mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/modchooser/mod.yaml
@@ -315,7 +314,6 @@ install-core: default
@$(CP_R) glsl "$(DATA_INSTALL_DIR)" @$(CP_R) glsl "$(DATA_INSTALL_DIR)"
@$(CP_R) lua "$(DATA_INSTALL_DIR)" @$(CP_R) lua "$(DATA_INSTALL_DIR)"
@$(CP) *.ttf "$(DATA_INSTALL_DIR)" @$(CP) *.ttf "$(DATA_INSTALL_DIR)"
@$(CP) thirdparty/Tao/* "$(DATA_INSTALL_DIR)"
@$(CP) thirdparty/SDL2-CS* "$(DATA_INSTALL_DIR)" @$(CP) thirdparty/SDL2-CS* "$(DATA_INSTALL_DIR)"
@$(CP) thirdparty/Eluant* "$(DATA_INSTALL_DIR)" @$(CP) thirdparty/Eluant* "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) thirdparty/ICSharpCode.SharpZipLib.dll "$(DATA_INSTALL_DIR)" @$(INSTALL_PROGRAM) thirdparty/ICSharpCode.SharpZipLib.dll "$(DATA_INSTALL_DIR)"

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -10,37 +10,18 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using Tao.OpenGl; using OpenTK.Graphics.OpenGL;
namespace OpenRA.Renderer.Sdl2 namespace OpenRA.Renderer.Sdl2
{ {
public static class ErrorHandler public static class ErrorHandler
{ {
public enum GlError
{
GL_NO_ERROR = Gl.GL_NO_ERROR,
GL_INVALID_ENUM = Gl.GL_INVALID_ENUM,
GL_INVALID_VALUE = Gl.GL_INVALID_VALUE,
GL_STACK_OVERFLOW = Gl.GL_STACK_OVERFLOW,
GL_STACK_UNDERFLOW = Gl.GL_STACK_UNDERFLOW,
GL_OUT_OF_MEMORY = Gl.GL_OUT_OF_MEMORY,
GL_TABLE_TOO_LARGE = Gl.GL_TABLE_TOO_LARGE,
GL_INVALID_OPERATION = Gl.GL_INVALID_OPERATION,
// Framebuffer errors
GL_FRAMEBUFFER_COMPLETE_EXT = Gl.GL_FRAMEBUFFER_COMPLETE_EXT,
GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT = Gl.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT,
GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT = Gl.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT,
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT = Gl.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT,
GL_FRAMEBUFFER_UNSUPPORTED_EXT = Gl.GL_FRAMEBUFFER_UNSUPPORTED_EXT,
}
public static void CheckGlError() public static void CheckGlError()
{ {
var n = Gl.glGetError(); var n = GL.GetError();
if (n != Gl.GL_NO_ERROR) if (n != ErrorCode.NoError)
{ {
var error = "GL Error: {0}\n{1}".F((GlError)n, new StackTrace()); var error = "GL Error: {0}\n{1}".F(n, new StackTrace());
WriteGraphicsLog(error); WriteGraphicsLog(error);
throw new InvalidOperationException("OpenGL Error: See graphics.log for details."); throw new InvalidOperationException("OpenGL Error: See graphics.log for details.");
} }
@@ -51,12 +32,12 @@ namespace OpenRA.Renderer.Sdl2
Log.Write("graphics", message); Log.Write("graphics", message);
Log.Write("graphics", ""); Log.Write("graphics", "");
Log.Write("graphics", "OpenGL Information:"); Log.Write("graphics", "OpenGL Information:");
Log.Write("graphics", "Vendor: {0}", Gl.glGetString(Gl.GL_VENDOR)); Log.Write("graphics", "Vendor: {0}", GL.GetString(StringName.Vendor));
Log.Write("graphics", "Renderer: {0}", Gl.glGetString(Gl.GL_RENDERER)); Log.Write("graphics", "Renderer: {0}", GL.GetString(StringName.Renderer));
Log.Write("graphics", "GL Version: {0}", Gl.glGetString(Gl.GL_VERSION)); Log.Write("graphics", "GL Version: {0}", GL.GetString(StringName.Version));
Log.Write("graphics", "Shader Version: {0}", Gl.glGetString(Gl.GL_SHADING_LANGUAGE_VERSION)); Log.Write("graphics", "Shader Version: {0}", GL.GetString(StringName.ShadingLanguageVersion));
Log.Write("graphics", "Available extensions:"); Log.Write("graphics", "Available extensions:");
Log.Write("graphics", Gl.glGetString(Gl.GL_EXTENSIONS)); Log.Write("graphics", GL.GetString(StringName.Extensions));
} }
} }
} }

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -13,7 +13,7 @@ using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using OpenRA.Graphics; using OpenRA.Graphics;
using Tao.OpenGl; using OpenTK.Graphics.OpenGL;
namespace OpenRA.Renderer.Sdl2 namespace OpenRA.Renderer.Sdl2
{ {
@@ -29,41 +29,41 @@ namespace OpenRA.Renderer.Sdl2
if (!Exts.IsPowerOf2(size.Width) || !Exts.IsPowerOf2(size.Height)) if (!Exts.IsPowerOf2(size.Width) || !Exts.IsPowerOf2(size.Height))
throw new InvalidDataException("Frame buffer size ({0}x{1}) must be a power of two".F(size.Width, size.Height)); throw new InvalidDataException("Frame buffer size ({0}x{1}) must be a power of two".F(size.Width, size.Height));
Gl.glGenFramebuffersEXT(1, out framebuffer); GL.Ext.GenFramebuffers(1, out framebuffer);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glBindFramebufferEXT(Gl.GL_FRAMEBUFFER_EXT, framebuffer); GL.Ext.BindFramebuffer(FramebufferTarget.FramebufferExt, framebuffer);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
// Color // Color
texture = new Texture(); texture = new Texture();
texture.SetEmpty(size.Width, size.Height); texture.SetEmpty(size.Width, size.Height);
Gl.glFramebufferTexture2DEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_COLOR_ATTACHMENT0_EXT, Gl.GL_TEXTURE_2D, texture.ID, 0); GL.Ext.FramebufferTexture2D(FramebufferTarget.FramebufferExt, FramebufferAttachment.ColorAttachment0Ext, TextureTarget.Texture2D, texture.ID, 0);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
// Depth // Depth
Gl.glGenRenderbuffersEXT(1, out depth); GL.Ext.GenRenderbuffers(1, out depth);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glBindRenderbufferEXT(Gl.GL_RENDERBUFFER_EXT, depth); GL.Ext.BindRenderbuffer(RenderbufferTarget.RenderbufferExt, depth);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glRenderbufferStorageEXT(Gl.GL_RENDERBUFFER_EXT, Gl.GL_DEPTH_COMPONENT, size.Width, size.Height); GL.Ext.RenderbufferStorage(RenderbufferTarget.RenderbufferExt, (RenderbufferStorage)All.DepthComponent, size.Width, size.Height);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glFramebufferRenderbufferEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_DEPTH_ATTACHMENT_EXT, Gl.GL_RENDERBUFFER_EXT, depth); GL.Ext.FramebufferRenderbuffer(FramebufferTarget.FramebufferExt, FramebufferAttachment.DepthAttachmentExt, RenderbufferTarget.RenderbufferExt, depth);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
// Test for completeness // Test for completeness
var status = Gl.glCheckFramebufferStatusEXT(Gl.GL_FRAMEBUFFER_EXT); var status = GL.Ext.CheckFramebufferStatus(FramebufferTarget.FramebufferExt);
if (status != Gl.GL_FRAMEBUFFER_COMPLETE_EXT) if (status != FramebufferErrorCode.FramebufferCompleteExt)
{ {
var error = "Error creating framebuffer: {0}\n{1}".F((ErrorHandler.GlError)status, new StackTrace()); var error = "Error creating framebuffer: {0}\n{1}".F(status, new StackTrace());
ErrorHandler.WriteGraphicsLog(error); ErrorHandler.WriteGraphicsLog(error);
throw new InvalidOperationException("OpenGL Error: See graphics.log for details."); throw new InvalidOperationException("OpenGL Error: See graphics.log for details.");
} }
// Restore default buffer // Restore default buffer
Gl.glBindFramebufferEXT(Gl.GL_FRAMEBUFFER_EXT, 0); GL.Ext.BindFramebuffer(FramebufferTarget.FramebufferExt, 0);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
@@ -74,8 +74,7 @@ namespace OpenRA.Renderer.Sdl2
{ {
fixed (int* ptr = &v[0]) fixed (int* ptr = &v[0])
{ {
IntPtr intPtr = new IntPtr((void*)ptr); GL.GetInteger(GetPName.Viewport, ptr);
Gl.glGetIntegerv(Gl.GL_VIEWPORT, intPtr);
} }
} }
@@ -85,9 +84,9 @@ namespace OpenRA.Renderer.Sdl2
void FinalizeInner() void FinalizeInner()
{ {
Gl.glDeleteFramebuffersEXT(1, ref framebuffer); GL.Ext.DeleteFramebuffers(1, ref framebuffer);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glDeleteRenderbuffersEXT(1, ref depth); GL.Ext.DeleteRenderbuffers(1, ref depth);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
@@ -99,25 +98,25 @@ namespace OpenRA.Renderer.Sdl2
// Cache viewport rect to restore when unbinding // Cache viewport rect to restore when unbinding
cv = ViewportRectangle(); cv = ViewportRectangle();
Gl.glFlush(); GL.Flush();
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glBindFramebufferEXT(Gl.GL_FRAMEBUFFER_EXT, framebuffer); GL.Ext.BindFramebuffer(FramebufferTarget.FramebufferExt, framebuffer);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glViewport(0, 0, size.Width, size.Height); GL.Viewport(0, 0, size.Width, size.Height);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glClearColor(0, 0, 0, 0); GL.ClearColor(0, 0, 0, 0);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
public void Unbind() public void Unbind()
{ {
Gl.glFlush(); GL.Flush();
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glBindFramebufferEXT(Gl.GL_FRAMEBUFFER_EXT, 0); GL.Ext.BindFramebuffer(FramebufferTarget.FramebufferExt, 0);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glViewport(cv[0], cv[1], cv[2], cv[3]); GL.Viewport(cv[0], cv[1], cv[2], cv[3]);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }

View File

@@ -33,9 +33,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="Tao.OpenGl">
<HintPath>..\thirdparty\Tao\Tao.OpenGl.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="SDL2-CS"> <Reference Include="SDL2-CS">
<HintPath>..\thirdparty\SDL2-CS.dll</HintPath> <HintPath>..\thirdparty\SDL2-CS.dll</HintPath>

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS) * Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -14,7 +14,7 @@ using System.Linq;
using OpenRA; using OpenRA;
using OpenRA.Graphics; using OpenRA.Graphics;
using SDL2; using SDL2;
using Tao.OpenGl; using OpenTK.Graphics.OpenGL;
[assembly: Renderer(typeof(OpenRA.Renderer.Sdl2.DeviceFactory))] [assembly: Renderer(typeof(OpenRA.Renderer.Sdl2.DeviceFactory))]
@@ -33,6 +33,7 @@ namespace OpenRA.Renderer.Sdl2
{ {
static string[] requiredExtensions = static string[] requiredExtensions =
{ {
// TODO: not ARB anymore
"GL_ARB_vertex_shader", "GL_ARB_vertex_shader",
"GL_ARB_fragment_shader", "GL_ARB_fragment_shader",
"GL_ARB_vertex_buffer_object", "GL_ARB_vertex_buffer_object",
@@ -41,7 +42,7 @@ namespace OpenRA.Renderer.Sdl2
Size size; Size size;
Sdl2Input input; Sdl2Input input;
IntPtr window; IntPtr context, window;
public Size WindowSize { get { return size; } } public Size WindowSize { get { return size; } }
@@ -84,10 +85,12 @@ namespace OpenRA.Renderer.Sdl2
} }
SDL.SDL_ShowCursor(0); SDL.SDL_ShowCursor(0);
SDL.SDL_GL_CreateContext(window); context = SDL.SDL_GL_CreateContext(window);
SDL.SDL_GL_MakeCurrent(window, context);
GL.LoadAll();
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
var extensions = Gl.glGetString(Gl.GL_EXTENSIONS); var extensions = GL.GetString(StringName.Extensions);
if (extensions == null) if (extensions == null)
Console.WriteLine("Failed to fetch GL_EXTENSIONS, this is bad."); Console.WriteLine("Failed to fetch GL_EXTENSIONS, this is bad.");
@@ -98,9 +101,9 @@ namespace OpenRA.Renderer.Sdl2
throw new InvalidProgramException("Unsupported GPU. See graphics.log for details."); throw new InvalidProgramException("Unsupported GPU. See graphics.log for details.");
} }
Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY); GL.EnableClientState(ArrayCap.VertexArray);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glEnableClientState(Gl.GL_TEXTURE_COORD_ARRAY); GL.EnableClientState(ArrayCap.TextureCoordArray);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
SDL.SDL_SetModState(0); SDL.SDL_SetModState(0);
@@ -109,17 +112,19 @@ namespace OpenRA.Renderer.Sdl2
public virtual void Quit() public virtual void Quit()
{ {
SDL.SDL_GL_DeleteContext(context);
SDL.SDL_DestroyWindow(window);
SDL.SDL_Quit(); SDL.SDL_Quit();
} }
int ModeFromPrimitiveType(PrimitiveType pt) BeginMode ModeFromPrimitiveType(PrimitiveType pt)
{ {
switch (pt) switch (pt)
{ {
case PrimitiveType.PointList: return Gl.GL_POINTS; case PrimitiveType.PointList: return BeginMode.Points;
case PrimitiveType.LineList: return Gl.GL_LINES; case PrimitiveType.LineList: return BeginMode.Lines;
case PrimitiveType.TriangleList: return Gl.GL_TRIANGLES; case PrimitiveType.TriangleList: return BeginMode.Triangles;
case PrimitiveType.QuadList: return Gl.GL_QUADS; case PrimitiveType.QuadList: return BeginMode.Quads;
} }
throw new NotImplementedException(); throw new NotImplementedException();
@@ -127,63 +132,63 @@ namespace OpenRA.Renderer.Sdl2
public void DrawPrimitives(PrimitiveType pt, int firstVertex, int numVertices) public void DrawPrimitives(PrimitiveType pt, int firstVertex, int numVertices)
{ {
Gl.glDrawArrays(ModeFromPrimitiveType(pt), firstVertex, numVertices); GL.DrawArrays(ModeFromPrimitiveType(pt), firstVertex, numVertices);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
public void Clear() public void Clear()
{ {
Gl.glClearColor(0, 0, 0, 0); GL.ClearColor(0, 0, 0, 0);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT); GL.Clear(ClearBufferMask.ColorBufferBit);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
public void EnableDepthBuffer() public void EnableDepthBuffer()
{ {
Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT); GL.Clear(ClearBufferMask.DepthBufferBit);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glEnable(Gl.GL_DEPTH_TEST); GL.Enable(EnableCap.DepthTest);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
public void DisableDepthBuffer() public void DisableDepthBuffer()
{ {
Gl.glDisable(Gl.GL_DEPTH_TEST); GL.Disable(EnableCap.DepthTest);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
public void SetBlendMode(BlendMode mode) public void SetBlendMode(BlendMode mode)
{ {
Gl.glBlendEquation(Gl.GL_FUNC_ADD); GL.BlendEquation(BlendEquationMode.FuncAdd);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
switch (mode) switch (mode)
{ {
case BlendMode.None: case BlendMode.None:
Gl.glDisable(Gl.GL_BLEND); GL.Disable(EnableCap.Blend);
break; break;
case BlendMode.Alpha: case BlendMode.Alpha:
Gl.glEnable(Gl.GL_BLEND); GL.Enable(EnableCap.Blend);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
break; break;
case BlendMode.Additive: case BlendMode.Additive:
Gl.glEnable(Gl.GL_BLEND); GL.Enable(EnableCap.Blend);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glBlendFunc(Gl.GL_ONE, Gl.GL_ONE); GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);
break; break;
case BlendMode.Subtractive: case BlendMode.Subtractive:
Gl.glEnable(Gl.GL_BLEND); GL.Enable(EnableCap.Blend);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glBlendFunc(Gl.GL_ONE, Gl.GL_ONE); GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glBlendEquation(Gl.GL_FUNC_REVERSE_SUBTRACT); GL.BlendEquation(BlendEquationMode.FuncReverseSubtract);
break; break;
case BlendMode.Multiply: case BlendMode.Multiply:
Gl.glEnable(Gl.GL_BLEND); GL.Enable(EnableCap.Blend);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glBlendFuncSeparate(Gl.GL_DST_COLOR, Gl.GL_ZERO, Gl.GL_ONE, Gl.GL_ONE_MINUS_SRC_ALPHA); GL.BlendFuncSeparate(BlendingFactorSrc.DstColor, BlendingFactorDest.Zero, BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
break; break;
} }
@@ -199,21 +204,21 @@ namespace OpenRA.Renderer.Sdl2
if (height < 0) if (height < 0)
height = 0; height = 0;
Gl.glScissor(left, size.Height - (top + height), width, height); GL.Scissor(left, size.Height - (top + height), width, height);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glEnable(Gl.GL_SCISSOR_TEST); GL.Enable(EnableCap.ScissorTest);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
public void DisableScissor() public void DisableScissor()
{ {
Gl.glDisable(Gl.GL_SCISSOR_TEST); GL.Disable(EnableCap.ScissorTest);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
public void SetLineWidth(float width) public void SetLineWidth(float width)
{ {
Gl.glLineWidth(width); GL.LineWidth(width);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -14,7 +14,8 @@ using System.IO;
using System.Text; using System.Text;
using OpenRA.FileSystem; using OpenRA.FileSystem;
using OpenRA.Graphics; using OpenRA.Graphics;
using Tao.OpenGl; using OpenTK;
using OpenTK.Graphics.OpenGL;
namespace OpenRA.Renderer.Sdl2 namespace OpenRA.Renderer.Sdl2
{ {
@@ -31,76 +32,73 @@ namespace OpenRA.Renderer.Sdl2
using (var file = new StreamReader(GlobalFileSystem.Open("glsl{0}{1}.vert".F(Path.DirectorySeparatorChar, name)))) using (var file = new StreamReader(GlobalFileSystem.Open("glsl{0}{1}.vert".F(Path.DirectorySeparatorChar, name))))
vertexCode = file.ReadToEnd(); vertexCode = file.ReadToEnd();
var v = Gl.glCreateShaderObjectARB(Gl.GL_VERTEX_SHADER_ARB); var vertexShader = GL.CreateShader(ShaderType.VertexShader);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glShaderSourceARB(v, 1, new string[] { vertexCode }, null); GL.ShaderSource(vertexShader, vertexCode);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glCompileShaderARB(v); GL.CompileShader(vertexShader);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
int success; int success;
Gl.glGetObjectParameterivARB(v, Gl.GL_OBJECT_COMPILE_STATUS_ARB, out success); GL.GetShader(vertexShader, ShaderParameter.CompileStatus, out success);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
if (success == 0) if (success == (int)All.False)
throw new InvalidProgramException("Compile error in {0}{1}.vert".F(Path.DirectorySeparatorChar, name)); throw new InvalidProgramException("Compile error in glsl{0}{1}.vert".F(Path.DirectorySeparatorChar, name));
// Fragment shader // Fragment shader
string fragmentCode; string fragmentCode;
using (var file = new StreamReader(GlobalFileSystem.Open("glsl{0}{1}.frag".F(Path.DirectorySeparatorChar, name)))) using (var file = new StreamReader(GlobalFileSystem.Open("glsl{0}{1}.frag".F(Path.DirectorySeparatorChar, name))))
fragmentCode = file.ReadToEnd(); fragmentCode = file.ReadToEnd();
var f = Gl.glCreateShaderObjectARB(Gl.GL_FRAGMENT_SHADER_ARB); var fragmentShader = GL.CreateShader(ShaderType.FragmentShader);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glShaderSourceARB(f, 1, new string[] { fragmentCode }, null); GL.ShaderSource(fragmentShader, fragmentCode);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glCompileShaderARB(f); GL.CompileShader(fragmentShader);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
GL.GetShader(vertexShader, ShaderParameter.CompileStatus, out success);
Gl.glGetObjectParameterivARB(f, Gl.GL_OBJECT_COMPILE_STATUS_ARB, out success);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
if (success == 0) if (success == (int)All.False)
throw new InvalidProgramException("Compile error in glsl{0}{1}.frag".F(Path.DirectorySeparatorChar, name)); throw new InvalidProgramException("Compile error in glsl{0}{1}.frag".F(Path.DirectorySeparatorChar, name));
// Assemble program // Assemble program
program = Gl.glCreateProgramObjectARB(); program = GL.CreateProgram();
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glAttachObjectARB(program, v); GL.AttachShader(program, vertexShader);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glAttachObjectARB(program, f); GL.AttachShader(program, fragmentShader);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glLinkProgramARB(program); GL.LinkProgram(program);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
GL.GetProgram(program, ProgramParameter.LinkStatus, out success);
Gl.glGetObjectParameterivARB(program, Gl.GL_OBJECT_LINK_STATUS_ARB, out success);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
if (success == 0) if (success == (int)All.False)
throw new InvalidProgramException("Linking error in {0} shader".F(name)); throw new InvalidProgramException("Linking error in {0} shader".F(name));
Gl.glUseProgramObjectARB(program); GL.UseProgram(program);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
int numUniforms; int numUniforms;
Gl.glGetObjectParameterivARB(program, Gl.GL_ACTIVE_UNIFORMS, out numUniforms); GL.GetProgram(program, ProgramParameter.ActiveUniforms, out numUniforms);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
int nextTexUnit = 0; int nextTexUnit = 0;
for (var i = 0; i < numUniforms; i++) for (var i = 0; i < numUniforms; i++)
{ {
int length, size, type; int length, size;
ActiveUniformType type;
var sb = new StringBuilder(128); var sb = new StringBuilder(128);
GL.GetActiveUniform(program, i, 128, out length, out size, out type, sb);
Gl.glGetActiveUniformARB(program, i, 128, out length, out size, out type, sb);
var sampler = sb.ToString(); var sampler = sb.ToString();
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
if (type == Gl.GL_SAMPLER_2D_ARB) if (type == ActiveUniformType.Sampler2D)
{ {
samplers.Add(sampler, nextTexUnit); samplers.Add(sampler, nextTexUnit);
var loc = Gl.glGetUniformLocationARB(program, sampler); var loc = GL.GetUniformLocation(program, sampler);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glUniform1iARB(loc, nextTexUnit); GL.Uniform1(loc, nextTexUnit);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
nextTexUnit++; nextTexUnit++;
@@ -110,13 +108,13 @@ namespace OpenRA.Renderer.Sdl2
public void Render(Action a) public void Render(Action a)
{ {
Gl.glUseProgramObjectARB(program); GL.UseProgram(program);
// bind the textures // bind the textures
foreach (var kv in textures) foreach (var kv in textures)
{ {
Gl.glActiveTextureARB(Gl.GL_TEXTURE0_ARB + kv.Key); GL.ActiveTexture(TextureUnit.Texture0 + kv.Key);
Gl.glBindTexture(Gl.GL_TEXTURE_2D, ((Texture)kv.Value).ID); GL.BindTexture(TextureTarget.Texture2D, ((Texture)kv.Value).ID);
} }
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
@@ -136,34 +134,34 @@ namespace OpenRA.Renderer.Sdl2
public void SetVec(string name, float x) public void SetVec(string name, float x)
{ {
Gl.glUseProgramObjectARB(program); GL.UseProgram(program);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
var param = Gl.glGetUniformLocationARB(program, name); var param = GL.GetUniformLocation(program, name);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glUniform1fARB(param, x); GL.Uniform1(param, x);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
public void SetVec(string name, float x, float y) public void SetVec(string name, float x, float y)
{ {
Gl.glUseProgramObjectARB(program); GL.UseProgram(program);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
var param = Gl.glGetUniformLocationARB(program, name); var param = GL.GetUniformLocation(program, name);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glUniform2fARB(param, x, y); GL.Uniform2(param, x, y);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
public void SetVec(string name, float[] vec, int length) public void SetVec(string name, float[] vec, int length)
{ {
var param = Gl.glGetUniformLocationARB(program, name); var param = GL.GetUniformLocation(program, name);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
switch (length) switch (length)
{ {
case 1: Gl.glUniform1fv(param, 1, vec); break; case 1: GL.Uniform1(param, 1, vec); break;
case 2: Gl.glUniform2fv(param, 1, vec); break; case 2: GL.Uniform2(param, 1, vec); break;
case 3: Gl.glUniform3fv(param, 1, vec); break; case 3: GL.Uniform3(param, 1, vec); break;
case 4: Gl.glUniform4fv(param, 1, vec); break; case 4: GL.Uniform4(param, 1, vec); break;
default: throw new InvalidDataException("Invalid vector length"); default: throw new InvalidDataException("Invalid vector length");
} }
@@ -175,11 +173,11 @@ namespace OpenRA.Renderer.Sdl2
if (mtx.Length != 16) if (mtx.Length != 16)
throw new InvalidDataException("Invalid 4x4 matrix"); throw new InvalidDataException("Invalid 4x4 matrix");
Gl.glUseProgramObjectARB(program); GL.UseProgram(program);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
var param = Gl.glGetUniformLocationARB(program, name); var param = GL.GetUniformLocation(program, name);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glUniformMatrix4fv(param, 1, Gl.GL_FALSE, mtx); GL.UniformMatrix4(param, 1, false, mtx);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
} }

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -13,7 +13,7 @@ using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using OpenRA.Graphics; using OpenRA.Graphics;
using Tao.OpenGl; using OpenTK.Graphics.OpenGL;
namespace OpenRA.Renderer.Sdl2 namespace OpenRA.Renderer.Sdl2
{ {
@@ -27,38 +27,38 @@ namespace OpenRA.Renderer.Sdl2
public Texture() public Texture()
{ {
Gl.glGenTextures(1, out texture); GL.GenTextures(1, out texture);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
public Texture(Bitmap bitmap) public Texture(Bitmap bitmap)
{ {
Gl.glGenTextures(1, out texture); GL.GenTextures(1, out texture);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
SetData(bitmap); SetData(bitmap);
} }
void FinalizeInner() { Gl.glDeleteTextures(1, ref texture); } void FinalizeInner() { GL.DeleteTextures(1, ref texture); }
~Texture() { Game.RunAfterTick(FinalizeInner); } ~Texture() { Game.RunAfterTick(FinalizeInner); }
void PrepareTexture() void PrepareTexture()
{ {
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture); GL.BindTexture(TextureTarget.Texture2D, texture);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_NEAREST); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMinFilter.Nearest);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_NEAREST); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_WRAP_S, Gl.GL_CLAMP_TO_EDGE); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (float)TextureWrapMode.ClampToEdge);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_WRAP_T, Gl.GL_CLAMP_TO_EDGE); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (float)TextureWrapMode.ClampToEdge);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_BASE_LEVEL, 0); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureBaseLevel, 0);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAX_LEVEL, 0); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMaxLevel, 0);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
@@ -74,8 +74,8 @@ namespace OpenRA.Renderer.Sdl2
{ {
IntPtr intPtr = new IntPtr((void*)ptr); IntPtr intPtr = new IntPtr((void*)ptr);
PrepareTexture(); PrepareTexture();
Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGBA8, width, height, GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8, width, height,
0, Gl.GL_BGRA, Gl.GL_UNSIGNED_BYTE, intPtr); 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, intPtr);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
} }
@@ -97,8 +97,8 @@ namespace OpenRA.Renderer.Sdl2
{ {
IntPtr intPtr = new IntPtr((void*)ptr); IntPtr intPtr = new IntPtr((void*)ptr);
PrepareTexture(); PrepareTexture();
Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGBA8, width, height, GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8, width, height,
0, Gl.GL_BGRA, Gl.GL_UNSIGNED_BYTE, intPtr); 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, intPtr);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
} }
@@ -111,11 +111,11 @@ namespace OpenRA.Renderer.Sdl2
size = new Size(bitmap.Width, bitmap.Height); size = new Size(bitmap.Width, bitmap.Height);
var bits = bitmap.LockBits(bitmap.Bounds(), var bits = bitmap.LockBits(bitmap.Bounds(),
ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
PrepareTexture(); PrepareTexture();
Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGBA8, bits.Width, bits.Height, GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8, bits.Width, bits.Height,
0, Gl.GL_BGRA, Gl.GL_UNSIGNED_BYTE, bits.Scan0); // todo: weird strides 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bits.Scan0); // TODO: weird strides
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
bitmap.UnlockBits(bits); bitmap.UnlockBits(bits);
} }
@@ -125,13 +125,13 @@ namespace OpenRA.Renderer.Sdl2
var data = new byte[4 * size.Width * size.Height]; var data = new byte[4 * size.Width * size.Height];
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture); GL.BindTexture(TextureTarget.Texture2D, texture);
unsafe unsafe
{ {
fixed (byte* ptr = &data[0]) fixed (byte* ptr = &data[0])
{ {
IntPtr intPtr = new IntPtr((void*)ptr); IntPtr intPtr = new IntPtr((void*)ptr);
Gl.glGetTexImage(Gl.GL_TEXTURE_2D, 0, Gl.GL_BGRA, Gl.GL_UNSIGNED_BYTE, intPtr); GL.GetTexImage(TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, intPtr);
} }
} }
@@ -146,8 +146,8 @@ namespace OpenRA.Renderer.Sdl2
size = new Size(width, height); size = new Size(width, height);
PrepareTexture(); PrepareTexture();
Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGBA8, width, height, GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8, width, height,
0, Gl.GL_BGRA, Gl.GL_UNSIGNED_BYTE, null); 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
} }

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -11,7 +11,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using OpenRA.Graphics; using OpenRA.Graphics;
using Tao.OpenGl; using OpenTK.Graphics.OpenGL;
namespace OpenRA.Renderer.Sdl2 namespace OpenRA.Renderer.Sdl2
{ {
@@ -23,20 +23,21 @@ namespace OpenRA.Renderer.Sdl2
public VertexBuffer(int size) public VertexBuffer(int size)
{ {
Gl.glGenBuffersARB(1, out buffer); GL.GenBuffers(1, out buffer);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Bind(); Bind();
Gl.glBufferDataARB(Gl.GL_ARRAY_BUFFER_ARB, GL.BufferData(BufferTarget.ArrayBuffer,
new IntPtr(VertexSize * size), new IntPtr(VertexSize * size),
new T[size], new T[size],
Gl.GL_DYNAMIC_DRAW_ARB); BufferUsageHint.DynamicDraw
);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
public void SetData(T[] data, int length) public void SetData(T[] data, int length)
{ {
Bind(); Bind();
Gl.glBufferSubDataARB(Gl.GL_ARRAY_BUFFER_ARB, GL.BufferSubData(BufferTarget.ArrayBuffer,
IntPtr.Zero, IntPtr.Zero,
new IntPtr(VertexSize * length), new IntPtr(VertexSize * length),
data); data);
@@ -45,15 +46,15 @@ namespace OpenRA.Renderer.Sdl2
public void Bind() public void Bind()
{ {
Gl.glBindBufferARB(Gl.GL_ARRAY_BUFFER_ARB, buffer); GL.BindBuffer(BufferTarget.ArrayBuffer, buffer);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glVertexPointer(3, Gl.GL_FLOAT, VertexSize, IntPtr.Zero); GL.VertexPointer(3, VertexPointerType.Float, VertexSize, IntPtr.Zero);
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
Gl.glTexCoordPointer(4, Gl.GL_FLOAT, VertexSize, new IntPtr(12)); GL.TexCoordPointer(4, TexCoordPointerType.Float, VertexSize, new IntPtr(12));
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
void FinalizeInner() { Gl.glDeleteBuffersARB(1, ref buffer); } void FinalizeInner() { GL.DeleteBuffers(1, ref buffer); }
~VertexBuffer() { Game.RunAfterTick(FinalizeInner); } ~VertexBuffer() { Game.RunAfterTick(FinalizeInner); }
} }
} }

View File

@@ -76,7 +76,6 @@ elseif ($command -eq "version")
elseif ($command -eq "dependencies") elseif ($command -eq "dependencies")
{ {
cp thirdparty/*.dll . cp thirdparty/*.dll .
cp thirdparty/Tao/*.dll .
cp thirdparty/windows/*.dll . cp thirdparty/windows/*.dll .
echo "Dependencies copied." echo "Dependencies copied."
} }

View File

@@ -41,9 +41,6 @@ for i in "${FILES[@]}"; do
cp -R "${i}" "packaging/built/${i}" || exit 3 cp -R "${i}" "packaging/built/${i}" || exit 3
done done
# Copy Tao
cp thirdparty/Tao/* packaging/built
# SharpZipLib for zip file support # SharpZipLib for zip file support
cp thirdparty/ICSharpCode.SharpZipLib.dll packaging/built cp thirdparty/ICSharpCode.SharpZipLib.dll packaging/built

View File

@@ -81,7 +81,6 @@ Section "Game" GAME
File "${SRCDIR}\DOCUMENTATION.html" File "${SRCDIR}\DOCUMENTATION.html"
File "${SRCDIR}\*.ttf" File "${SRCDIR}\*.ttf"
File "${SRCDIR}\OpenRA.ico" File "${SRCDIR}\OpenRA.ico"
File "${SRCDIR}\Tao.*.dll"
File "${SRCDIR}\SharpFont.dll" File "${SRCDIR}\SharpFont.dll"
File "${SRCDIR}\SDL2-CS.dll" File "${SRCDIR}\SDL2-CS.dll"
File "${SRCDIR}\global mix database.dat" File "${SRCDIR}\global mix database.dat"
@@ -195,7 +194,6 @@ Function ${UN}Clean
Delete $INSTDIR\ICSharpCode.SharpZipLib.dll Delete $INSTDIR\ICSharpCode.SharpZipLib.dll
Delete $INSTDIR\FuzzyLogicLibrary.dll Delete $INSTDIR\FuzzyLogicLibrary.dll
Delete $INSTDIR\Mono.Nat.dll Delete $INSTDIR\Mono.Nat.dll
Delete $INSTDIR\Tao.*.dll
Delete $INSTDIR\SharpFont.dll Delete $INSTDIR\SharpFont.dll
Delete $INSTDIR\AUTHORS Delete $INSTDIR\AUTHORS
Delete $INSTDIR\COPYING Delete $INSTDIR\COPYING

View File

@@ -6,4 +6,16 @@
<dllmap dll="soft_oal.dll" os="osx" target="/System/Library/Frameworks/OpenAL.framework/OpenAL"/> <dllmap dll="soft_oal.dll" os="osx" target="/System/Library/Frameworks/OpenAL.framework/OpenAL"/>
<dllmap dll="soft_oal.dll" os="linux" target="libopenal.so.1"/> <dllmap dll="soft_oal.dll" os="linux" target="libopenal.so.1"/>
<dllmap dll="opengl32.dll">
<dllentry os="linux" dll="libGL.so.1" />
<dllentry os="windows" dll="opengl32.dll" />
<dllentry os="osx" dll="/System/Library/Frameworks/OpenGL.framework/OpenGL" />
</dllmap>
<dllmap dll="glu32.dll">
<dllentry os="linux" dll="libGLU.so.1" />
<dllentry os="windows" dll="opengl32.dll" />
<dllentry os="osx" dll="/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib" />
</dllmap>
</configuration> </configuration>

Binary file not shown.

View File

@@ -1,12 +0,0 @@
<configuration>
<dllmap dll="opengl32.dll">
<dllentry os="linux" dll="libGL.so.1" />
<dllentry os="windows" dll="opengl32.dll" />
<dllentry os="osx" dll="/System/Library/Frameworks/OpenGL.framework/OpenGL" />
</dllmap>
<dllmap dll="glu32.dll">
<dllentry os="linux" dll="libGLU.so.1" />
<dllentry os="windows" dll="opengl32.dll" />
<dllentry os="osx" dll="/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib" />
</dllmap>
</configuration>