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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:13:30+00:00 2026-05-21T09:13:30+00:00

I am having an issue where textures from the resources become just white. The

  • 0

I am having an issue where textures from the resources become just white.
The issue only seems to occur on phones (Droid-X for sure), but it works just fine on the emulator.
I have researched this issue for days and tried so many things.

Textures are POT ranging from 8×8 to 128×128
Textures have been in res/drawable, res/drawable-nodpi and res/raw
Tried with and without this in the manifest file:

<supports-screens android:anyDensity="true" />

I am at a complete loss on this.

Here is the code I am using
gl is GL10 and gl11 is GL11

During onSurfaceCreated
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glEnable(GL10.GL_BLEND);
gl.glDisable(GL10.GL_DEPTH_TEST);
gl.glDisable(GL10.GL_DITHER);
gl.glDisable(GL10.GL_LIGHTING);

gl.glShadeModel(GL10.GL_FLAT);
gl.glClearColor(0.00f, 0.00f, 0.00f, 1.00f);
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_DST_ALPHA);
gl.glOrthof(-1, 1, -1, 1, -1, 1);
gl.glColor4f(0.5f, 0.5f, 0.5f, 0.5f);

gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST);

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_REPLACE);
gl.glFrontFace(GL10.GL_CCW);

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

During onSurfaceChanged

gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glViewport(0, 0, width, height);

Generating the VBO:

public final float vertices[] = { 
    -1.0f, -1.0f, 1.0f,
    1.0f, -1.0f, 1.0f,
    -1.0f, 1.0f, 1.0f,
    1.0f, 1.0f, 1.0f
};
public float textureCoord[] = { 
    0.0f, 0.0f,
    0.0f, 1.0f,
    1.0f, 0.0f,
    1.0f, 1.0f
};
public final byte indices[] = { 
    0, 1, 3,
    0, 3, 2 
};
verticesBuffer = ByteBuffer.allocateDirect(vertices.length * 
    Constants.FLOAT_SIZE).order(ByteOrder.nativeOrder()).asFloatBuffer();
textureCoordBuffer = ByteBuffer.allocateDirect(textureCoord.length * 
    Constants.FLOAT_SIZE).order(ByteOrder.nativeOrder()).asFloatBuffer();
indicesBuffer = ByteBuffer.allocateDirect(indices.length).order(ByteOrder.nativeOrder());

// fill buffers
verticesBuffer.put(vertices);
textureCoordBuffer.put(textureCoord);
indicesBuffer.put(indices);

// set pointer positions
verticesBuffer.position(0);
textureCoordBuffer.position(0);
indicesBuffer.position(0);

// temp buffer array
int[] buffer = new int[1];

// VERTICES BUFFER.
gl11.glGenBuffers(1, buffer, 0);
verticesBufferIndex = buffer[0];
gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, verticesBufferIndex);
final int vertexSize = verticesBuffer.capacity() * Constants.FLOAT_SIZE;
gl11.glBufferData(GL11.GL_ARRAY_BUFFER, vertexSize, verticesBuffer, GL11.GL_STATIC_DRAW);

// TEXTURE COORD BUUFER
gl11.glGenBuffers(1, buffer, 0);
textureCoordBufferIndex = buffer[0];
gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, textureCoordBufferIndex);
final int texCoordSize = textureCoordBuffer.capacity() * Constants.FLOAT_SIZE;
gl11.glBufferData(GL11.GL_ARRAY_BUFFER, texCoordSize, textureCoordBuffer, GL11.GL_STATIC_DRAW);

// clear buffer id
gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);

// Unbind the array buffer.
gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
gl11.glGenBuffers(1, buffer, 0);

// INDICES BUFFER
indicesBufferIndex = buffer[0];
gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, indicesBufferIndex);
final int indexSize = indicesBuffer.capacity();
gl11.glBufferData(GL11.GL_ELEMENT_ARRAY_BUFFER, indexSize, indicesBuffer, GL11.GL_STATIC_DRAW);

// Unbind the element array buffer.
gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0);

gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, verticesBufferIndex);
gl11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);
gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, textureCoordBufferIndex);
gl11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0);
gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, indicesBufferIndex);

BitmapFactory.Options sBitmapOptions = new BitmapFactory.Options();
sBitmapOptions.inPreferredConfig = Bitmap.Config.ARGB_4444;

// many of these calls :
Bitmap bitmap = BitmapFactory.decodeStream(resources.openRawResource(resourceID), null, sBitmapOptions);
int[] textures = new int[1];
gl.glGenTextures(1, textures, 0);
gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);
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);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
bitmap.recycle();
return texture[0]; // which gets stored into textureID for later

During onDrawFrame

gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

// and many of these
gl11.glPushMatrix();
// transfomations
gl11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
gl11.glDrawElements(GL10.GL_TRIANGLES, indicesCount, GL10.GL_UNSIGNED_BYTE, 0);
gl11.glPopMatrix();

Sorry for all the code but I think everything is there.
Thank you,
Will

  • 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-21T09:13:31+00:00Added an answer on May 21, 2026 at 9:13 am

    You must enable vertex array and texture coords array and bind your buffer indexes before making any calls to your glDraw...() function.

    After glBindTexture() in onDrawFrame(), put this:

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
    
    GL11 gl11 = (GL11) gl;
    
    gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, verticesBufferIndex);
    gl11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);
    
    gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, textureCoordBufferIndex);
    gl11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0); 
    gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, indicesBufferIndex);
    
    // Draw...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having issue with opencv's Sobel edge detector. From its documentation it seems
Hi guys I am having issue I have this query: SELECT * FROM useraccount
Just started mongo and started having issue with querying already. i have a collection
Having an issue here that I have tried everything I can think of but
Having an issue with traversing in jQuery.. hopfully an easy one..but I'm banging my
I am having issue when sending data from Service to Activity through Notification ,
Having issue with displaying the Data from a second Activity. when I run the
I am having what seems to be a mipmapping problem when rendering textures on
I am just having issue with jquery maphilight when printing everything works fine and
Having issue with slider navigation. Works perfectly fine when there are no other unordered

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.