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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:42:33+00:00 2026-06-03T08:42:33+00:00

Consider the following GLSL functions: float Pow3 (const in float f) { return f

  • 0

Consider the following GLSL functions:

float Pow3 (const in float f) {
    return f * f * f;
}

float Pow4 (const in float f) {
    return f * f * f * f;
}

float Pow5 (const in float f) {
    return f * f * f * f * f;
}

… and so on. Is there a way to #define a GLSL macro that can generate n multiplications-of-f-by-itself at compile time, not using the built-in GLSL pow() function of course?

  • 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-03T08:42:34+00:00Added an answer on June 3, 2026 at 8:42 am

    GLSL preprocessor “equals” to the standard C preprocessor. Indeed, you can reach what you want with the following preprocessor definition:

    #define POW(a, b) Pow ## b ## (a)
    

    But pay attention, since the concatenation operator (##) is available only starting from GLSL 1.30. Indeed using previous GLSL versions this macro will generate a compiler error.

    Still wondering why you don’t use the pow function…

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

Sidebar

Related Questions

Consider following scenario: I have RESTful URL /articles that returns list of articles user
Consider following example: #include <iostream> #include <functional> #include <algorithm> #include <vector> #include <boost/bind.hpp> const
Please consider following example: The source image consists of 6 areas that need to
Consider following situation: there is ComboBox and a filter TextBox, then user types a
consider following url: http://sitename.com/School/Admin/PageViewer i have a subfolder in School named UserFiles that contains
Consider following code public class City { public string Name { get { return
Consider following program: static void Main (string[] args) { int i; uint ui; i
Consider following SWT code example: http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java?view=co How can I separate the inline defined class?
Consider following script: SET LANGUAGE 'German' GO SET DATEFIRST 1 GO DECLARE @FullDate DATETIME
Consider following: $(#myform).attr({ action: @Url.Action(MVC.Thing.Delete().AddRouteValue(id, myJsModel.Id )) }); I'm trying to set the action

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.