georgwaechter's picture

Add [Serializable] attribute to structures in OpenTK.Math [resolved]

Hello,

i would suggest to add the [Serializable] attribute to structures like Matrix4x4 or Vector3. So you are able to serialize the data to a file.

I currently need this, because i have a file format for storing vector special graphics, internally i want to use structures out of the OpenTK.Math namespace.

What do you think?

regards

georg wächter


Comments

Comment viewing options

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

Already done this for the double-precision structures in 0.9.1 is the [Serializable] attribute. Will add to the rest before release.

[edit: spelling]

georgwaechter's picture

cool :)

oyvindra's picture

Hi, I don't think Vector3 is marked as serializable in 0.9.1, and it really should be :)

I've just started to use OpenTK, and I must say it works really well so far, except for the abovementioned, and how the OpenGLControl looks while editing in VS2005

the Fiddler's picture

How does GLControl look in the designer? There used to be some issues with redrawing, but these were fixed at some point. Can you please start a new topic, maybe with a screenshot? (I no longer have VS2005).

oyvindra's picture

Any info on [Serializable] for Vector3;

or how can I find / use vector3d (which is set as [Serializable] from OpenTK 0.9.1 (can I?), and are there any large differences between vector3 and vector3d?

the Fiddler's picture

The difference between Vector3 and Vector3d is that the former is using floats; the latter doubles. The double-precision structures are not yet available (that's not that big of a problem, since GL2 doesn't support double precision primitives).

I've just added the serializable attribute to the Vector*, Matrix4 and Quaternion structs in SVN, along with operator== implementations. To use the updated code, checkout from SVN and compile OpenTK (head to the Build/ directory and type "build vs" from a command prompt to create a VS2005 solution).