GL.Color4(byte, byte, byte, byte) and (float, ...) really ought to have separate method names.
GL.Color4(1, 1, 1, 1) and GL.Color4(1, 1, 1, 1.0) have completely different behavior, and it's a non-obvious source of bugs...
Posted Monday, 18 October, 2010 - 14:46 by the Fiddler
You should always use the floating-point version of immediate-mode functions, such as GL.Color4. Everything else involves a transformation on the CPU (4 multiplications/casts) and is going to be slower. You can use OpenTK.Graphics.Color4 instead of System.Drawing.Color.
Note that immediate-mode has been removed from the latest OpenGL versions. The issue you mention is specific to GL.Color[34] and doesn't affect modern functionality such as vertex buffer objects. Even if this were possible to fix now, there would be little point.
(Note that OpenTK cannot work without System.Drawing.Color right now - this is definitely going to be fixed in a future version.)
Posted Thursday, 21 October, 2010 - 19:33 by jdomnitz
I have a branched version of OpenTK for my project....and removed all references to System.Windows.Forms and System.Drawing (implementing my own version of System.Drawing.Graphics using just OpenGL).
Honestly, probably the best way to remove the System.Drawing dependency would be to move all methods that depend on its types to extension methods in another assembly.. That way someone trying to have a minimal download won't need to include things like cornflower blue. :)
Also, http://openmobile.sourceforge.net/main/ suggests all of your source is GPLv3. I can't speak for anyone else but in my case that definitely puts a damper on trying that in my project. Thanks though :)
Comments
Re: Overloads with differing meanings
This only happens if you don't use Vector structs or System.Drawing.Color.
Re: Overloads with differing meanings
...and? Not using those is the best way to use one's own structures, and the most similar to normal OpenGL programming.
As for System.Drawing.Color, I intend to have no System.Drawing dependency. Not to mention System.Drawing.Color is a terrible piece of code.
Re: Overloads with differing meanings
You should always use the floating-point version of immediate-mode functions, such as GL.Color4. Everything else involves a transformation on the CPU (4 multiplications/casts) and is going to be slower. You can use OpenTK.Graphics.Color4 instead of System.Drawing.Color.
Note that immediate-mode has been removed from the latest OpenGL versions. The issue you mention is specific to GL.Color[34] and doesn't affect modern functionality such as vertex buffer objects. Even if this were possible to fix now, there would be little point.
(Note that OpenTK cannot work without System.Drawing.Color right now - this is definitely going to be fixed in a future version.)
Re: Overloads with differing meanings
I have a branched version of OpenTK for my project....and removed all references to System.Windows.Forms and System.Drawing (implementing my own version of System.Drawing.Graphics using just OpenGL).
Our System.Drawing.Color implementation:
http://openmobile.svn.sourceforge.net/viewvc/openmobile/trunk/FrontEnd/O...
...In case that helps anyone
Re: Overloads with differing meanings
Honestly, probably the best way to remove the System.Drawing dependency would be to move all methods that depend on its types to extension methods in another assembly.. That way someone trying to have a minimal download won't need to include things like cornflower blue. :)
Also, http://openmobile.sourceforge.net/main/ suggests all of your source is GPLv3. I can't speak for anyone else but in my case that definitely puts a damper on trying that in my project. Thanks though :)