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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:16:06+00:00 2026-05-10T18:16:06+00:00

I am displaying a texture that I want to manipulate without out affecting the

  • 0

I am displaying a texture that I want to manipulate without out affecting the image data. I want to be able to clamp the texel values so that anything below the lower value becomes 0, anything above the upper value becomes 0, and anything between is linearly mapped from 0 to 1.

Originally, to display my image I was using glDrawPixels. And to solve the problem above I would create a color map using glPixelMap. This worked beautifully. However, for performance reasons I have begun using textures to display my image. The glPixelMap approach no longer seems to work. Well that approach may work but I was unable to get it working.

I then tried using glPixelTransfer to set scales and bias’. This seemed to have some sort of effect (not necessarily the desired) on first pass, but when the upper and lower constraints were changed no effect was visible.

I was then told that fragment shaders would work. But after a call to glGetString(GL_EXTENSIONS), I found that GL_ARB_fragment_shader was not supported. Plus, a call to glCreateShaderObjectARB cause a nullreferenceexception.

So now I am at a loss. What should I do? Please Help.


What ever might work I am willing to try. The vendor is Intel and the renderer is Intel 945G. I am unfortunately confined to a graphics card that is integrated on the motherboard, and only has gl 1.4.

Thanks for your response thus far.

  • 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. 2026-05-10T18:16:06+00:00Added an answer on May 10, 2026 at 6:16 pm

    Unless you have a pretty old graphics-card, it’s surprising that you don’t have fragment-shader support. I’d suggest you try double-checking using this.

    Also, are you sure you want anything above the max value to be 0? Perhaps you meant 1? If you did mean 1 and not 0 then are quite long-winded ways to do what you’re asking.

    The condensed answer is that you use multiple rendering-passes. First you render the image at normal intensity. Then you use subtractive blending (look up glBlendEquation) to subtract your minimum value. Then you use additive blending to multiply everything up by 1/(max-min) (which may need multiple passes).

    If you really want to do this, please post back the GL_VENDOR and GL_RENDERER for your graphics-card.

    Edit: Hmm. Intel 945G don’t have ARB_fragment_shader, but it does have ARB_fragment_program which will also do the trick.

    Your fragment-code should look something like this (but it’s been a while since I wrote any so it’s probably bugged)

    !!ARBfp1.0 ATTRIB tex = fragment.texcoord[0] PARAM cbias = program.local[0] PARAM cscale = program.local[1] OUTPUT cout = result.color  TEMP tmp TXP tmp, tex, texture[0], 2D SUB tmp, tmp, cbias MUL cout, tmp, cscale  END  

    You load this into OpenGL like so:

    GLuint prog; glEnable(GL_FRAGMENT_PROGRAM_ARB); glGenProgramsARB(1, &prog); glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog); glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(src), src); glDisable(GL_FRAGMENT_PROGRAM_ARB); 

    Then, before rendering your geometry, you do this:

    glEnable(GL_FRAGMENT_PROGRAM_ARB); glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog); colour4f cbias = cmin; colour4f cscale = 1.0f / (cmax-cmin); glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, cbias.r, cbias.g, cbias.b, cbias.a); glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, cscale.r, cscale.g, cscale.b, cscale.a);  //Draw your textured geometry  glDisable(GL_FRAGMENT_PROGRAM_ARB); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some scientific image data that's coming out of a detector device in
I am currently trying to get RGB data for a texture image, while displaying
My app is displaying some data in tabular form (400 rows and 7 columns
I have some (OpenCV) code that generates images. I'm displaying these using OpenGL. When
I am trying to scale an image without using the function gluScaleImage which is
I'm having troube displaying a texture to a plane of two triangles. My texture
I am trying to load and display a .png image that has transparency in
When displaying a paragraph with some long strings without line breaks in an UIWebView
When I launch my game I want the screen to show a loading image
Whats the recommended way of displaying a background image in an OpenGL ES app.

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.