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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:57:00+00:00 2026-06-02T16:57:00+00:00

I am confused with the internal format related to texture2D() in GLSL and glTexImage2D()

  • 0

I am confused with the internal format related to texture2D() in GLSL and glTexImage2D() in OpenGL, When I use(pay attention to the third and the eighth parameters):

glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA16F_ARB, WINDOW_SIZE, WINDOW_SIZE, 0, GL_RGBA, 
            GL_FLOAT, floatDataPtr);

I got the nonclampedvalue of sampler2D in the glsl without clamped to [0, 1]:

vec4 nonclampedvalue = texture2D(my16floattex2d, texcoord1);

When I use:

glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA8, WINDOW_SIZE, WINDOW_SIZE, 0, GL_RGBA, 
            GL_UNSIGNED_BYTE, byteDataPtr);

I got the clampedvalue of sampler2D in the glsl clamped to [0, 1]:

vec4 clampedvalue = texuture2D(myunsignedbytetex2d, texcoord2);

So my questions are this:

  1. What value will I get in glsl when invoke the glTexImage2D like this(clamped or not clamped):

    glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA8, WINDOW_SIZE, WINDOW_SIZE, 0, GL_RGBA, 
           GL_FLOAT, floatDataPtr);
    
  2. What value will I get in glsl when invoke the glTexImage2D like this(clamped or not clamped):

    glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA16F_ARB, WINDOW_SIZE, WINDOW_SIZE, 0, GL_RGBA,
            GL_UNSIGNED_BYTE, byteDataPtr);
    
  3. As I can’t find the detailed information in OpenGL official website, What value will be return in the sampler2D texture with different internal format as well as different type(such as GL_FLOAT or GL_UNSIGNED_BYTE mentioned above) of the data passed to the texture when invoke the glTexImage2D()? what’s all the rules?

Does anyone can help?

  • 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-02T16:57:02+00:00Added an answer on June 2, 2026 at 4:57 pm

    What value will I get in glsl when invoke the glTexImage2D like this(clamped or not clamped):

    This is governed only by the “internal format” parameter. Normalized internal formats are… normalized. They don’t store floating point values; they store integer values which are interpreted as floats. The maximum integer value becomes 1.0 and the minimum becomes 0.0 (or -1.0 if it’s an SNORM format).

    As I can’t find the detailed information in OpenGL official website

    Look harder next time; it’s right there on the Wiki. The “internal format” used for creating textures and renderbuffers. It even explains that the last three parameters govern pixel transfer operations: uploading data to the image.

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

Sidebar

Related Questions

I am getting confused with the internal working of DOM. Eg: Does document.form.write() means
Edit : SOLVED Right. I found the thing that confused me. I use pgadmin
I'm confused about what scenarios you would use one or the other. If you
I don't use prefix while naming internal variables of a class (I know some
I am really confused to understand its internal working This is LINQ syntax string[]
I'm confused. I'm developing a grails based internal tool for my company. One component
confused - given a track uri, I can get one album but possibly more
Confused here... I have two dates which I NSLog to console and get: dates
Mildly confused. I have a combobox that is databound to a list of strings.
Really confused why the QR output using RcppArmadillo is different than QR output from

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.