How can I use glDrawTexOES()

I’d like to use glDrawTexOES().
If i want to map the texture to glDrawTexOES()
How can i do?
The ES manual indicates that glDrawTexOES calculates uv coordinates automately.
so I guess It’s not need glTexCoordPointer()
my code is
glBindTexture(GL_TEXTURE_2D, m_TexID);
glEnable(GL_TEXTURE_2D);
glDrawTexiOES(0,0,0,200,200);
But I’s not work correctly;
Only From 0,0 to 200,200 screen coord rectangle be shown without texture image.
How can i map the texture to glDrawTexOES()?

Can I get some example code about glDrawTexOES()??
help me.

You need to set the texture crop rectangle which determines the part of the texture mapped to the drawn rectangle.

int cropRect[4] = { 0, 0, 256, 256 }; // crop rectangle in texels (u, v, width, height)
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect);

i didn’t know GL_TEXTURE_CROP_RECT_OES.
Thanks a lot Xmas.

When this flag GL_COORD_REPLACE_OES is needed??
opengl es 1.1 manual is not memtioned.

I used bitmap for mapping texture directly, it’s tured over…pData is bitmap data.

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1024, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, WIN_WIDTH, WIN_HEIGHT, GL_RGBA, GL_UNSIGNED_BYTE, pData);

int cropRect[4] = {0,0,800,480};
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect);
glDrawTexiOES(0,0,0, 800,480);

anything else’s solution?? without memcpy().?

It belongs to the OES_point_sprite extension and does not affect DrawTex.

I used bitmap for mapping texture directly, it’s tured over…pData is bitmap data.

Not sure if it is what you mean, but if the image is vertically flipped, you can try inverting the crop rectangle:
int cropRect[4] = {0,480,800,-480};

Remember that in OpenGL (ES) the origin of images is the lower left corner.

you can try inverting the crop rectangle:
int cropRect[4] = {0,480,800,-480};

Remember that in OpenGL (ES) the origin of images is the lower left corner.

You are right. I wasn’t good at using cropRect .
Thanks a lot Xmas.

I followed the above discussion, but i still see a blank screen.
Am i missing something in the below code?

extern const UB tex_image[256][256 * 4]; //RGBA
int cropRect[4] = { 0, 0, 256, 256 };

glEnable(GL_TEXTURE_2D);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex_image);
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect);
glDrawTexiOES (0, 0, 0, 256, 256);

I can at least tell that you’re texturing with an incomplete texture. The default min-filter for a texture object requires mipmaps, and you only upload the base-level. This means that the texturing stage is disabled. Usually, this leads to a draw-call only drawing fragments of a constant color, but might differ based on a lot of different state.