سؤال

Just wondering if there's a way to create a Vec3 outside the shaders. For example in my program I want to have something like:

function()
{
  vec3 a =  vec3 (x, y, z)
}

But at the moment I'm getting the error 'vec3 is undefined'. Is there a library I can include, or some other way to fix this?

هل كانت مفيدة؟

المحلول

There is a .h file that comes with OpenGL Red book 8th edition called vmath.h that does what you want. You can include it in your source file and use it almost as if you were in a shader.

نصائح أخرى

You can. It works just as how you think it works. In your example code did you forget to add the ";"?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top