[SOLVED] Have doubles in a shader

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
0x72
Citizen
Posts: 51
Joined: Thu Jun 18, 2015 9:02 am

[SOLVED] Have doubles in a shader

Post by 0x72 » Tue Jun 27, 2017 6:16 pm

Hi guys! I have a problem I couldn't find answer to, but my bet is the answer is super simple and I'll feel stupid after someone help me (thanks in advance :)).

I need to use doubles in my shader code. number is just a float so it's not good.

Minimal example:

Code: Select all

vec4 effect(vec4 color, Image texture, vec2 tex_coords, vec2 screen_coords) {
  double n = 0.2; // ???
  return vec4(n, n, n, 1.0);
}

Code: Select all

Error: Cannot compile pixel shader code:
Line 2: ERROR: 'double' : Reserved word.
Line 2: ERROR: 'double' : syntax error: syntax error
Any ideas?
Last edited by 0x72 on Tue Jun 27, 2017 7:03 pm, edited 1 time in total.

User avatar
erasio
Party member
Posts: 118
Joined: Wed Mar 15, 2017 8:52 am
Location: Germany

Re: Have doubles in a shader

Post by erasio » Tue Jun 27, 2017 6:50 pm

I'm not 100% sure but did you make sure the current version of openGL / glsl supports double?

User avatar
0x72
Citizen
Posts: 51
Joined: Thu Jun 18, 2015 9:02 am

Re: Have doubles in a shader

Post by 0x72 » Tue Jun 27, 2017 7:03 pm

It looks like this is the case :( this is troublesome, but good to know. Thanks a lot :)

Post Reply

Who is online

Users browsing this forum: ivan and 8 guests