public static void TexCoordPointerListIBM(Int32 size, TexCoordPointerType type, Int32 stride, IntPtr[] pointer, Int32 ptrstride) { unsafe { fixed (IntPtr* p_pointer = pointer) { Debug.Assert(Delegates.pglTexCoordPointerListIBM != null, "pglTexCoordPointerListIBM not implemented"); Delegates.pglTexCoordPointerListIBM(size, (Int32)type, stride, p_pointer, ptrstride); CallLog("glTexCoordPointerListIBM({0}, {1}, {2}, {3}, {4})", size, type, stride, pointer, ptrstride); } } DebugCheckErrors(); }
public static void MultiTexCoordPointerEXT(Int32 texunit, Int32 size, TexCoordPointerType type, Int32 stride, Object pointer) { GCHandle pin_pointer = GCHandle.Alloc(pointer, GCHandleType.Pinned); try { MultiTexCoordPointerEXT(texunit, size, type, stride, pin_pointer.AddrOfPinnedObject()); } finally { pin_pointer.Free(); } }
public static void VertexArrayMultiTexCoordOffsetEXT(UInt32 vaobj, UInt32 buffer, Int32 texunit, Int32 size, TexCoordPointerType type, Int32 stride, IntPtr offset) { Debug.Assert(Delegates.pglVertexArrayMultiTexCoordOffsetEXT != null, "pglVertexArrayMultiTexCoordOffsetEXT not implemented"); Delegates.pglVertexArrayMultiTexCoordOffsetEXT(vaobj, buffer, texunit, size, (Int32)type, stride, offset); CallLog("glVertexArrayMultiTexCoordOffsetEXT({0}, {1}, {2}, {3}, {4}, {5}, 0x{6})", vaobj, buffer, texunit, size, type, stride, offset.ToString("X8")); DebugCheckErrors(); }
public static void TexCoordPointer(int size, TexCoordPointerType type, int stride, int offset) { TexCoordPointer(size, type, stride, (IntPtr)offset); }
public static void MultiTexCoordPointerEXT(Int32 texunit, Int32 size, TexCoordPointerType type, Int32 stride, IntPtr pointer) { Debug.Assert(Delegates.pglMultiTexCoordPointerEXT != null, "pglMultiTexCoordPointerEXT not implemented"); Delegates.pglMultiTexCoordPointerEXT(texunit, size, (Int32)type, stride, pointer); CallLog("glMultiTexCoordPointerEXT({0}, {1}, {2}, {3}, 0x{4})", texunit, size, type, stride, pointer.ToString("X8")); DebugCheckErrors(); }
public void TexCoordPointer(int size, TexCoordPointerType type, int stride, IntPtr pointer) { gl.glTexCoordPointer(size, (int)type, stride, pointer); }
internal static extern void glTexCoordPointer(Int32 size, TexCoordPointerType type, Int32 stride, IntPtr pointer);
public static unsafe extern void TexCoordPointerListIBM( int size, TexCoordPointerType type, int stride, void** pointer, int ptrstride );
public static void TexCoordPointer(Int32 size, TexCoordPointerType type, Int32 stride, IntPtr pointer) { Debug.Assert(Delegates.pglTexCoordPointer != null, "pglTexCoordPointer not implemented"); Delegates.pglTexCoordPointer(size, (Int32)type, stride, pointer); LogFunction("glTexCoordPointer({0}, {1}, {2}, 0x{3})", size, type, stride, pointer.ToString("X8")); DebugCheckErrors(null); }
public static unsafe extern void TexCoordPointer( int size, TexCoordPointerType type, int stride, void* pointer );
public static void TexCoordPointerEXT(Int32 size, TexCoordPointerType type, Int32 stride, Int32 count, Object pointer) { GCHandle pin_pointer = GCHandle.Alloc(pointer, GCHandleType.Pinned); try { TexCoordPointerEXT(size, type, stride, count, pin_pointer.AddrOfPinnedObject()); } finally { pin_pointer.Free(); } }
public override void Render() { if (DesignMode) { return; } MakeCurrent(); GL.Viewport(0, 0, ClientSize.Width, ClientSize.Height); //clear GL.ClearColor(Color.Black); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); if (Camera == null) { return; } //projection matrix Matrix4 projection = Camera.Projection; GL.MatrixMode(MatrixMode.Projection); GL.LoadMatrix(ref projection); //view matrix Matrix4 view = Camera.View; GL.MatrixMode(MatrixMode.Modelview); GL.LoadMatrix(ref view); if (DrawAxes) { // debug axes GL.Begin(BeginMode.Lines); //x GL.Color3(Color.Red); GL.Vertex3(Vector3.Zero); GL.Vertex3(Vector3.UnitX); GL.Vertex3(Vector3.UnitX); GL.Vertex3(Vector3.UnitX + new Vector3(-0.125f, 0.125f, 0.0f)); GL.Vertex3(Vector3.UnitX); GL.Vertex3(Vector3.UnitX + new Vector3(-0.125f, -0.125f, 0.0f)); //y GL.Color3(Color.Green); GL.Vertex3(Vector3.Zero); GL.Vertex3(Vector3.UnitY); GL.Vertex3(Vector3.UnitY); GL.Vertex3(Vector3.UnitY + new Vector3(0.125f, -0.125f, 0.0f)); GL.Vertex3(Vector3.UnitY); GL.Vertex3(Vector3.UnitY + new Vector3(-0.125f, -0.125f, 0.0f)); //z GL.Color3(Color.Blue); GL.Vertex3(Vector3.Zero); GL.Vertex3(Vector3.UnitZ); GL.Vertex3(Vector3.UnitZ); GL.Vertex3(Vector3.UnitZ + new Vector3(0, -0.125f, -0.125f)); GL.Vertex3(Vector3.UnitZ); GL.Vertex3(Vector3.UnitZ + new Vector3(0, 0.125f, -0.125f)); GL.End(); } if (Model != null) { GL.PushMatrix(); GL.PushAttrib(AttribMask.PolygonBit | AttribMask.EnableBit | AttribMask.LightingBit | AttribMask.CurrentBit); GL.UseProgram(shaderProgram); GL.Enable(EnableCap.DepthTest); GL.Disable(EnableCap.CullFace); GL.Enable(EnableCap.Texture2D); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); GL.FrontFace(FrontFaceDirection.Cw); GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, 0); int loc = GL.GetUniformLocation(shaderProgram, "colorMap"); GL.Uniform1(loc, 0); for (int i = 0; i < Model.Meshes.Length; ++i) { Mesh mesh = Model.Meshes[i]; //pin handles to stream data GCHandle[] streamDataGCHandles = new GCHandle[mesh.VertexStreams.Length]; for (int j = 0; j < streamDataGCHandles.Length; ++j) { streamDataGCHandles[j] = GCHandle.Alloc(mesh.VertexStreams[j].Data, GCHandleType.Pinned); } //fetch material definition and vertex layout VertexLayout vertexLayout = mesh.GetVertexLayout(0); GL.Color3(meshColors[i % meshColors.Length]); switch (RenderMode) { case RenderModes.Wireframe: { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); } break; case RenderModes.Smooth: { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); } break; } //position VertexLayout.Entry.DataTypes positionDataType = VertexLayout.Entry.DataTypes.None; int positionStream = 0; int positionOffset = 0; bool positionExists = vertexLayout.GetEntryInfo(VertexLayout.Entry.DataUsages.Position, 0, out positionDataType, out positionStream, out positionOffset); if (positionExists) { IntPtr positionData = streamDataGCHandles[positionStream].AddrOfPinnedObject(); GL.EnableClientState(ArrayCap.VertexArray); GL.VertexPointer(3, VertexPointerType.Float, mesh.VertexStreams[positionStream].BytesPerVertex, positionData + positionOffset); } //normal VertexLayout.Entry.DataTypes normalDataType = VertexLayout.Entry.DataTypes.None; int normalStream = 0; int normalOffset = 0; bool normalExists = vertexLayout.GetEntryInfo(VertexLayout.Entry.DataUsages.Normal, 0, out normalDataType, out normalStream, out normalOffset); if (normalExists) { IntPtr normalData = streamDataGCHandles[normalStream].AddrOfPinnedObject(); GL.EnableClientState(ArrayCap.NormalArray); GL.NormalPointer(NormalPointerType.Float, mesh.VertexStreams[normalStream].BytesPerVertex, normalData + normalOffset); } //texture coordiantes VertexLayout.Entry.DataTypes texCoord0DataType = VertexLayout.Entry.DataTypes.None; int texCoord0Stream = 0; int texCoord0Offset = 0; bool texCoord0Exists = vertexLayout.GetEntryInfo(VertexLayout.Entry.DataUsages.Texcoord, 0, out texCoord0DataType, out texCoord0Stream, out texCoord0Offset); if (texCoord0Exists) { IntPtr texCoord0Data = streamDataGCHandles[texCoord0Stream].AddrOfPinnedObject(); GL.EnableClientState(ArrayCap.TextureCoordArray); TexCoordPointerType texCoord0PointerType = TexCoordPointerType.Float; switch (texCoord0DataType) { case VertexLayout.Entry.DataTypes.Float2: texCoord0PointerType = TexCoordPointerType.Float; break; case VertexLayout.Entry.DataTypes.float16_2: texCoord0PointerType = TexCoordPointerType.HalfFloat; break; default: break; } GL.TexCoordPointer(2, texCoord0PointerType, mesh.VertexStreams[texCoord0Stream].BytesPerVertex, texCoord0Data + texCoord0Offset); } //indices GCHandle indexDataHandle = GCHandle.Alloc(mesh.IndexData, GCHandleType.Pinned); IntPtr indexData = indexDataHandle.AddrOfPinnedObject(); GL.DrawElements(BeginMode.Triangles, (int)mesh.IndexCount, DrawElementsType.UnsignedShort, indexData); indexDataHandle.Free(); GL.DisableClientState(ArrayCap.VertexArray); GL.DisableClientState(ArrayCap.NormalArray); GL.DisableClientState(ArrayCap.TextureCoordArray); //free stream data handles for (int j = 0; j < streamDataGCHandles.Length; ++j) { streamDataGCHandles[j].Free(); } } GL.UseProgram(0); GL.PopAttrib(); } SwapBuffers(); }
public static unsafe void TexCoordPointerEXT( int size, TexCoordPointerType type, int stride, int count, void* pointer ) { if (_TexCoordPointerEXT == null) throw new Exception( "Extension method TexCoordPointerEXT not found" ); _TexCoordPointerEXT( size, type, stride, count, pointer ); }
public abstract void TexCoordPointer <T0>([Flow(FlowDirection.In)] int size, [Flow(FlowDirection.In)] TexCoordPointerType type, [Flow(FlowDirection.In)] uint stride, [Flow(FlowDirection.In)] uint count, [Count(Computed = "size, type, stride, count"), Flow(FlowDirection.In)] ref T0 pointer) where T0 : unmanaged;
public abstract unsafe void TexCoordPointer([Flow(FlowDirection.In)] int size, [Flow(FlowDirection.In)] TexCoordPointerType type, [Flow(FlowDirection.In)] uint stride, [Flow(FlowDirection.In)] uint count, [Count(Computed = "size, type, stride, count"), Flow(FlowDirection.In)] void *pointer);