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 8341667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:33:08+00:00 2026-06-09T05:33:08+00:00

In OpenGL ES 2 you can set an array of strings as the shader

  • 0

In OpenGL ES 2 you can set an array of strings as the shader source

void ShaderSource( uint shader, sizei count, const char **string, const int *length );

Which can be used to “inject” macros into the shader source. The corresponding function in WebGL only takes a single string as it seems.

void shaderSource(WebGLShader shader, DOMString source)

Is the only possibility to use macros to manually insert them in the source string?

  • 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-09T05:33:10+00:00Added an answer on June 9, 2026 at 5:33 am

    I’m not sure what you mean by inject macros

    const char* str1 = "foo";
    const char* str2 = "bar";
    const char* strings[] = { str1, str2, }
    
    glShaderSource(shader, 2, strings, NULL);
    

    is functionally equivalent to

    var str1 = "foo";
    var str2 = "bar";
    var strings = [str1, str2];
    gl.shaderSource(shader, strings.join(""));
    

    So, in answer to you question. If you want to insert macros prepend them to the string you supply to gl.shaderSource. There’s nothing special about macros and which string they come. As far as GL is concerned it’s just one big string.

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

Sidebar

Related Questions

I want to use shading on my OpenGL objects but can't seem to access
I've been reading that M3G is something based on OpenGL ES...so can I work
How can I render mathematical notations / expressions in Python with OpenGL? I'm actually
Can you blend Java and native OpenGL calls. For instance having the setup happen
Can CUDA be used to generate OpenGL textures? I know it can be done
When we can get good speed with OpenGL since it uses texture memory and
How can I render a bunch of hand drawn shapes in opengl 1.x? I
How can I scale a random 3d model to fit in an opengl viewport?
I'm don't understand how we can positioning objects with opengl. All transformation values is
I want to draw my opengl es animation in a customed UIView, how can

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.