I can’t draw a texture with glDrawTextOES in my Android app. I’ve tried the SpriteMethodTest code and I can’t get it to work…
However, here’s the code:
Code for cropping when loading texture:
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
int[] mCropWorkspace = new int[4];
mCropWorkspace[0] = 0;
mCropWorkspace[1] = bitmap.getHeight();
mCropWorkspace[2] = bitmap.getWidth();
mCropWorkspace[3] = -bitmap.getHeight();
bitmap.recycle();
((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D,
GL11Ext.GL_TEXTURE_CROP_RECT_OES, mCropWorkspace, 0);
Code for drawing:
gl.glBindTexture(GL10.GL_TEXTURE_2D, texture);
((GL11Ext) gl).glDrawTexfOES(x, y, 0.0f, width, height);
Any ideas? I got it to work with Vertex Arrays and Vertex Buffer Objects, but not with this…
Thanks in advance!
You need to have properly height and width for your image, e.g:
512x512or512x1024so it fills a quad/rectangle, specified by yourGL_TEXTURE_CROP_RECT_OES.