OpenGL questions

I am fighting OpenGL at the moment. I wanted to use it to be cross platform, but it is giving me headaches with VertexShaders and other areas. I have about half a dozen shaders in DX working great.

Does anyone know if sin and cos have issues in OpenGL? I’ve found stackoverflow articles relating to it and how you need to use fmod() to keep values in bounds or you have to add a better function mod() from GLSL. Especially with Intel hardware.

I was searching for other devs shaders with similar issues. This one by NemoKrad Flag.FX file for DX (github link) is an example of it happening in OpenGL. I traced back the issue to the cos and sin functions. If I do the sin/cos math in C# and send in the data to the shader via a parameter, it works correctly.

Has anyone else seen something similar?

Thanks,
David

If a shader works in DX, but not GL, it’s usually a MojoShader problem. ShaderConductor will probably do a better job. If you don’t mind the limited platform support, I would suggest you try the compute fork.
If you do, use shader model 4 or 5.

5 Likes