本文整理汇总了C#中SharpGL.OpenGL.GenVertexArrays方法的典型用法代码示例。如果您正苦于以下问题:C# OpenGL.GenVertexArrays方法的具体用法?C# OpenGL.GenVertexArrays怎么用?C# OpenGL.GenVertexArrays使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpGL.OpenGL
的用法示例。
在下文中一共展示了OpenGL.GenVertexArrays方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VAO
public VAO(OpenGL gl, IShaderProgram program, VBO vbo)
{
_gl = gl;
_program = program;
VBO = vbo;
var buffers = new uint[1];
gl.GenVertexArrays(1, buffers);
Handle = buffers[0];
using (new Bind(program))
using (new Bind(this))
using (new Bind(vbo))
{
var stride = Vect3f.SizeInBytes * 2 + Vect4f.SizeInBytes;
gl.EnableVertexAttribArray(0);
gl.VertexAttribPointer(0, 3, OpenGL.GL_FLOAT, true, stride, IntPtr.Zero);
gl.BindAttribLocation(program.Handle, 0, "vert_position");
gl.EnableVertexAttribArray(1);
gl.VertexAttribPointer(1, 3, OpenGL.GL_FLOAT, true, stride, new IntPtr(Vect3f.SizeInBytes));
gl.BindAttribLocation(program.Handle, 1, "vert_normal");
gl.EnableVertexAttribArray(2);
gl.VertexAttribPointer(2, 4, OpenGL.GL_FLOAT, false, stride, new IntPtr(Vect3f.SizeInBytes * 2));
gl.BindAttribLocation(program.Handle, 2, "vert_colour");
}
}
示例2: Mesh
public Mesh(OpenGL gl, MeshType type)
{
this.gl = gl;
this.bufferCount = 0;
Type = type;
uint[] arrs = new uint[1];
gl.GenVertexArrays(1, arrs);
ID = arrs[0];
}
示例3: CreateVertexArrayObject
private void CreateVertexArrayObject(OpenGL gl, RenderMode renderMode)
{
if (this.positionBuffer == null || this.colorBuffer == null) { return; }
this.vertexArrayObject = new uint[1];
gl.GenVertexArrays(1, this.vertexArrayObject);
gl.BindVertexArray(this.vertexArrayObject[0]);
// prepare positions
{
int location = shaderProgram.GetAttributeLocation(gl, in_Position);
ATTRIB_INDEX_POSITION = (uint)location;
gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, positionBuffer[0]);
gl.VertexAttribPointer(ATTRIB_INDEX_POSITION, 3, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.EnableVertexAttribArray(ATTRIB_INDEX_POSITION);
}
// prepare colors
{
int location = shaderProgram.GetAttributeLocation(gl, in_uv);
ATTRIB_INDEX_UV = (uint)location;
gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, colorBuffer[0]);
gl.VertexAttribPointer(ATTRIB_INDEX_UV, 1, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.EnableVertexAttribArray(ATTRIB_INDEX_UV);
}
gl.BindVertexArray(0);
}
示例4: PrepareNMVAO
public void PrepareNMVAO(OpenGL gl, NormalMaterialProgram program)
{
var vertArrIds = new uint[1];
gl.GenVertexArrays(1, vertArrIds);
VaoNM = vertArrIds[0];
gl.BindVertexArray(VaoNM);
BindNMVBOs(gl, program);
gl.EnableVertexAttribArray(0);
gl.BindVertexArray(0);
}
示例5: PrepareHTVAO
public void PrepareHTVAO(OpenGL gl, HitTestProgram program)
{
var vertArrIds = new uint[1];
gl.GenVertexArrays(1, vertArrIds);
VaoHT = vertArrIds[0];
gl.BindVertexArray(VaoHT);
BindHTVBOs(gl, program);
gl.EnableVertexAttribArray(0);
gl.BindVertexArray(0);
}
示例6: initGLObjects
private void initGLObjects(OpenGL gl, out uint vaoHandle, out uint programHandle)
{
uint[] vaos = new uint[1];
gl.GenVertexArrays(1, vaos);
vaoHandle = vaos[0];
programHandle = gl.CreateProgram();
}
示例7: PrepareVAO
public void PrepareVAO(OpenGL gl, LinesProgram program)
{
var vertArrIds = new uint[1];
gl.GenVertexArrays(1, vertArrIds);
Vao = vertArrIds[0];
gl.BindVertexArray(Vao);
BindVBOs(gl, program);
gl.EnableVertexAttribArray(0);
gl.BindVertexArray(0);
}
示例8: VAO
public VAO(OpenGL gl)
{
_gl = gl;
_gl.GenVertexArrays(2, _vao);
}