PDA

View Full Version : [SOLVED] Bad image when rotating sprites in opengl



arthurprs
12-12-2007, 06:14 PM
Im getting really bad graphics in certain angles

http://img156.imageshack.us/img156/225/capture12122007160424ox4.jpghttp://img156.imageshack.us/img156/4392/capture12122007160431jm6.jpghttp://img156.imageshack.us/img156/8125/capture12122007160437wp7.jpghttp://img156.imageshack.us/img156/4377/capture12122007160441mt1.jpghttp://img156.imageshack.us/img156/2171/capture12122007160445cs3.jpg

i use the code


glBegin(GL_TRIANGLE_STRIP); //
glTexCoord2f(xfrac, yfrac);
glVertex2f(x, y);

glTexCoord2f(xfrac, hfrac);
glVertex2f(x, y + titleh);

glTexCoord2f(wfrac, yfrac);
glVertex2f(x + titlew, y);

glTexCoord2f(wfrac, hfrac);
glVertex2f(x + titlew, y + titleh);
glEnd;

Whats wrong?


EDIT : You have to apply the texture filters after loading them

User137
12-12-2007, 06:57 PM
Are you using linear filtering for texture quality? You can change that with commands:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TextureQuality);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TextureQuality);
where TextureQuality could be GL_LINEAR

arthurprs
12-12-2007, 07:01 PM
Thats what i use at the init :?


// when texture area is small, bilinear filter the closest mipmap
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
// when texture area is large, bilinear filter the original
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

arthurprs
13-12-2007, 12:18 PM
help :(

User137
13-12-2007, 02:02 PM
Hmm.. i'm still not convinced :)

At the init you say? It needs to be called individually when each texture is loaded somewhere after glBindTexture.

It is easy to spot if linear filter is on when scaling graphics. For the smoothing issue, linear should be responsible for the inner contains of texture but further antialiasing can smoothen the borders.

arthurprs
13-12-2007, 02:19 PM
Hmm.. i'm still not convinced :)

At the init you say? It needs to be called individually when each texture is loaded somewhere after glBindTexture.

It is easy to spot if linear filter is on when scaling graphics. For the smoothing issue, linear should be responsible for the inner contains of texture but further antialiasing can smoothen the borders.

I have to call these texparm after every bindtexture?


edit: it's now solved, i have to call these texparams after loading the texture only, a big thanks :) :) :)

Robert Kosek
13-12-2007, 02:28 PM
Yes, basically, in your for-loop, when you load the textures, you need to set the parameters for each. Quite brilliant actually, since if you wanted to you could have different settings per texture. ;)

Edit: Pwned by an edit. :roll:

arthurprs
13-12-2007, 02:37 PM
Yes, basically, in your for-loop, when you load the textures, you need to set the parameters for each. Quite brilliant actually, since if you wanted to you could have different settings per texture. ;)

Edit: Pwned by an edit. :roll:

thx for the attention anyway