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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:07:37+00:00 2026-06-02T11:07:37+00:00

I’ve been struggling with this issue for a few weeks now, with no results.

  • 0

I’ve been struggling with this issue for a few weeks now, with no results. I’m sure I’m just missing something silly, so I thought I’d get an outside opinion on it.

I’m drawing a bunch of different textures in an app, and for some reason, some of them aren’t showing up. I tried to figure out why only certain textures wouldn’t display, and I think I’ve narrowed it down to textures with translucent pixels (textures that contain pixels with an alpha value that is not 0 or 255). Fully opaque textures display just fine, and textures that have either fully on or fully off pixels do as well. The problem textures display as a white square. Also, I figure I should add that everything displays fine in the emulator, it’s only on my testing device (Samsung Captivate) that the textures don’t display.

Here are some snippets of my code showing the important parts, as always, let me know if you need more information.

View setup (I’ve tried both of these, but having these lines there or not seems to make no difference):

gameView.setEGLConfigChooser(8,8,8,8,16,0);
gameView.getHolder().setFormat(PixelFormat.TRANSLUCENT);

Renderer’s onSurfaceCreated method (I’ve also tried enabling depth test to no avail, the lines I used are commented here, and when I tried depth testing, I did clear the depth buffer on every draw):

gl.glClearColor(0.5f, 0.5f, 0.5f, 1);
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
gl.glShadeModel(GL10.GL_FLAT);
gl.glDisable(GL10.GL_DEPTH_TEST);
//gl.glEnable(GL10.GL_DEPTH_TEST);
//gl.glDepthFunc(GL10.GL_LEQUAL);
gl.glEnable(GL10.GL_BLEND);
gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glEnable(GL10.GL_TEXTURE_2D);

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

Texture loading method (could it have something to do with GLUtils.texImage2D?):

int texId;
gl.glGenTextures(1, mTextureNameWorkspace, 0);

texId = mTextureNameWorkspace[0];
gl.glBindTexture(GL10.GL_TEXTURE_2D, texId);

if (gl instanceof GL11) {
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR_MIPMAP_NEAREST);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL11.GL_GENERATE_MIPMAP, GL11.GL_TRUE);
}
else {
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
}

gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);

gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_MODULATE);

InputStream is = res.openRawResource(resourceId);
Bitmap bitmap = null;
try {
    bitmap = BitmapFactory.decodeStream(is, null, bitmapOptions);

    GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);

    if (gl instanceof GL11) {
        mCropWorkspace[0] = 0;
        mCropWorkspace[1] = bitmap.getHeight();
        mCropWorkspace[2] = bitmap.getWidth();
        mCropWorkspace[3] = -bitmap.getHeight();

        ((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, mCropWorkspace, 0);
    }

    //Don't poke fun at my archaic error handler
    int error;
    String errorCodes = "";
    while ((error = gl.glGetError()) != GL10.GL_NO_ERROR) {
        errorCodes += error + " ";
    }
    if (errorCodes.length() != 0)
        throw new Exception("OpenGL error while loading texture. Error codes: " + errorCodes.substring(0,errorCodes.length()-1));

    textureWidth  = bitmap.getWidth();
    textureHeight = bitmap.getHeight();
    textureId = texId;

    return texId;
}
finally {
    try { is.close();       } catch (IOException e) { }
    try { bitmap.recycle(); } catch (Exception   e) { }
}
  • 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-02T11:07:38+00:00Added an answer on June 2, 2026 at 11:07 am

    Just to close the question in case anyone stumbles upon it:

    This error was occurring because the images were saved in res/drawable. When loaded from there, the Android can do some behind-the-scenes processing, causing the resulting images to not be sized to a power of two. Store the images in res/raw to avoid this processing.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
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
Does anyone know how can I replace this 2 symbol below from the string

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.