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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:21:41+00:00 2026-06-09T00:21:41+00:00

I’m trying to draw multiple hexagons on the screen that have an alpha channel.

  • 0

I’m trying to draw multiple hexagons on the screen that have an alpha channel. the image is this:

http://img834.imageshack.us/img834/571/hexagon.png

So, I load the texture into the program and that’s ok. When it runs, the alpha channel is blended with the background color and that’s ok but, when two hexagons overlap themselves, the overlapped part becomes the color of the background! Below the picture:

http://img259.imageshack.us/img259/213/20120731163847.png

Of course, this is not the effect that I expected.. I want them to overlap without this background being drawn over the other texture. Here is my code for drawing:

    GLES20.glUseProgram(Program);

    hVertex  = GLES20.glGetAttribLocation(Program,"vPosition");
    hColor   = GLES20.glGetUniformLocation(Program, "vColor");
    uTexture = GLES20.glGetUniformLocation(Program, "u_Texture");
    hTexture = GLES20.glGetAttribLocation(Program, "a_TexCoordinate");
    hMatrix  = GLES20.glGetUniformLocation(Program, "uMVPMatrix");

    GLES20.glVertexAttribPointer(hVertex, 3, GLES20.GL_FLOAT, false, 0, bVertex);
    GLES20.glEnableVertexAttribArray(hVertex);
    GLES20.glUniform4fv(hColor, 1, Color, 0);
    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, hTexture);
    GLES20.glUniform1i(uTexture, 0);
    GLES20.glVertexAttribPointer(hTexture, 2, GLES20.GL_FLOAT, false, 0, bTexture);
    GLES20.glEnableVertexAttribArray(hTexture);

    GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    GLES20.glEnable(GLES20.GL_BLEND);

    x=-1;y=0;z=0;
    for (int i=0;i<10;i++) {
        Matrix.setIdentityM(ModelMatrix, 0);
        Matrix.translateM(ModelMatrix, 0, x, y, z);
        x+=0.6f;
        Matrix.multiplyMM(ModelMatrix, 0, ModelMatrix, 0, ProjectionMatrix, 0);
        GLES20.glUniformMatrix4fv(hMatrix, 1, false, ModelMatrix, 0);
        GLES20.glDrawElements(GLES20.GL_TRIANGLES, DrawOrder.length, GLES20.GL_UNSIGNED_SHORT, bDrawOrder);
    }

    GLES20.glDisable(GLES20.GL_BLEND);
    GLES20.glDisableVertexAttribArray(hVertex);
}

And My fragment shader:

public final String fragmentShaderCode =
        "precision mediump float;" +
        "uniform vec4 vColor;" +
        "uniform sampler2D u_Texture;" +
        "varying vec2 v_TexCoordinate;" +
        "void main() {" +
        "  gl_FragColor = vColor * texture2D(u_Texture, v_TexCoordinate);" +
        "}";

and my renderer code:

    super(context);
    setEGLContextClientVersion(2);
    getHolder().setFormat(PixelFormat.TRANSLUCENT);
    setEGLConfigChooser(8, 8, 8, 8, 8, 8);
    renderer = new GLRenderer(context);
    setRenderer(renderer);

I already tried to use diferent functions on glBlendFunc but nothing seems to work.. Does Anyone knows what the problem is? I’m really lost.. If needs anymore code just ask!

Thank you!

  • 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-09T00:21:43+00:00Added an answer on June 9, 2026 at 12:21 am

    My guess is that you need to disable the depth test when drawing these. Since they all appear at the same depth, when you draw your leftmost ring, it writes into the depth buffer for every pixel in the quad, even the transparent ones.

    Then when you draw the next quad to the right, the pixels which overlap don’t get drawn because they fail the depth test, so you just get a blank area where it intersects with the first quad.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I know there's a lot of other questions out there that deal with this

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.