Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I want to display a bitmap image at screen using texture api in android opengl. Some code which I have used in our code as below.

public void onSurfaceChanged(GL10 gl, int width, int height) {
    gl.glGenTextures(1, texture, 0);
    gl.glBindTexture(GL10.GL_TEXTURE_2D, texture[0]);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
    Bitmap bmp = BitmapFactory.decodeResource(ContextController.getContext().getResources(), R.drawable.ic_launcher);
    GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bmp, 0);
    bmp.recycle();
}

I have use this code But image is not display, screen is display as blank.

share|improve this question
    
What's the size of ic_launcher? –  Rubber Mallet May 2 '12 at 23:30
    
Image size is 48*48 pixel..... –  Manoj Kumar May 3 '12 at 12:30
    
You should be getting white polygons for textures that have not loaded correctly, rather than just a blank screen. What about the rest of your code? Also, images must be power of 2 for opengl-es. So 16x16, 32x32, 64x64 etc –  Spoon Thumb May 15 '12 at 15:10

1 Answer 1

You are omitting important opengl calls. http://www.opengl.org/wiki/Common_Mistakes#Creating_a_Texture

share|improve this answer
    
Thank you very much for supporting me for this issue, but i have resolved this issue already...... –  Manoj Kumar May 23 '12 at 7:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.