draders's picture

VBOs with colours

Hello,

I am using vertex buffer objects based on the code found at http://www.opentk.com/node/425 and have it all working well except it renders fully opaque despite the colours having a non opaque alpha channel.

Here is the rendering portion of the code:

    // Colours
    if (vbo.ColourId != 0) {                    
        GL.BindBuffer(BufferTarget.ArrayBuffer, vbo.ColourId);
        GL.ColorPointer(4, ColorPointerType.UnsignedByte, sizeof(int), IntPtr.Zero);                    
        GL.EnableClientState(EnableCap.ColorArray);                
    }
 
    // Vertices
    GL.BindBuffer(BufferTarget.ArrayBuffer, vbo.VertexId);
    GL.VertexPointer(3, VertexPointerType.Float, Vector3.SizeInBytes, IntPtr.Zero);            
    GL.EnableClientState(EnableCap.VertexArray);
 
    //Elements
    GL.BindBuffer(BufferTarget.ElementArrayBuffer, vbo.ElementId);            
    GL.DrawElements(BeginMode.Triangles, vbo.ElementCount, DrawElementsType.UnsignedInt, IntPtr.Zero);

Is there some cap/mode I need to enable in order for this to work?

Thanks.


Comments

Comment viewing options

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

Yes, you need to set a blend mode and enable blending. Check out the blending documentation.