Log in or register to post comments

Blurry textures

November 1, 2011 - 1:04pm #1

Hello,
I'm working on an app and when I load the textures in they appear blurry, anyone have any idea why? I pretty much copy and paste the code from the sample code so I'm not sure what's happening?
Thanks

Re: Blurry textures

November 2, 2011 - 10:50pm #5

Actually i got it to not be blurry by binding to the texture and setting the parameters in c++ and then calling to the Texture.java class that came with the samples and rather than using the bit shifting to convert the int[] to a byte[] and send back to c++ i just used the GLUtils.texImage2D method. It works fine now, not sure why but it does. FYI the textures have a alpha channel and i use glblendfunc for transparency, not sure if that had anything to do with it.

Re: Blurry textures

November 2, 2011 - 10:23pm #4

I think you want to use glTexParameteri for the GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAG_FILTER.

Also, try setting these parameters just before rendering with the texture as well.

- Kim

Re: Blurry textures

November 2, 2011 - 9:04am #3

Hey Kim,
I'm already using linear filtering, my texture setup calls are below:
glBindTexture(GL_TEXTURE_2D, m_animationTextures[frameIdx]);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->width, texture->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*) texture->data);

Re: Blurry textures

November 1, 2011 - 8:26pm #2

Maybe you need to play around with the texture parameters?

http://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexParameter.xml

Try setting the min and mag filters to GL_LINEAR.

- Kim

Log in or register to post comments