Jump to content

  • Log In with Google      Sign In   
  • Create Account

kloffy

Member Since 10 Apr 2005
Offline Last Active May 25 2016 05:54 AM

Posts I've Made

In Topic: Object reference not set to an instance of an object

20 April 2016 - 11:40 PM

Just curious: My C# is rusty, but isn't there anything like this?
 
private static IEnumerable<T> Generate(Func<T> f) {
    while (true) yield return f();
}

Used like so:
 
var Planets = Generate(() => new PlanetDetails()).Take(10).ToArray();

Feels a bit more straightforward than WozNZ's suggestions.

In Topic: How to all the coordinate systems relate to each other?

23 February 2016 - 04:42 AM

If you just name the spaces, and the tranformation matrixes from them, I find it less confusing.
 
Model space ---(m2w matrix)--> world space ---(w2v matrix)---> view space ---(v2p)---> projection space,  etc..


Yes, that is exactly the kind of convention I would love to see catching on. I think it would remove a lot of potential for confusion...

In Topic: How to all the coordinate systems relate to each other?

23 February 2016 - 04:22 AM

I always thought the terminology was a bit confusing in regard to this. Typically, you have something like:

Object Space -- Model Transform --> World Space -- View Transform --> Camera Space -- Projection Transform --> Clip Space (or Normalized Device Coordinates)

That's a lot of names, and some people use slightly different ones. We could get rid of half of the names if we just used the same ones for spaces and transforms (e.g. object, world, view, projection space/transform). However somehow I doubt people will agree on one convention anytime soon...

In Topic: vertex shader useless when using geometry shader?

21 February 2016 - 12:32 AM

It depends, but in general I would say the more computation you can offload to the vertex shader the better. For example, if you're just transforming vertices, depending on your primitive topology, the geometry shader may end up doing more operations. But as always in optimisation, benchmarking is key...

In Topic: GLSL - Strange behavior with "inout" parameter - Bug?

10 November 2015 - 11:42 PM

You did not fully initialize the matrix. Getting random junk should be expected, or—more likely—it should not compile.

Are you sure? I am setting all of its values. Regardless, even if I initialize the matrix, I do not get the expected gray color.

mat2 color = mat2(1.0);
set(color, 0, 0, 0, 0.5);
set(color, 0, 0, 1, 0.5);
set(color, 0, 1, 0, 0.5);
set(color, 0, 1, 1, 1.0);
frag_color = vec4(get(color, 0, 0, 0), get(color, 0, 0, 1), get(color, 0, 1, 0), get(color, 0, 1, 1));

PARTNERS