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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:15:32+00:00 2026-06-08T20:15:32+00:00

Say I have a texture sitting in video memory and somewhere hidden inside this

  • 0

Say I have a texture sitting in video memory and somewhere hidden inside this texture maybe one or more pixels with a particular color. In c++ I want to call a function on this gltexture to check for the presence of this color and simply return true or false. What is the fastest way to do this?

  • 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-08T20:15:34+00:00Added an answer on June 8, 2026 at 8:15 pm

    I guess the best performance/simplicity ratio would be to keep a copy on the CPU and test each texel, optionnaly with SSE.

    You can also do it in OpenGL :

    • Create a render target of the same size than your texture
    • Do a fullscreen render of your texture in it – that is, each texel will match one fragment of the render target. Disable any fancy texture sampling
    • When rendering, use a shader which discards any texel except the one with the wanted color
    • Count the number of rendered fragments with an occlusion query.

    I’m not sure of the performance of this, but it’s likely to by the fastest you’ll get on the GPU side. Note that while fast, this method has lag : you usually only get the occlusion query’s result 1 or 2 frames later (you can also busy wait, though).

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

Sidebar

Related Questions

Let's say we have a texture (in this case 8x8 pixels) we want to
Let's say I have this texture on a polygon: How would I render that
Let's say I have a texture which is one file with separate 20 px
Lets say have this immutable record type: public class Record { public Record(int x,
Say I have this: private list<myClass> myCollection; Is there a programming idiom to shorten
Say you have something like this: glBindTexture(GL_TEXTURE_2D, my2dTex); glBindTexture(GL_TEXTURE_1D, my1dTex); glBegin... What is the
Lets say I have 4 verticies and their texture coordinates. How could I then
Lets say I have a stack of bitmap textures char *Texture[] = { texture1.bmp,
basically I have a texture. I also have a lets say octagon (or any
Say that I have this interface: interface Drawable { Vector2 DrawPosition { get; }

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.