PDA

View Full Version : platform-independent way of loading images into textures in GLES 2



guihazan
09-22-2012, 06:52 AM
Hi,

I have a program where i dynamically create images in an offscreen buffer. I was using glDrawPoints to map each image pixel but it is rather slow, so i'm now searching a way to load and draw it into a texture.

I found a couple of programs that does this, but each one is targetted for a platform (ios, windows, android) and each one has an utility function that loads a rgb array representing the image and transforms it into a texture. For example, in windows we have gluBuild2DMipmaps.

Since i'm targetting all oses, i don't want to use the utility functions. Can someone point me to a code that converts the bitmap into a texture, using OpenGL ES 2?

thanks

guich

carsten neumann
09-24-2012, 10:08 AM
For example, in windows we have gluBuild2DMipmaps.


This function is part of GLU, the GL Utility library. It's old, and may not work with OpenGL ES, but it is platform independent. Also, as it's name suggests, it does more than just create a texture, it creates a complete mipmap chain.



Can someone point me to a code that converts the bitmap into a texture, using OpenGL ES 2?


glTexImag2D (http://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml)?