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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:04:31+00:00 2026-06-13T19:04:31+00:00

I’m developing a videogame using Opengl-es for android. I’m having an issue with the

  • 0

I’m developing a videogame using Opengl-es for android. I’m having an issue with the background of the images I use, since it draws the color of the background.

Here my renderer:

@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {

    //Initialize GL:                
    gl.glDisable(GL10.GL_DITHER);
    gl.glEnable(GL10.GL_TEXTURE_2D);            //Enable Texture Mapping ( NEW )
    gl.glShadeModel(GL10.GL_SMOOTH);            //Enable Smooth Shading
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);    //Black Background
    gl.glClearDepthf(1.0f);                     //Depth Buffer Setup
    gl.glEnable(GL10.GL_DEPTH_TEST);            //Enables Depth Testing
    gl.glEnable(GL10.GL_CULL_FACE);
    gl.glDepthFunc(GL10.GL_LEQUAL);             //The Type Of Depth Testing To Do
    gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); //Really Nice Perspective Calculations //<---- SI LAG, probar GL_FASTEST

    LoadTextures(gl);
}

Here the draw method:

@Override
public void onDrawFrame(GL10 gl) {

    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
    gl.glLoadIdentity();

    for(Entity e : entities)
    {
        if(e.IsActive())
        {
            gl.glPushMatrix();
                e.Draw(gl);
            gl.glPopMatrix();
        }
    }

    gl.glDisable(GL10.GL_BLEND);        
    isDrawing = false;
}

And the draw method of each entity:

gl.glColor4f(red, green, blue, alpha);

    // bind the previously generated texture
    gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId);

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

    // Point to our vertex buffer
    gl.glVertexPointer(2, GL10.GL_FLOAT, 0, screenBuffer); //2 dimensiones
    gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer);

    // Draw the vertices as triangle strip
    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, 4); //12 /3 -> 12 es el tamano del vector de vertices del cuadrado

    //Disable the client state before leaving
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

I also have this in my GLSurfaceView:

setEGLConfigChooser(8,8,8,8,16,0);
    renderer = new GRenderer(c);
    setRenderer(renderer);        
    setRenderMode(RENDERMODE_WHEN_DIRTY);
    getHolder().setFormat(PixelFormat.TRANSLUCENT);
    setZOrderOnTop(true);

But it doesn’t work. Which color should I use to achieve a translucent background? Any error in the code? Thanks

  • 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-13T19:04:32+00:00Added an answer on June 13, 2026 at 7:04 pm

    For achieving alpha, your code seems okay in terms of OpenGL calls.

    However, for images:

    1) Your images need to have an alpha channel baked into them. RGB won’t cut it – you need RGBA. This can easily be fixed in something like Photoshop, Gimp, or other image editor.

    2) If you want translucency, you might be better off setting the alpha channel to some intermediate value and have your RGB set to whatever color you want to be the “translucent” blending color. Or you can create a custom blending function in your fragment shader to do something special with the alpha channel.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.