void IVertexData.SetupVBO(Resources.BatchInfo mat) { GL.EnableClientState(ArrayCap.ColorArray); GL.EnableClientState(ArrayCap.VertexArray); GL.ColorPointer(4, ColorPointerType.UnsignedByte, Size, (IntPtr)OffsetColor); GL.VertexPointer(3, VertexPointerType.Float, Size, (IntPtr)OffsetPos); }
void IVertexData.SetupVBO(Resources.BatchInfo mat) { GL.EnableClientState(ArrayCap.ColorArray); GL.EnableClientState(ArrayCap.VertexArray); GL.EnableClientState(ArrayCap.TextureCoordArray); GL.ColorPointer(4, ColorPointerType.UnsignedByte, Size, (IntPtr)OffsetColor); GL.VertexPointer(3, VertexPointerType.Float, Size, (IntPtr)OffsetPos); GL.TexCoordPointer(4, TexCoordPointerType.Float, Size, (IntPtr)OffsetTex0); if (mat.Technique.Res.Shader.IsAvailable) { Resources.ShaderVarInfo[] varInfo = mat.Technique.Res.Shader.Res.VarInfo; for (int i = 0; i < varInfo.Length; i++) { if (varInfo[i].glVarLoc == -1) { continue; } if (varInfo[i].scope != Resources.ShaderVarScope.Attribute) { continue; } if (varInfo[i].type != Resources.ShaderVarType.Float) { continue; } GL.EnableVertexAttribArray(varInfo[i].glVarLoc); GL.VertexAttribPointer(varInfo[i].glVarLoc, 1, VertexAttribPointerType.Float, false, Size, (IntPtr)OffsetAttrib); break; } } // --- From VertexP3T2A2 --- //Resources.ShaderVarInfo[] varInfo = mat.Technique.Res.Shader.Res.VarInfo; //for (int i = 0; i < varInfo.Length; i++) //{ // if (varInfo[i].glVarLoc == -1) continue; // if (varInfo[i].scope != Resources.ShaderVarScope.Attribute) continue; // GL.EnableVertexAttribArray(varInfo[i].glVarLoc); // int curIndex = 0; // switch (varInfo[i].type) // { // case Resources.ShaderVarType.Float: // GL.VertexAttribPointer(varInfo[i].glVarLoc, varInfo[i].arraySize, VertexAttribPointerType.Float, false, Size, (IntPtr)(OffsetAttrib + sizeof(float) * curIndex)); // curIndex += varInfo[i].arraySize; // break; // case Resources.ShaderVarType.Vec2: // GL.VertexAttribPointer(varInfo[i].glVarLoc, 2, VertexAttribPointerType.Float, false, Size, (IntPtr)(OffsetAttrib + sizeof(float) * curIndex)); // curIndex += 2; // break; // } //} }
void IVertexData.FinishVBO(Resources.BatchInfo mat) { GL.DisableClientState(ArrayCap.ColorArray); GL.DisableClientState(ArrayCap.VertexArray); GL.DisableClientState(ArrayCap.TextureCoordArray); if (mat.Technique.Res.Shader.IsAvailable) { Resources.ShaderVarInfo[] varInfo = mat.Technique.Res.Shader.Res.VarInfo; for (int i = 0; i < varInfo.Length; i++) { if (varInfo[i].glVarLoc == -1) { continue; } if (varInfo[i].scope != Resources.ShaderVarScope.Attribute) { continue; } if (varInfo[i].type != Resources.ShaderVarType.Float) { continue; } GL.DisableVertexAttribArray(varInfo[i].glVarLoc); break; } } // --- From VertexP3T2A2 --- //Resources.ShaderVarInfo[] varInfo = mat.Technique.Res.Shader.Res.VarInfo; //for (int i = 0; i < varInfo.Length; i++) //{ // if (varInfo[i].glVarLoc == -1) continue; // if (varInfo[i].scope != Resources.ShaderVarScope.Attribute) continue; // GL.DisableVertexAttribArray(varInfo[i].glVarLoc); //} }
void IVertexData.FinishVBO(Resources.BatchInfo mat) { GL.DisableClientState(ArrayCap.ColorArray); GL.DisableClientState(ArrayCap.VertexArray); }