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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:42:47+00:00 2026-05-13T15:42:47+00:00

I have a texture with transparency (the white triangle with that lighting information), and

  • 0

I have a texture with transparency (the white triangle with that lighting information), and just can’t make it’s alpha variable.

alt text http://gotoandplay.freeblog.hu/files/alpha_help.png

The drawing code, with the missing piece:

  //Place polygon vertices to the bottom left within the view.
  glLoadIdentity();
  glTranslatef(centerX, centerY, 0);

  //Draw "diffuse" layer.
  glBindTexture(GL_TEXTURE_2D, spriteTexture[0]); //Bind.
  glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); 

  //Offset during development only.
  glLoadIdentity();
  glTranslatef(centerX-10, centerY+10, 0); 

  //Draw "specular" layer.
  glActiveTexture(GL_TEXTURE0);
  glBindTexture(GL_TEXTURE_2D, spriteTexture[1]); //Bind.

  //Some smart alpha scaling code needs here...

  glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); 

Could somebody please help me out with the appropriate lines of code?
Some glBlendFunc, or maybe glTextEnvi stuff I suppose.

  • 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-05-13T15:42:48+00:00Added an answer on May 13, 2026 at 3:42 pm

    Ok, I got it even if I don’t understand what I did exactly.

        //Place polygon vertices to the bottom left within the view.
        glLoadIdentity();
        glTranslatef(centerX, centerY, 0);
    
    //--1   
    
            //Draw "diffuse" layer.
            glActiveTexture(GL_TEXTURE0);
            glBindTexture(GL_TEXTURE_2D, spriteTexture[0]); //Bind.
    
                //Blending.
                glBlendFunc(GL_ONE, GL_ONE);
    
            glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);  
    
    //--2   
    
            //Draw "specular" layer.
            glBindTexture(GL_TEXTURE_2D, spriteTexture[1]); //Bind.
    
                //Blending.
                glColor4f(opacity, opacity, opacity, opacity);
                glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA);
    
            glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    

    I tried another way before…

    glColor4f(1.0f, 1.0f, 1.0f, opacity);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    

    …but the second map was somehow “weaker”.

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

Sidebar

Related Questions

Can I have Stencil prepared with a texture (Image) in OpenGL 2.0 So that
I have some quads that have a texture with transparency and some objects behind
I have a texture manager that I am running as singleton, and wish to
With WPF 3D, is it possible to have a texture with an alpha channel?
i have a GLSurfaceView, that has a texture that i need to change when
I have a texture loaded into memory that is of RGBA format with various
A have a question, maybe someone can help me. I am trying to make
I have a texture that follows a user's finger in GLKit. I calculate the
I have one texture that has some portions which are transparent transparent I want
I have a texture that is semi-transparent with varying opacity at different locations. I

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.