rakkarage's picture

new rectangles...

quickstart still references System.Drawing

Error 1 The type 'System.Drawing.Rectangle' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. D:\projects\OpenTK\Source\QuickStart\Game.cs 43 13 QuickStart

where it uses ClientRectangle


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rakkarage's picture

i guess its supposed to use X and Y and Width and Height

iRBiS's picture

Hi! How did you find out the line and column number (43, 13)? I want to look into why I can't call GL.Light() without 'System.Drawing.Color' but when I build, it just gives me the error, it doesn't say anything about its location or open a source file or anything...

[Edit]
Example: GL.Light(LightName.Light0, LightParameter.Position, Vector4.UnitZ);

the Fiddler's picture

Right now, OpenTK is not usable if you don't include System.Drawing in your references.

I have written replacements for System.Drawing.Point, Size, Rectangle, Color and Icon (available in branches/sysdrawing), but I'm hesitating to merge this work back to trunk as it is going to break existing applications heavily. Applications that rely on GLControl will be the most affected, as System.Windows.Forms rely on System.Drawing heavily.

I think it might be best to ship with the System.Drawing dependency and maybe provide a lightweight System.Drawing.dll replacement for platforms where this is not available.

iRBiS's picture

I see.

rakkarage's picture

ok well i added a bug for QuickStart missing System.Drawing

yes please merge that stuff intro trunk or let us use it somehow, thanks

kanato's picture

I wrote similar replacement classes for AgateLib, and it's great for applications that don't want to reference System.Drawing, but it's a hassle for any application that needs to use both use AgateLib and System.Drawing or System.Windows.Forms. I provide a separate assembly to convert structures between their AgateLib versions and WinForms versions. Additionally I found that the compiler would complain about using a function if it has an overload that takes a System.Drawing structure, it would ask that the program being compiled would reference System.Drawing, even if though it wasn't using System.Drawing structures anywhere. So I couldn't have a pair of function overloads taking the custom structure and the System.Drawing structure because the compiler would still want client applications to have the reference to System.Drawing.

the Fiddler's picture
rakkarage wrote:

ok well i added a bug for QuickStart missing System.Drawing

yes please merge that stuff intro trunk or let us use it somehow, thanks

Thanks for the bug report. You can use current trunk all right if you add a reference to System.Drawing.

@kanato: these issues is the exact reason why I haven't merged this work to trunk. Arguably, the worst issue is the namespace clash when using WinForms.

Right now, I am leaning towards removing the new classes from OpenTK and going back to System.Drawing. I don't really like the extra dependency, but I think this might be the less evil alternative. Still investigating.

iliak's picture

I don't think it would be a good idea to replace System.Drawing classes...

the Fiddler's picture

I have already reverted the changes in question.

Quite annoyingly, you can find at least three distinct, incompatible implementations of the classes in question inside the framework: System.Drawing, WPF and XNA all implement Color, Point and Rectangle structures from scratch.