Konstantin Koch 930b2526f7 made the WindowsGame example work again with all available rendersystems.
Also made the recording inputsystem not selectable for that sample as that needs some code modification in the sample to make it work.
It was not possible to run it with openGL because the creation of the windowInfo object was faulty, it might have worked on linux, but it didn't work on windows.
Also updated a few deprecated calls for OpenGL.
Closing an OpenGL application did wrongly throw an exception when an effect gets disposed, this is fixed now and the memory usage was slightly reduced.
For DirectX 11, which didn't work for the samples out of the box, it was changed that the sharpdx effect dll's are now part of the directx 11 rendersystem so that they don't have to be copied over manually anymore.
Did some very small change to the RecordingGamePad class which makes it work if no data is recorded or played back.
2015-03-15 01:14:25 +01:00

88 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using ANX.Framework.Graphics;
using ANX.Framework.NonXNA;
using OpenTK.Graphics.OpenGL;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.RenderSystem.GL3
{
/// <summary>
/// Native OpenGL implementation of an effect technique.
/// </summary>
public class EffectTechniqueGL3 : INativeEffectTechnique
{
#region Private
/// <summary>
/// The native shader handle.
/// </summary>
internal int programHandle;
/// <summary>
/// The active attributes of this technique.
/// </summary>
internal ShaderAttributeGL3[] activeAttributes;
/// <summary>
/// We currently have only one pass per technique.
/// </summary>
private EffectPass pass;
private Effect parentEffect;
#endregion
#region Public
/// <summary>
/// The name of the effect technique.
/// </summary>
public string Name { get; private set; }
/// <summary>
/// The passes of the technique.
/// </summary>
public IEnumerable<EffectPass> Passes
{
get { yield return pass; }
}
public EffectAnnotationCollection Annotations
{
get { throw new NotImplementedException(); }
}
#endregion
#region Constructor
/// <summary>
/// Create a ne effect technique object.
/// </summary>
internal EffectTechniqueGL3(Effect setParentEffect, string setName, int setProgramHandle)
{
parentEffect = setParentEffect;
Name = setName;
programHandle = setProgramHandle;
GetAttributes();
pass = new EffectPass(parentEffect);
}
#endregion
#region GetAttributes
private void GetAttributes()
{
int attributeCount;
GL.GetProgram(programHandle, GetProgramParameterName.ActiveAttributes,
out attributeCount);
activeAttributes = new ShaderAttributeGL3[attributeCount];
for (int index = 0; index < attributeCount; index++)
{
activeAttributes[index] = new ShaderAttributeGL3(programHandle, index);
}
}
#endregion
}
}