GL_OES_draw_texture#

Supported Hardware#

Series5, Series5XT, Series6, Series6XE, Series6XT

Valid APIs#

OpenGL ES 1.x

Description#

This extension adds a simple method of blitting a texture to the screen, for things such as backgrounds and 2D GUI elements. The user can provide a crop rectangle to specify the part of the texture that they wish to draw, and then call DrawTex**OES() with coordinates for the part of the screen they wish to draw to.

Note#

This functionality as specified cannot be made to work with the programmable pipeline of OpenGL ES 2.0. In OpenGL ES 3.0, this functionality is effectively replaced by the function “glBlitFramebuffer”.

Example#

// Bind a texture
glBindTexture(GL_TEXTURE_2D, texture);
// Set the texture crop rectangle to set the texture coordinates to draw from
GLint textureCropRectangle[4] = {0, 0, 256, 256};
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, textureCropRectangle);
// Draw the texture to the whole screen, which will be resized appropriately from the texture
// rectangle
glDrawTexfOES(-1.0, -1.0, 2.0, 2.0);