PDA

View Full Version : Best RGBA colour format?



IainR
09-05-2000, 04:24 AM
Hi,

I was wondering if there is an RGBA format that is most widely optimised by OpenGL drivers; for instance, is it usually better to specify RGBA values as bytes rather than floats?

Thanks for any insights!
Iain

IainR
09-05-2000, 05:32 AM
... I should mention that this is in relation to glColor calls and materials definitions.

Iain

Bob
09-05-2000, 09:42 AM
Heard (I mean read) on this forum earlier, that a GeForce, for example, won't use hardware T&L if you pass vertices as other types that float, if you do, it will fall back on software T&L.

And (almost) everything is used as floats, so if you stick to floats, no unessecary type casts will occur. And floats are quite fast too.

IainR
09-06-2000, 12:18 AM
Thanks for replying Bob. You refer to vertices here, but I was really wanting to know about RGBA values - does this advice hold for those as well? It's really for things like glColor that I need to know, but I guess it's also important when uploading textures.

I was under the impression that using byte triples/quadruples was the preferred method for RGB/RGBA values, but maybe I'm wrong.

Eric
09-06-2000, 12:40 AM
Hi there !

Well Bob, you are right : for vertices/normals/texcoords, one should use floats to have the best acceleration...

On the other hand, for colors, one should use bytes !

There is a paper at nvidia.com about which types to use....

Regards.

Eric

IainR
09-06-2000, 01:31 AM
Thanks Eric, I should have guessed that NVidia has info on it!

Bob
09-06-2000, 01:55 AM
Well, yeah, I was talking about vertices, but as an example that types DO matter in some cases.

Anyways, didn't know you should use bytes in colors though. Though it was floats, because keeping the colors in the range [0.0, 1.0] will make all calculations easy since no normalization is needed. I guess I have to read the paper too http://www.opengl.org/discussion_boards/ubb/smile.gif

Eric
09-06-2000, 03:12 AM
Hi again !

Bob, I agree with you : I started doing everything with floats before discovering that nVidia advised to use bytes for colors...

Regards.

Eric

IainR
09-06-2000, 03:20 AM
Yes, I'm currently using floats, but I suspect that bytes are more widely supported.

I must see if there's any documentation on other graphics cards manufacturer's websites.

Bob
09-06-2000, 04:16 AM
... and I still haven't read the document http://www.opengl.org/discussion_boards/ubb/rolleyes.gif

Well, I can see a reason to use a specified type for vertices, since it's used in HWT&L. But, I can't see any major reason (I don't consider float->byte-converion as major reason) to use a specific type for colors. Is there any reason for this, I mean something like the above mentioned hardware or software acceleration for two different types?

IainR
09-06-2000, 04:41 AM
Well, if you do your own lighting and pass OpenGL a colour for each vertex, then it's presumably better to send the colours in its 'native' format to save a little time.

Apart from that, I can't really think of a place where you'd send lots of colour information (apart from when you upload a texture, in which case it's almost certainly best to use the 'native' format if possible, to save time).