07-21-2012 07:41 AM
I was trying to use bbutil_load_texture to render a png image, however the image isnt rendering correctly. I have tried loading other images as well to check if it's a problem with my pngs. The images rendered are messed up; some colours from the image are there just not in the correct positions. Are there any functions I need to call before using bbutil_load_texture? Is my rendering code correct? What parameters should I provide when using bbutil_load_texture()?
Im thinking it might be best to write my own png parser, anyone got any tips?
//glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glVertexPointer(2, GL_FLOAT, 0, imagepointer->vertices);
glTexCoordPointer(2, GL_FLOAT, 0, imagepointer->texcoords);
glScalef(0.4f,0.4f,0.4f); //just scaled it down a bit to be able to see the whole image.
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
my texcoords used: 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f
u = 1.0f, v = 1.0f;
Why does bbutil_load_texture require a pointers to a pair of uv coordinates? What is it doing with them?
When I looked through the code in the bbutil source it seems to do almost nothing with width and height.
Solved! Go to Solution.
07-21-2012 07:43 AM
07-21-2012 08:34 AM - edited 07-21-2012 08:35 AM
This is the screenshot from the playbook: (cyan background)
And the image should look like this:
Looks to me like im getting only the lower part of the image, and stretched/rotated.7
Doesnt seem to be a problem loading unless its my parameters used for bbutil_load_texture.
Probably a problem with my rendering
07-21-2012 02:04 PM - edited 07-21-2012 02:08 PM
i've heard about the powers of 2 requriement but didnt take notice since the GoodCitizen tutorial I looked at used images of resolution 42x44 which neither is a power of 2 (this is the radio buttons it uses).
Is this a requirement of Opengles1.1 or bbutil_load_texture?
this is my first venture into opengl as I've always used directx, so any tips for opengl beginners would be greatly appreciated.
ps I also found I has to save my pngs in 24bit form as the bbutil_load_texture didnt like 32bit pngs.
07-21-2012 02:08 PM
On regular OpenGL, there might be an arbitrary rectangle extension to handle non-power-of-two images.
I don't think you have such luxury with OpenGL ES. So test with a power-of-two image (take something 128 x 128) and see if it works.