View Full Version : color format
I'm using direct3d vertex format where color is 32 bits integer (ARGB). I want to redirect vertices stream to OGL renderer but I have problem with color - is it possible to use ARGB packed color (32 bit integer) in OpenGL ??
chanel | alpha | red | green | blue |
bits | 24-31 | 16-23 | 8-15 | 0-7 |
01-13-2004, 05:36 AM
OpenGL supports 32 bit colors only in RGBA format (byte order). Ie
DWORD bits on x86
[31...24] [23...16] [15...8] [7...0]
alpha blue green red
Should be easy enough to swizzle to that format. Corresponding vertex layout setup:
This isn't advanced ...
we missunderstood - I have color in d3d format which means ARGB and I want to use this color for Opengl vertices - but opengl uses RGBA so :
I have color in format
chanel |alpha|red |green|blue |
bits |0-7 |8-15|16-23|24-31|
and I have to use this color in OpenGL renderer - I found extension ext_BGRA but I need something like ext_ARGB.
Isn't this advanced ??? http://www.opengl.org/discussion_boards/ubb/smile.gif
01-13-2004, 06:16 AM
There is no way. You can use ARGB as texture data, but not for vertex colors.
You must convert the colors to OpenGL's format.
//still not advanced
make_GLish_color(unsigned int DXish_color)
01-14-2004, 07:17 AM
Maybe color matrix?
Mamy takie same nazwiska
01-14-2004, 07:30 AM
I guess this post is one big confusion. So, you have got a windows-sheme texture and you want to upload it to opengl, right?
Use BGRA - that's what you need:
B G R A
0-7 8-15 16-23 24 - 31
01-14-2004, 07:55 AM
No, he's got ARGB vertices. You can't feed those to the GL at all. You could do the swizzling in a vertex program, but it's better to do it manually on load, as zeckensack explained, so that you can forget about it at runtime.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.