Take the 2-minute tour ×  Is there some way to send a struct
like:  struct COLOR {     float r, g, b, a;  directly into
glColor*() function as one parameter? Would make the code nicer.
I could make own function and send separetely each R,G,B,A
values onto glColor4f() but that wouldnt be that nice. So im
looking a way to send it the most optimal way as possible.
share|improve this question add comment  3 Answers  up vote 5
down vote accepted COLOR color; glColor4fv((GLfloat*) &color);
Update: I wouldn't recommend creating an inline function,
however, you could use GLfloat in your struct to get the
expression clearer. Use &color.r to avoid a compiler warning.
struct COLOR {   GLfloat r,g,b,a; COLOR color; share|improve
this answer hmm, is it possible to make it any cleaner from
that? –  Newbie Oct 17 '10 at 19:41 actually, I think it's as
clear as it can possibly be. –  Viktor Sehr Oct 17 '10 at 19:47
@Newbie: You can just do glColor4fv(&color.r), assuming GLfloat
is just float. –  GManNickG Oct 17 '10 at 1