Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8681479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:31:14+00:00 2026-06-12T21:31:14+00:00

So I have this fragment shader, which was working great until I refactored some

  • 0

So I have this fragment shader, which was working great until I refactored some logic out into a separate function. I want to be able to call it multiple times to layer different versions of the effect on top of each other.

However, as soon as I created this custom function, the shader starts throwing the error:

ERROR: 0:33: 'grid' : no matching overloaded function found 

Which is wierd, because it appears to be compiling it as function. If I remove the return from grid() I get this error too:

ERROR: 0:36: '' : function does not return a value: grid

So what am I missing here about declaring functions?

Full shader here:

uniform float brightness;
uniform float shiftX;
uniform float shiftY;

uniform vec4 color;
varying vec3 vPos;

void main() {
  gl_FragColor = vec4( grid(200.0), 0.0, 0.0, 1.0 );
}

float grid(float size) {
  float x = pow(abs(0.5 - mod(vPos.x + shiftX, 200.0) / 200.0), 4.0);
  float y = pow(abs(0.5 - mod(vPos.y + shiftY, 200.0) / 200.0), 4.0);
  return (x+y) * 5.0 * pow(brightness, 2.0);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T21:31:15+00:00Added an answer on June 12, 2026 at 9:31 pm

    You either have to put the grid function before the main or forward declare it as you would in c.

    Such as:

    float grid(float size);
    

    before the main method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to access 2 textures in 1 fragment shader. For this I have
I have a very basic fragment shader which I want to output 'gl_PrimitiveID' to
I am still trying to read pixels from fragment shader and I have some
I have a fragment shader that iterates over some input data and on old
Say I have this HTML fragment <td width=25% style=text-align:right; > <span style=font-family: Arial; font-size:
I have this application where I implement the ActionBar Fragment interface. Underlying the interface,
I have a Fragment with ImageView . How I can show this Fragment on
I have an xml layout for a Fragment (android.support.v4.app.Fragment). When this Fragment is added
I have fragment that on a component click pop-ups DialogFragment. This dialog fragment holds
Using this sample : I have make my own Fragment that holds tabhost and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.