本文整理汇总了C#中SharpGL.OpenGL.BindBuffer方法的典型用法代码示例。如果您正苦于以下问题:C# OpenGL.BindBuffer方法的具体用法?C# OpenGL.BindBuffer怎么用?C# OpenGL.BindBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpGL.OpenGL
的用法示例。
在下文中一共展示了OpenGL.BindBuffer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindVBOs
public void BindVBOs(OpenGL gl, LinesProgram program)
{
var attribPos = program.Attribs["Position"];
gl.BindBuffer(_vboTarget, Position);
gl.VertexAttribPointer(attribPos, 3, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.EnableVertexAttribArray(attribPos);
attribPos = program.Attribs["ColorValue"];
gl.BindBuffer(_vboTarget, ColorValue);
gl.VertexAttribPointer(attribPos, 3, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.VertexAttribDivisor(attribPos, 1);
gl.EnableVertexAttribArray(attribPos);
if (IndicesCount > 0)
gl.BindBuffer(_iboTarget, Ibo);
}
示例2: DrawTrefoilBuffers
private void DrawTrefoilBuffers(OpenGL gl)
{
// Bind the vertex and index buffer.
gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, vertexBuffer);
gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
gl.EnableVertexAttribArray(attrPosition);
gl.EnableVertexAttribArray(attrNormal);
// Draw the geometry, straight from the vertex buffer.
gl.VertexAttribPointer(attrPosition, 3, OpenGL.GL_FLOAT, false, Marshal.SizeOf(typeof(Vertex)), IntPtr.Zero);
int normalOffset = Marshal.SizeOf(typeof(Vertex));
gl.VertexAttribPointer(attrNormal, 3, OpenGL.GL_FLOAT, false, Marshal.SizeOf(typeof(Vertex)), IntPtr.Add(new IntPtr(0), normalOffset));
gl.DrawElements(OpenGL.GL_LINES, (int)trefoilKnot.IndexCount, OpenGL.GL_UNSIGNED_SHORT, IntPtr.Zero);
}
示例3: CreateVertexNormalBuffer
public uint CreateVertexNormalBuffer(OpenGL gl)
{
Vertex[] verts = new Vertex[VertexCount * 2];
int count = 0;
float ds = 1.0f / Slices;
float dt = 1.0f / Stacks;
// The upper bounds in these loops are tweaked to reduce the
// chance of precision error causing an incorrect # of iterations.
for (float s = 0; s < 1 - ds / 2; s += ds)
{
for (float t = 0; t < 1 - dt / 2; t += dt)
{
const float E = 0.01f;
Vertex p = EvaluateTrefoil(s, t);
Vertex u = EvaluateTrefoil(s + E, t) - p;
Vertex v = EvaluateTrefoil(s, t + E) - p;
Vertex n = u.VectorProduct(v);
n.Normalize();
verts[count++] = p;
verts[count++] = n;
}
}
// Pin the data.
GCHandle vertsHandle = GCHandle.Alloc(verts, GCHandleType.Pinned);
IntPtr vertsPtr = vertsHandle.AddrOfPinnedObject();
var size = Marshal.SizeOf(typeof(Vertex)) * VertexCount;
uint[] buffers = new uint[1];
gl.GenBuffers(1, buffers);
uint handle = buffers[0];
gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, handle);
gl.BufferData(OpenGL.GL_ARRAY_BUFFER, size, vertsPtr, OpenGL.GL_STATIC_DRAW);
// Free the data.
vertsHandle.Free();
return handle;
}
示例4: Bind
/// <summary>
/// Calls VertexBuffer.Bind(gl), IndexBuffer.Bind(gl) and Material.Bind(gl).
/// </summary>
/// <param name="gl">The OpenGL</param>
public void Bind(OpenGL gl)
{
//if (gl == null)
//{
// throw new ArgumentNullException("OpenGL parameter cannot be null. Call 'GenerateGeometry(...)' before attempting to bind.");
//}
// Bind the vertex, normal and index buffers.
if (VertexBuffer != null)
{
//Bind
//VertexBuffer.BindBuffer(gl); //
gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, VertexBuffer.BufferId.Value);
gl.VertexAttribPointer(VertexAttributes.Position, BufferStride, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.EnableVertexAttribArray(VertexAttributes.Position);
}
if (NormalBuffer != null)
{
//Bind
//NormalBuffer.BindBuffer(gl); //
gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, NormalBuffer.BufferId.Value);
gl.VertexAttribPointer(VertexAttributes.Normal, BufferStride, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.EnableVertexAttribArray(VertexAttributes.Normal);
}
if (IndexBuffer != null)
{
//IndexBuffer.BindBuffer(gl); //
gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, IndexBuffer.BufferId.Value);
}
}
示例5: DrawTrefoilCelShaded
private void DrawTrefoilCelShaded(OpenGL gl)
{
// Use the shader program.
gl.UseProgram(shaderProgram.ProgramObject);
// Set the variables for the shader program.
gl.Uniform3(toonUniforms.DiffuseMaterial, 0f, 0.75f, 0.75f);
gl.Uniform3(toonUniforms.AmbientMaterial, 0.04f, 0.04f, 0.04f);
gl.Uniform3(toonUniforms.SpecularMaterial, 0.5f, 0.5f, 0.5f);
gl.Uniform1(toonUniforms.Shininess, 50f);
// Set the light position.
gl.Uniform3(toonUniforms.LightPosition, 1, new float[4] { 0.25f, 0.25f, 1f, 0f });
// Set the matrices.
gl.UniformMatrix4(toonUniforms.Projection, 1, false, projection.AsColumnMajorArrayFloat);
gl.UniformMatrix4(toonUniforms.Modelview, 1, false, modelView.AsColumnMajorArrayFloat);
gl.UniformMatrix3(toonUniforms.NormalMatrix, 1, false, normalMatrix.AsColumnMajorArrayFloat);
// Bind the vertex and index buffer.
gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, vertexBuffer);
gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
gl.EnableVertexAttribArray(attrPosition);
gl.EnableVertexAttribArray(attrNormal);
// Draw the geometry, straight from the vertex buffer.
gl.VertexAttribPointer(attrPosition, 3, OpenGL.GL_FLOAT, false, Marshal.SizeOf(typeof(Vertex)), IntPtr.Zero);
int normalOffset = Marshal.SizeOf(typeof(Vertex));
gl.VertexAttribPointer(attrNormal, 3, OpenGL.GL_FLOAT, false, Marshal.SizeOf(typeof(Vertex)), IntPtr.Add(new IntPtr(0), normalOffset));
gl.DrawElements(OpenGL.GL_TRIANGLES, (int)trefoilKnot.IndexCount, OpenGL.GL_UNSIGNED_SHORT, IntPtr.Zero);
}
示例6: SetBufferData
public void SetBufferData(OpenGL gl, IEnumerable<TransformationMatrix> transformations, OGLModelUsage usage = OGLModelUsage.StaticRead)
{
var transCount = transformations.Count();
// Validation.
if(transCount > Math.Pow(2, 24))
{
throw new OverflowException(
"This shader can't handle more than 2^24 transformations while "+
"using 24 bit colors.");
}
#region get indices
var indices = new ushort[transCount];
for (ushort i = 0; i < indices.Length; i++)
{
indices[i] = i; // Do all transformations once.
}
#endregion get indices
#region get transformations array
var stride = 16; // Transformation matrix is a 4x4 = 16.
var transformationsArray = new float[transCount * stride];
for (int i = 0; i < transCount; i++)
{
float[] transAsFloats = transformations.ElementAt(i).ResultMatrix.to_array();
for (int j = 0; j < stride; j++)
{
transformationsArray[i * stride + j] = transAsFloats[j];
}
}
#endregion get transformations array
#region get color array
int colorStride = 3;
var colorArray = new float[transCount * colorStride];
for (int i = 0; i < transCount; i++)
{
ulong id = transformations.ElementAt(i).UniqueId;
var color = new ColorF((uint) id);
colorArray[i * stride] = color.R;
colorArray[i * stride + 1] = color.G;
colorArray[i * stride + 2] = color.B;
}
#endregion get color array
gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, _indicesBufferId.Value);
gl.BufferData(OpenGL.GL_ARRAY_BUFFER, indices, (uint)usage);
gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, _transformationsBufferId.Value);
gl.BufferData(OpenGL.GL_ARRAY_BUFFER, transformationsArray, (uint)usage);
gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, _colorsBufferId.Value);
gl.BufferData(OpenGL.GL_ARRAY_BUFFER, colorArray, (uint)usage);
}
示例7: Bind
public void Bind(OpenGL gl)
{
// Bind the vertex, normal and index buffers.
if (_transformationsBufferId != null)
{
var transStride = 16;
//Bind
gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, _transformationsBufferId.Value);
gl.VertexAttribPointer(VertexAttributes.Position, transStride, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.EnableVertexAttribArray(VertexAttributes.Position);
}
if (_colorsBufferId != null)
{
var colStride = 3;
//Bind
gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, _colorsBufferId.Value);
gl.VertexAttribPointer(VertexAttributes.Normal, colStride, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.EnableVertexAttribArray(VertexAttributes.Normal);
}
if (_indicesBufferId != null)
{
gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, _indicesBufferId.Value);
}
}
示例8: DoRenderMatrix
/// <summary>
/// 渲染基质
/// </summary>
/// <param name="gl"></param>
/// <param name="renderMode"></param>
private void DoRenderMatrix(OpenGL gl, RenderMode renderMode)
{
if (this.positionBuffer == null || this.colorBuffer == null) { return; }
if (this.RenderGrid && this.matrixVertexArrayObject != null)
{
shaderProgram.SetUniform1(gl, "renderingWireframe", 0.0f);
shaderProgram.SetUniform1(gl, "opacity", this.Opacity);
gl.Enable(OpenGL.GL_POLYGON_OFFSET_FILL);
gl.PolygonOffset(1.0f, 1.0f);
gl.Enable(OpenGL.GL_BLEND);
gl.BlendFunc(SharpGL.Enumerations.BlendingSourceFactor.SourceAlpha, SharpGL.Enumerations.BlendingDestinationFactor.OneMinusSourceAlpha);
gl.BindVertexArray(matrixVertexArrayObject[0]);
switch (this.MatrixType)
{
case MatrixFormat.Triangle:
gl.DrawArrays(this.matrixRenderMode, 0, this.MatrixVertexOrIndexCount);
break;
case MatrixFormat.Tetrahedron:
gl.Enable(OpenGL.GL_PRIMITIVE_RESTART);
gl.PrimitiveRestartIndex(uint.MaxValue);
gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, this.matrixIndexBuffer[0]);
gl.DrawElements(this.matrixRenderMode, this.MatrixVertexOrIndexCount, OpenGL.GL_UNSIGNED_INT, IntPtr.Zero);
gl.Disable(OpenGL.GL_PRIMITIVE_RESTART);
break;
case MatrixFormat.TriangularPrism:
// 先渲染三棱柱的上下三角形
gl.DrawArrays(OpenGL.GL_TRIANGLES, 0, this.MatrixVertexOrIndexCount);
// 再渲染三棱柱的三个侧面
gl.Enable(OpenGL.GL_PRIMITIVE_RESTART);
gl.PrimitiveRestartIndex(uint.MaxValue);
gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, this.matrixIndexBuffer[0]);
gl.DrawElements(this.matrixRenderMode, this.MatrixVertexOrIndexCount, OpenGL.GL_UNSIGNED_INT, IntPtr.Zero);
gl.Disable(OpenGL.GL_PRIMITIVE_RESTART);
break;
default:
break;
}
gl.BindVertexArray(0);
gl.Disable(OpenGL.GL_BLEND);
gl.Disable(OpenGL.GL_POLYGON_OFFSET_FILL);
}
if (this.RenderGridWireframe && this.matrixVertexArrayObject != null)
{
shaderProgram.SetUniform1(gl, "renderingWireframe", 1.0f);
shaderProgram.SetUniform1(gl, "opacity", this.Opacity);
gl.PolygonMode(SharpGL.Enumerations.FaceMode.FrontAndBack, SharpGL.Enumerations.PolygonMode.Lines);
gl.Enable(OpenGL.GL_BLEND);
gl.BlendFunc(SharpGL.Enumerations.BlendingSourceFactor.SourceAlpha, SharpGL.Enumerations.BlendingDestinationFactor.OneMinusSourceAlpha);
gl.BindVertexArray(matrixVertexArrayObject[0]);
switch (this.MatrixType)
{
case MatrixFormat.Triangle:
gl.DrawArrays(this.matrixRenderMode, 0, this.MatrixVertexOrIndexCount);
break;
case MatrixFormat.Tetrahedron:
gl.Enable(OpenGL.GL_PRIMITIVE_RESTART);
gl.PrimitiveRestartIndex(uint.MaxValue);
gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, this.matrixIndexBuffer[0]);
gl.DrawElements(this.matrixRenderMode, this.MatrixVertexOrIndexCount, OpenGL.GL_UNSIGNED_INT, IntPtr.Zero);
gl.Disable(OpenGL.GL_PRIMITIVE_RESTART);
break;
case MatrixFormat.TriangularPrism:
// 先渲染三棱柱的上下三角形
gl.DrawArrays(OpenGL.GL_TRIANGLES, 0, this.MatrixVertexOrIndexCount / 9 * 6);
// 再渲染三棱柱的三个侧面
gl.Enable(OpenGL.GL_PRIMITIVE_RESTART);
gl.PrimitiveRestartIndex(uint.MaxValue);
gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, this.matrixIndexBuffer[0]);
gl.DrawElements(this.matrixRenderMode, this.MatrixVertexOrIndexCount, OpenGL.GL_UNSIGNED_INT, IntPtr.Zero);
gl.Disable(OpenGL.GL_PRIMITIVE_RESTART);
break;
default:
break;
}
gl.PolygonMode(SharpGL.Enumerations.FaceMode.FrontAndBack, SharpGL.Enumerations.PolygonMode.Filled);
gl.BindVertexArray(0);
gl.Disable(OpenGL.GL_BLEND);
}
}
示例9: BufferData
public void BufferData(OpenGL gl,
uint[] indices, float[] vertices, float[] colors)
{
if (indices != null)
{
gl.BindBuffer(_iboTarget, Ibo);
gl.BufferData(_iboTarget, indices, _usage);
}
gl.BindBuffer(_vboTarget, Position);
gl.BufferData(_vboTarget, vertices, _usage);
gl.BindBuffer(_vboTarget, ColorValue);
gl.BufferData(_vboTarget, colors, _usage);
}
示例10: InitShader
void IRenderable.Render(OpenGL gl, RenderMode renderMode)
{
if (positionBuffer == null || colorBuffer == null) { return; }
if (this.shaderProgram == null)
{
this.shaderProgram = InitShader(gl, renderMode);
}
if (this.vertexArrayObject == null)
{
CreateVertexArrayObject(gl, renderMode);
}
BeforeRendering(gl, renderMode);
if (this.RenderGridWireframe && this.vertexArrayObject != null)
{
//if (wireframeIndexBuffer != null)
if (positionBuffer != null && colorBuffer != null && indexBuffer != null)
{
shaderProgram.SetUniform1(gl, "renderingWireframe", 1.0f);// shader一律上白色。
gl.Disable(OpenGL.GL_LINE_STIPPLE);
gl.Disable(OpenGL.GL_POLYGON_STIPPLE);
gl.Enable(OpenGL.GL_LINE_SMOOTH);
gl.Enable(OpenGL.GL_POLYGON_SMOOTH);
gl.ShadeModel(SharpGL.Enumerations.ShadeModel.Smooth);
gl.Hint(SharpGL.Enumerations.HintTarget.LineSmooth, SharpGL.Enumerations.HintMode.Nicest);
gl.Hint(SharpGL.Enumerations.HintTarget.PolygonSmooth, SharpGL.Enumerations.HintMode.Nicest);
gl.PolygonMode(SharpGL.Enumerations.FaceMode.FrontAndBack, SharpGL.Enumerations.PolygonMode.Lines);
gl.Enable(OpenGL.GL_PRIMITIVE_RESTART);
gl.PrimitiveRestartIndex(uint.MaxValue);
gl.Enable(OpenGL.GL_BLEND);
gl.BlendFunc(SharpGL.Enumerations.BlendingSourceFactor.SourceAlpha, SharpGL.Enumerations.BlendingDestinationFactor.OneMinusSourceAlpha);
gl.BindVertexArray(this.vertexArrayObject[0]);
gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, indexBuffer[0]);
gl.DrawElements(OpenGL.GL_QUAD_STRIP, this.indexBufferLength, OpenGL.GL_UNSIGNED_INT, IntPtr.Zero);
gl.BindVertexArray(0);
gl.Disable(OpenGL.GL_BLEND);
gl.Disable(OpenGL.GL_PRIMITIVE_RESTART);
gl.PolygonMode(SharpGL.Enumerations.FaceMode.FrontAndBack, SharpGL.Enumerations.PolygonMode.Filled);
gl.Disable(OpenGL.GL_POLYGON_SMOOTH);
}
}
if (this.RenderGrid && this.vertexArrayObject != null)
{
if (positionBuffer != null && colorBuffer != null && indexBuffer != null)
{
shaderProgram.SetUniform1(gl, "renderingWireframe", 0.0f);// shader根据uv buffer来上色。
gl.Enable(OpenGL.GL_PRIMITIVE_RESTART);
gl.PrimitiveRestartIndex(uint.MaxValue);
gl.Enable(OpenGL.GL_BLEND);
gl.BlendFunc(SharpGL.Enumerations.BlendingSourceFactor.SourceAlpha, SharpGL.Enumerations.BlendingDestinationFactor.OneMinusSourceAlpha);
gl.BindVertexArray(this.vertexArrayObject[0]);
gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, indexBuffer[0]);
gl.DrawElements(OpenGL.GL_QUAD_STRIP, this.indexBufferLength, OpenGL.GL_UNSIGNED_INT, IntPtr.Zero);
gl.BindVertexArray(0);
gl.Disable(OpenGL.GL_BLEND);
gl.Disable(OpenGL.GL_PRIMITIVE_RESTART);
}
}
AfterRendering(gl, renderMode);
}
示例11: 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);
}
示例12: BindBuffer
/// <summary>
/// Calls glBindBuffer.
/// </summary>
/// <param name="gl"></param>
public virtual void BindBuffer(OpenGL gl, OGLBindBufferTarget target, VertexAttribPointer pointer = null)
{
gl.BindBuffer((uint)target, BufferId.Value);
VertexAttribPointer pointerToUse = null;
if (pointer != null)
pointerToUse = pointer;
else if (VertexAttribPointer != null)
pointerToUse = VertexAttribPointer;
if (pointerToUse != null)
{
pointerToUse.Invoke(gl);
gl.EnableVertexAttribArray(pointerToUse.Index);
}
}
示例13: BufferData
public void BufferData(OpenGL gl,
uint[] indices, float[] vertices, float[] normals,
float[] ambs, float[] diffs, float[] specs, float[] shinis,
float[] htColor)
{
gl.BindBuffer(_iboTarget, Ibo);
gl.BufferData(_iboTarget, indices, _usage);
gl.BindBuffer(_vboTarget, Position);
gl.BufferData(_vboTarget, vertices, _usage);
gl.BindBuffer(_vboTarget, Normal);
gl.BufferData(_vboTarget, normals, _usage);
gl.BindBuffer(_vboTarget, AmbientMaterial);
gl.BufferData(_vboTarget, ambs, _usage);
gl.BindBuffer(_vboTarget, DiffuseMaterial);
gl.BufferData(_vboTarget, diffs, _usage);
gl.BindBuffer(_vboTarget, SpecularMaterial);
gl.BufferData(_vboTarget, specs, _usage);
gl.BindBuffer(_vboTarget, ShininessValue);
gl.BufferData(_vboTarget, shinis, _usage);
gl.BindBuffer(_vboTarget, HTColorId);
gl.BufferData(_vboTarget, htColor, _usage);
}
示例14: BindNMVBOs
public void BindNMVBOs(OpenGL gl, NormalMaterialProgram program)
{
var attribPos = program.Attribs["Position"];
gl.BindBuffer(_vboTarget, Position);
gl.VertexAttribPointer(attribPos, 3, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.EnableVertexAttribArray(attribPos);
attribPos = program.Attribs["Normal"];
gl.BindBuffer(_vboTarget, Normal);
gl.VertexAttribPointer(attribPos, 3, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.EnableVertexAttribArray(attribPos);
attribPos = program.Attribs["AmbientMaterial"];
gl.BindBuffer(_vboTarget, AmbientMaterial);
gl.VertexAttribPointer(attribPos, 3, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.VertexAttribDivisor(attribPos, 1);
gl.EnableVertexAttribArray(attribPos);
attribPos = program.Attribs["DiffuseMaterial"];
gl.BindBuffer(_vboTarget, DiffuseMaterial);
gl.VertexAttribPointer(attribPos, 3, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.VertexAttribDivisor(attribPos, 1);
gl.EnableVertexAttribArray(attribPos);
attribPos = program.Attribs["SpecularMaterial"];
gl.BindBuffer(_vboTarget, SpecularMaterial);
gl.VertexAttribPointer(attribPos, 3, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.VertexAttribDivisor(attribPos, 1);
gl.EnableVertexAttribArray(attribPos);
attribPos = program.Attribs["ShininessValue"];
gl.BindBuffer(_vboTarget, ShininessValue);
gl.VertexAttribPointer(attribPos, 1, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.VertexAttribDivisor(attribPos, 1);
gl.EnableVertexAttribArray(attribPos);
gl.BindBuffer(_iboTarget, Ibo);
}
示例15: BindHTVBOs
public void BindHTVBOs(OpenGL gl, HitTestProgram program)
{
var attribPos = program.Attribs["Position"];
gl.BindBuffer(_vboTarget, Position);
gl.VertexAttribPointer(attribPos, 3, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.EnableVertexAttribArray(attribPos);
attribPos = program.Attribs["HTColorId"];
gl.BindBuffer(_vboTarget, HTColorId);
gl.VertexAttribPointer(attribPos, 3, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
gl.VertexAttribDivisor(attribPos, 1);
gl.EnableVertexAttribArray(attribPos);
gl.BindBuffer(_iboTarget, Ibo);
}