ramblingcoder's picture

VBO Texture problem. Black cube.

I'm attempting to write an easy to use VBO example but I've run into a snag of my own while attempting to run the code.

I have included the source code for the project because I'm not exactly sure where the fault lies and I'm hoping someone with more experience could point out the error.

The picture shows the project running with the left cube drawn with out using the VBO commands and the right side using the VBO commands.

They both (with the exception of color) pull values from the same array for texture coordinates, locations, and normals.

Thank you for your time.

Inline Images
Expected result on left side. Actual result on the right side.
AttachmentSize
Test1.zip77.55 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ramblingcoder's picture

Solved my issue. I replaced

GL.VertexPointer(3, VertexPointerType.Float, Marshal.SizeOf(default(Vertex)), 0);
GL.NormalPointer(NormalPointerType.Float, Marshal.SizeOf(default(Vertex)), 12);
GL.TexCoordPointer(2, TexCoordPointerType.Float, Marshal.SizeOf(default(Vertex)), 20);
GL.ColorPointer(4, ColorPointerType.Float, Marshal.SizeOf(default(Vertex)), 32);

with

GL.InterleavedArrays(InterleavedArrayFormat.T2fN3fV3f, 0, IntPtr.Zero);

and changed the vertex class from

        public Vector3 location;
        public Vector3 normal;
        public Vector2 texture;
        public Vector4 color;

to

        public Vector2 texture;
        public Vector3 normal;
        public Vector3 position;

Hope this helps someone else.

AttachmentSize
Test1.zip39.49 KB