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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:19:41+00:00 2026-06-04T17:19:41+00:00

I am writing a straightforward image viewer for displaying images on a couple of

  • 0

I am writing a straightforward image viewer for displaying images on a couple of triangles in OpenGL ES 2.0 on Android. There is a particular colour in these images that must be replaced with black in some way. The problem is that if GL_LINEAR is used for my min and maxifying filters, the outline of the colour that needs to be replaced remains visible. If I use GL_NEAREST for my filters, the shader is able to replace the colour without too much difficulty, however it doesn’t render the images as smoothly and of course looks pixelated when zooming in and out.

I wonder if there is a better way to perform this type of task. Some ideas I’ve had are:

  • Build another shader that runs only once on the texture pixels and replaces the colours before the texture is actually used during my fragment shader?
  • Rewrite my shader so that it works even when GL_LINEAR is used.

Can anyone give me any clues as to how this is usually done? The reason I’d rather perform this operation in the shader is so that I can ensure that the mask pixel colour always stays black.

I am quite new to OpenGL ES 2.0 but I am trying to learn how things work. Please keep that in mind, and help me to learn. Thanks in advance.

  • 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-04T17:19:42+00:00Added an answer on June 4, 2026 at 5:19 pm

    In that case (mask always same place), I think you’ve got more options.

    I would create a single channel image with mask areas as 1 and unmasked areas with 0.

    Then in the shader, you sample the original texture and the mask texture, and you can replace the masked color with your own if the mask value is greater than a certain threshold.

    This somewhat alleviates the problem with using GL_LINEAR, because you can adjust the value at which you reject the pixel.

    For example, if you sample right between a masked and unmasked pixel, then your mask value will be 0.5, and the color will be (0.5*color_key + 0.5*unmasked_color). If you find this unacceptable color bleeding, you can set the alpha reject at 0.1, 0.001, etc, to mask any pixel that has even a slight trace of mask in it. This will slightly enlarge your masked area, but will allow you to not see a trace of the color key anywhere in the result.

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

Sidebar

Related Questions

When writing a new jQuery plugin is there a straightforward way of checking that
I've just started writing a reasonably straightforward site using sinatra. My problem is that
It seems that using decltype with SFINAE enable_if isn't straightforward. I tried writing the
Writing htaccess that allows me to remove index.php from the URL can confuse search
Writing documentation in html requires some code examples. What to do with characters that
I'm writing some code that does date and time calculations against the current time.
I'm writing an application that models train routes, which are stored in the database
I'm writing a small Ruby command-line application that uses fileutils from the standard library
I'm writing a pretty straightforward ASP.net project. It's using a Linq2Sql DataContext to access
I'm writing a Python module that wraps out a certain web service API. It's

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.