PDA

View Full Version : A header file for colours.



Aamrun
07-16-2005, 03:59 AM
Call me nuts, but I was fed up with specifying vectors for colours and then one fine day intelligence dawned!

I figured why not convert the HTML colour constants to RGB values and store them in a header file with their OpenGL names of course.

Now if you want red

you have glLightfv(GL_LIGHT0,GL_DIFFUSE,red);

just #include<colour.h>

Its a great convenience.

(PS. Sorry if this work has already been done)

just mail me at

ag_iitkgp@yahoo.co.uk

for the file. Its free!

knackered
07-16-2005, 06:03 AM
Yeah, I got fed up with writing 3.1415926535897932384626433832795 all the time, and had a brain wave...why not use the C preprocessor command #define.
So I came up with a header called pi.h
If you want it, email me on waste@mytime.com

Matt Zamborsky
07-16-2005, 09:37 AM
ill be glad to have your pi.h, I have a program in which I have to write 3.1415926535897932384626433832795 for 51 times.
Please email me it on dontpost@advanceforum.com :D

SirKnight
07-16-2005, 01:54 PM
OMG I would have never thought of this! Geniuses you are.

BAHAHAHAHA! :D

-SirKnight

Matt Zamborsky
07-16-2005, 02:07 PM
I think that its not appropriate to post this kind of things to Advanced forum.

RigidBody
07-18-2005, 09:59 PM
certainly not, but this time it ended up
having a great entertainment value :D

by the way: M_PI (M_PI_2, M_PI_4), M_E and some
other constants can be found in math.h ...

M/\dm/\n
07-19-2005, 08:45 AM
Yeah, with small trick... At least in MSVC

Snippet from math.h

/* Define _USE_MATH_DEFINES before including math.h to expose these macro
* definitions for common math constants. These are placed under an #ifdef
* since these commonly-defined names are not part of the C/C++ standards.
*/AFAIK, Nvidia SDK files included M_■■ definitions with higher precision. I allways wondered why, if everything is droped down to float, multiplied via float arithmetic x times and is ruinded via z precision...