GLSL - Working with double

Started by juemisorg, December 29, 2013, 11:26:09

Previous topic - Next topic

juemisorg

Hi.

Is someone could please explain to me how to send a double value to a shader
with glUniform* 's functions ?

Thank you very much.

quew8

None of the OpenGL core profiles support working with doubles on the GPU. A quick Google search revealed this extension: http://www.opengl.org/registry/specs/ARB/gpu_shader_fp64.txt so if it really necessary, and your graphics card supports this extension, then you can use this (from what a quick glance has told me) exactly the same as you would floats in the core profile. There may even be others, you can look for yourself if this isn't enough.

However, the reason that there is no support in even the 4.4 core profile is that very few graphics cards will support this. The reason very few graphics cards support this is that doubles are not fast compared to floats and speed is what they are built for. For graphical . B) Your end users' systems probably won't support this either. C) Even if they do it won't be fast enough for the most GPU intensive applications.

So I would recommend not using this. What is it that you want to use these doubles for?

juemisorg

Thanks's

I'm experimenting some fractals's rendering with my new graphics card (who is supporting doubles).
I saw the new opengl Uniformxd functions, and i know that i can use them as for float functions.
But LWJGL doesn't seems to have implemented them, and i don't know how to send doubles to
my shaders.








quew8

Well now you do. You can check the extension is supported by "GLContext.get capabilities().XXXXXX where XXXXXX is the name of the extension. Then LWJGL will have a class also with the name of the extension (but with camel case) from which you can access the extension's functions and constants.

juemisorg

I try this

if (GLContext.getCapabilities().GL_ARB_gpu_shader_fp64) {
            org.lwjgl.opengl.ARBGpuShaderFp64.glUniform1d("str", value);
}


and it works.

It's a functionnality that i didn't know.

Thank's very much.

quew8

No problem. Perhaps it's more widely supported than I thought if yours just supported it.