neokabuto / OpenTKTutorialContent

Project files from OpenTK tutorials from my blog
MIT License
98 stars 22 forks source link

Part 9.3, materials #8

Open RickardAhlstedt opened 5 years ago

RickardAhlstedt commented 5 years ago

Hi! First off, great work. Although I have found some problems regarding the ObjVolume-class, but it's quite an easy fix to replace StringBuilder with a simple string. And float.TryParse requires some additional parameters such as setting the decimal-separator to use a dot instead. (My locale of my dev-machine is set to use swedish currency).

My suggestion here is:

CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone();
ci.NumberFormat.CurrencyDecimalSeparator = ".";

And then adding , NumberStyles.Any, ci, to every float.TryParse Example:

bool success = float.TryParse(texcoordparts[0], NumberStyles.Any, ci, out vec.X);

As for my problem, I can't get the textures to work properly using OpenTK 3.0 (runtime-version 2.0.50727), the count for the texture-list remains zero.

Good to note, I also applied the above-fix for Material.cs, and I store my files in /data/Models/ and shaders in /data/Shaders/.
Any pointers are welcome, submitting this as an issue due to perhaps get the above-fix implemented

neokabuto commented 5 years ago

Thanks, I'm going to make this change with the other upcoming changes: https://github.com/neokabuto/OpenTKTutorialContent/pull/13/commits/2046b91b70feb4a0920d6e0072794b6acef157bd