glColorPointer and GL_BGRA

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
riveranb
Posts: 28
Joined: Fri Sep 23, 2011 9:37 am

glColorPointer and GL_BGRA

Post by riveranb »

I have a problem on color issue when using VBO.
I find my vertex color may be drawn incorrectly sometimes if I use glColorPointer (4, GL_UNSIGNED_BYTE , sizeof(SVertex***), buffer_offset(24));
But if I use glColorPointer( GL_BGRA, GL_UNSIGNED_BYTE, sizeof(SVertex***), buffer_offset(24));
The vertex colors are rendered correctly.

I am confused about the argument GL_BGRA.
Look at the spec.
http://www.opengl.org/sdk/docs/man/xhtm ... ointer.xml
There did not mention anything about GL_BGRA, the first argument should be the size of components.

So is there anyone know this ?
Any help would be appreciated.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: glColorPointer and GL_BGRA

Post by hybrid »

You probably have to look up the proper BGRA extension as well. In this case it's a relatively new one: GL_ARB_vertex_array_bgra or the EXT version of it. This allows to define the vertex colors in a new order, which uses the Irrlicht native BGRA scheme. So you can only specify that value if your OpenGL version supports this extension. Just check the COpenGLDriver.cpp file for how Irrlicht makes use of it.
Post Reply