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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:13:32+00:00 2026-06-11T01:13:32+00:00

1 Can we do alpha test at Global? glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_EQUAL, 0.7); Use these two

  • 0

1 Can we do alpha test at Global?

glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_EQUAL, 0.7);

Use these two functions We can draw a texture and display the image where alpha >= 0.7. My question is if I draw 2 texture some part of them overlap, their alpha sum to 0.7, how to display this part?


2 How to draw a bitmap more efficient

About question 1, I try some functions in OpenGL, and did not achieve. so I try another way. I set a map[512][512]. I first draw all texture on this map and accumulate the alpha myself. If a pixel alpha >= 0.7, I set it color , if not I set white color. At end, I draw the whole map as a texture to the window. Using this method , I can achieve do alpha test at global. but it very very slow.

(This method comes from Bartek Banachewicz at stackoverflow)

Here is my function :

  1. init map[512][512] all set to zero

  2. draw every thing on this map, and accumulate the alpha

  3. loop every pixel at map, set them color according there alpha

  4. using glTexImage2D() to generate texture (I think this may be slow)

  5. using glTexCoord2f and glVertex3f to draw this on the window.

Using this method, I draw about 100 things, It become really slow (about 20 FPS)

Can I do something to optimize this Method or have another achievement?

  • 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-11T01:13:34+00:00Added an answer on June 11, 2026 at 1:13 am

    My question is if I draw 2 texture some part of them overlap, their alpha sum to 0.7, how to display this part?

    First, some terminology:

    You cannot draw textures at all. You can only draw triangles, which may involve mapping one or more texture to them.

    If you are mapping both textures to the triangle, then what you do with their alpha depends on your shader (or if you’re not using shaders, then your glTexEnv settings). If you’re drawing them separately, then you’re not drawing 2 textures. You’re drawing one texture, followed by another texture.

    Unless you use a blend mode, what the first texture drew cannot affect the second. Or the third.

    How to draw a bitmap more efficient

    In general, you don’t. There are ways to make transfering image data more efficient (centering around pixel buffer objects for async transfer and buffer streaming techniques), but if all you’re doing is blitting images, then the correct way to do this is not to create textures every frame.

    What you want to do is give OpenGL all the images you ever plan to use, and then use texture mapped triangles (quads) to draw them directly to the screen. This is how it is done in most applications that do 2D blitting.

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

Sidebar

Related Questions

How can I use the startswith function to match any alpha character [a-zA-Z]. For
How can I use Membership.GeneratePassword to return a password that ONLY contains alpha or
I am writing a test app. To set Alpha for image I use paintComponent
I'm looking for a regular expression that can find the alpha representation of a
I can't find any PHP script to compute Krippendorff's Alpha . I need this
Trying to replace any non alpha-numeric characters with a hyphen. Can't see why it
I would like to render the 3D volume data: Density(can be mapped to Alpha
I'm learning about how to use JOGL and OpenGL to render texture-mapped quads. I
I'm having trouble drawing with VBOs. Using immediate mode, I can easily draw a
I am trying to draw a partly-transparent texture above a coloured quad, so that

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.