Exemplo n.º 1
0
        /// <summary>
        /// Convert an internal data type to a native gl one.
        /// </summary>
        /// <returns></returns>
        private VertexAttribType ToGLPointerType(DataType emotionDataType)
        {
            bool parsed = Enum.TryParse(emotionDataType.ToString(), out VertexAttribType nativeDataType);

            if (!parsed)
            {
                Engine.Log.Warning($"Couldn't parse data type - {emotionDataType}", MessageSource.GL);
            }

            return(nativeDataType);
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public override void AttachDataBufferToVertexArray(uint dataBufferId, uint vertexArrayBufferId, uint shaderIndex, uint componentCount, DataType dataType, bool normalized, uint stride,
                                                           IntPtr offset)
        {
            GLThread.ExecuteGLThread(() =>
            {
                BindVertexArrayBuffer(vertexArrayBufferId);
                BindDataBuffer(dataBufferId);
                Gl.EnableVertexAttribArray(shaderIndex);
                CheckError($"after enabling vertex array attributes {shaderIndex}");
                Gl.VertexAttribPointer(shaderIndex, (int)componentCount, ToGLPointerType(dataType), normalized, (int)stride, offset);

                CheckError($"after setting vertex array attribute {shaderIndex}");
            });
        }