private void VertexAttribPointer(uint indx, int size, uint type, bool normalize, int stride, Stream pointer) { WebGLBufferData b = _buffers[indx]; b.Stride = stride; b.Size = size; b.Normalized = normalize; b.Type = type; b.ToBind = GetTypedArray(pointer, type); }
private void UpdatTCBuffer(Stream s, int offset, int count) { WebGLBufferData b = _buffers[ARRAY_TEXCOORD_0]; gl.BindBuffer(GLES20.ARRAY_BUFFER, b.Buffer); long p = s.Position; long l = s.Length; s.Position = p + offset; s.SetLength(p + offset + count); gl.BufferSubData(GLES20.ARRAY_BUFFER, offset * 4, GetTypedArray(s, GLES20.FLOAT)); s.Position = p; s.SetLength(l); }
private void PrepareDraw() { if (UpdateMvpMatrix()) { gl.UniformMatrix4fv(_uMvpMatrix, false, _mvpMatrix); CheckError("prepareDraw"); } gl.Uniform1i(_uTexEnv0, GetTextureMode(0)); gl.Uniform1i(_uTexEnv1, GetTextureMode(1)); for (uint indx = 0; indx < SMALL_BUF_COUNT; indx++) { WebGLBufferData b = _buffers[indx]; if (b.ToBind != null) { gl.BindBuffer(GLES20.ARRAY_BUFFER, b.Buffer); CheckError("bindBuffer" + indx); gl.BufferData(GLES20.ARRAY_BUFFER, b.ToBind, GLES20.STREAM_DRAW); CheckError("bufferData" + indx); gl.VertexAttribPointer(indx, b.Size, b.Type, b.Normalized, b.Stride, 0); CheckError("vertexAttribPointer"); b.ToBind = null; } } //Log("prepDraw: " + sizes); }
public WebGL15ContextImpl() : base(100, 100) { gl = null; #endif if (gl == null) throw new Exception("UnsupportedOperationException: WebGL N/A"); InitShaders(); CheckError("initShader"); _elementBuffer = gl.CreateBuffer(); CheckError("createBuffer f. elements"); for (int index = 0; index < _buffers.Length; index++) { WebGLBufferData b = new WebGLBufferData(); b.ToBind = null; b.Buffer = gl.CreateBuffer(); CheckError("createBuffer" + index); b.Stride = 0; b.Size = 0; b.Type = 0; b.ByteSize = 0; b.Normalized = false; _buffers[index] = b; } }
public WebGL15ContextImpl() : base(100, 100) { gl = null; #endif if (gl == null) { throw new Exception("UnsupportedOperationException: WebGL N/A"); } InitShaders(); CheckError("initShader"); _elementBuffer = gl.CreateBuffer(); CheckError("createBuffer f. elements"); for (int index = 0; index < _buffers.Length; index++) { WebGLBufferData b = new WebGLBufferData(); b.ToBind = null; b.Buffer = gl.CreateBuffer(); CheckError("createBuffer" + index); b.Stride = 0; b.Size = 0; b.Type = 0; b.ByteSize = 0; b.Normalized = false; _buffers[index] = b; } }