Forum Xamarin.iOS


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

OpenGL ES 1.1 on 64 Bit

ArndvonOppenkowskiArndvonOppenkowski DEBeta ✭✭
edited September 2015 in Xamarin.iOS

Hello guys,

I am stuck migrating my game to 64bit. A 32bit build works fine on a 64bit device but a 64bit build does not.

I think the pointers are screwed up in my render method on 64 bit but I have no clue how to fix this. All I see is a black screen.

protected void RenderInternal()

        if (VertexList.Count > 0)
            var vertices = VertexList.ToArray();

            // Preserve pointers during rendering:
                fixed (Vector3* posPointer = &vertices[0].Position)
                    fixed (Vector2* texPointer = &vertices[0].TexCoords)
                        fixed (Color4* colorPointer = &vertices[0].Color)
                            // Set the pointers and render the array:
                            GL.VertexPointer(TexturedColoredVertex.PositionSize, TexturedColoredVertex.PositionType, TexturedColoredVertex.Stride, (IntPtr)posPointer);
                            GL.TexCoordPointer(TexturedColoredVertex.TexturePositionSize, TexturedColoredVertex.TexturePositionType, TexturedColoredVertex.Stride, (IntPtr)texPointer);
                            GL.ColorPointer(TexturedColoredVertex.ColorSize, TexturedColoredVertex.ColorType, TexturedColoredVertex.Stride, (IntPtr)colorPointer);
                            GL.DrawArrays(PrimitiveType, 0, vertices.Length);


Did anbody run into the same issue and can help me?

Thanks in advance




  • I forgot to say that I m using interleaved vertex data.

  • Hey guys,

    I figured it out by myself. I hope that this will help you when using OpenTK with interleaved vertex data.
    The whole struct must be packed and the field offsets must be set explicitly.

    /// <summary>
    /// Textured vertex.
    /// </summary>
    [StructLayout(LayoutKind.Explicit, Pack = 1)]
    public struct TexturedColoredVertex
      public Vector3 Position;
      public Vector2 TexCoords;
      public Color4 Color;

    Regards Arnd

Sign In or Register to comment.