protected override void BindInternal(BufferTarget target)
        {
            Internal.OpenGL.Methods.glBindBuffer(OpenGLEngine.BufferTargetToGLBufferTarget(target), Handle);
            Internal.OpenGL.Methods.glErrorToException();

            _target = target;
        }
        protected override void SetVertexAttributeInternal(uint index, int count, ElementType type, bool normalized, int stride, uint offset)
        {
            Internal.OpenGL.Methods.glEnableVertexAttribArray(index);
            Internal.OpenGL.Methods.glErrorToException();

            Internal.OpenGL.Methods.glVertexAttribPointer(index, count, OpenGLEngine.ElementTypeToGLElementType(type), normalized, stride, new IntPtr(offset));
            Internal.OpenGL.Methods.glErrorToException();
        }
        protected override void SetDataInternal <T>(T[] data, BufferDataUsage usage)
        {
            // ohhh yeahh
            int size = data.Length * Marshal.SizeOf(typeof(T));

            GCHandle ptr = GCHandle.Alloc(data, GCHandleType.Pinned);

            try
            {
                Internal.OpenGL.Methods.glBufferData(OpenGLEngine.BufferTargetToGLBufferTarget(_target), size, ptr.AddrOfPinnedObject(), OpenGLEngine.BufferDataUsageToGLBufferDataUsage(usage));
            }
            finally
            {
                ptr.Free();
            }
            Internal.OpenGL.Methods.glErrorToException();
        }
 protected override void SetMatrixModeInternal(MatrixMode mode)
 {
     Internal.OpenGL.Methods.glMatrixMode(OpenGLEngine.MatrixModeToGLMatrixMode(mode));
 }
Beispiel #5
0
 protected override void DrawArraysInternal(RenderMode mode, int start, int count)
 {
     Internal.OpenGL.Methods.glDrawArrays(OpenGLEngine.RenderModeToGLRenderMode(mode), start, count);
     Internal.OpenGL.Methods.glErrorToException();
 }
Beispiel #6
0
 protected override void SetMaterialParameterInternal(FaceName face, MaterialParameterName parm, float value)
 {
     Internal.OpenGL.Methods.glMaterialf(OpenGLEngine.FaceToGLFace(face), OpenGLEngine.MaterialParameterNameToGLConst(parm), value);
 }
 protected override void UnbindInternal()
 {
     Internal.OpenGL.Methods.glBindBuffer(OpenGLEngine.BufferTargetToGLBufferTarget(_target), 0);
     Internal.OpenGL.Methods.glErrorToException();
 }