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 { /// /// Native OpenGL implementation of an effect technique. /// public class EffectTechniqueGL3 : INativeEffectTechnique { #region Private /// /// The native shader handle. /// internal int programHandle; /// /// The active attributes of this technique. /// internal ShaderAttributeGL3[] activeAttributes; /// /// We currently have only one pass per technique. /// private EffectPass pass; private EffectGL3 parentEffect; #endregion #region Public /// /// The name of the effect technique. /// public string Name { get; private set; } /// /// The passes of the technique. /// public IEnumerable Passes { get { yield return pass; } } public EffectAnnotationCollection Annotations { get { throw new NotImplementedException(); } } public EffectGL3 Parent { get { return parentEffect; } } #endregion #region Constructor /// /// Create a ne effect technique object. /// internal EffectTechniqueGL3(EffectGL3 setParentEffect, string setName, int setProgramHandle) { parentEffect = setParentEffect; Name = setName; programHandle = setProgramHandle; GetAttributes(); pass = new EffectPass(new EffectPassGL3(this)); } #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 public void Dispose() { } } }