PDA

View Full Version : suggestion: refining functions



paulm.
05-31-2005, 05:29 PM
i was wondering if its ever a possibility that opengl functions take unsigned ints rather than ints for various parameters such as dimension values. a horizontal or vertical dimension will never be negative so i set up my code to make sure all dimension or (size_t) values are of unsigned int. id rather not type cast (to remove warnings) when passing my values in. anyway around this? perhaps overloading these functions?

thankyou,
paulm.

SirKnight
05-31-2005, 06:33 PM
Yeah I don't know why they use int instead of uint as you say, the dimension values can't be negative. But this is the way it was done and I doubt it will change. The largest positive number you can store in an int is pretty darn big and I doubt we'll need anything bigger for dimensions any time soon. I guess what you could do is make wrappers for the GL calls that pass the types you would rather use and the wrapper will do the casting so you won't have to worry about it later. It would be easier to just go back and make your structures ints instead. You're not going to need the extra range the unsigned type gives anyway.

-SirKnight

sqrt[-1]
05-31-2005, 06:36 PM
Just write a wrapper around the functions that bug you or just do the casts. (just a small (GLsizei) which is a no-op)

You could also just change your header (gl/gl.h) file to replace these GLsizei with GLuint. Most platforms it would work, but not something I would recommend.

There is no way you are going to get the ARB to change the spec.

(keep in mind that the ARB usually create entry points to accomodate new and unknown future extensions, so in the future perhaps some new texture type or setup state could take negative values)

[Edit]
Drat! beaten again...

paulm.
05-31-2005, 08:33 PM
>>Just write a wrapper around the functions that bug you or just do the casts. (just a small(GLsizei) which is a no-op)
will do. makes sense.

>>(keep in mind that the ARB usually create entry points to accomodate new and unknown future extensions, so in the future perhaps some new texture type or setup state could take negative values)
very true, i agree. -1 invalid texture, etc

thanks all,
paulm.

paulm.
05-31-2005, 09:15 PM
forgot to state..

>>The largest positive number you can store in an int is pretty darn big and I doubt we'll need anything bigger for dimensions any time soon.
>>You're not going to need the extra range the unsigned type gives anyway.
>>-SirKnight

agreed. i realize this i just like the idea of using a variable that enforces its sign.

thanks,
paulm.