Advertisement

Texture tears

Started by August 17, 2001 02:20 PM
13 comments, last by Frank Henry 23 years, 6 months ago
hm, might be.
sofar they look like this:
bitmap:
[mask texture][original texture]
could my glTexCoord2f''s be the problem?
thanks
code:
void GLDrawMappedQuad (Quad_abs Quad,
ubColor color)
{
SetShadeModel (true, GL_SMOOTH);
SetDepthTest (false, 0);
SetPolyMode (true, GL_FILL,GL_LINE);
SetBlending (true, GL_DST_COLOR,GL_ZERO);
SetCullFace (true, 0);
SetCorrectionHint (true, GL_NICEST);
SetSmoothHint (false, 0);
glPushMatrix ();

glEnable (GL_TEXTURE_2D);

glBindTexture (GL_TEXTURE_2D, Quad.TextureID);
SetubColor (FullBright);//anyway around this???

//Mapped Texture
glBegin (GL_TRIANGLE_STRIP);
glTexCoord2f (0.5,1.0);
DrawVertex3f (Quad.Corners[0]);
glTexCoord2f (0.0,1.0);
DrawVertex3f (Quad.Corners[1]);
glTexCoord2f (0.5,0.0);
DrawVertex3f (Quad.Corners[2]);
glTexCoord2f (0.0,0.0);
DrawVertex3f (Quad.Corners[3]);
glEnd();

SetBlending (true, GL_ONE,GL_ONE);

glBegin (GL_TRIANGLE_STRIP);
glTexCoord2f (1.0,1.0);
DrawVertex3f (Quad.Corners[0]);
glTexCoord2f (0.5,1.0);
DrawVertex3f (Quad.Corners[1]);
glTexCoord2f (1.0,0.0);
DrawVertex3f (Quad.Corners[2]);
glTexCoord2f (0.5,0.0);
DrawVertex3f (Quad.Corners[3]);
glEnd();
glPopMatrix ();

glDisable (GL_TEXTURE_2D);
SetBlending (false, 0,0);
SetDepthTest (true, GL_EQUAL);
}
[Maybe]...

try to disable linear filtering (in texture loading) when loading images with alpha channel. Use nearest...
Help me with my Isometric OpenGL engine.
Advertisement
@ak37:
i''m loading a regular bitmap!
do they have alpha channels?

GL_NEAREST works but looks UUUUUGLY!!!

@Zerosignull: didn''t help!

thanks to all for the help!
Bitmaps don''t have alpha channels...

Frank, quick question. For your texture coordinates, are you using the ENTIRE texture (e.g., {0, 0}, (0, 1}, {1, 1}, {1, 0})?

If so, try something plain off-the-wall silly for me...

Try using {.05, .05}, {.05, .95}, {.95, .95}, {.95, .05}

Dragonus
Thought of the Moment
"Everything, no matter how unlikely, has a very small yet finite chance of happening." ~Heisenburg''s Uncertainty Principle
That still gives me hope that, one day, I''ll be teleported to some remote desert isle surrounded by women who think I''m a god.

it works!!! BWAHAHAHA!!!
and the prize goes to Dragonus.
wierd thing was that after Zerosignull
brought the suggestion i tried it out, to no avail.
but it works now!
i''ll probably make a little sprite lib if anyone''s interrested.

thanks again to all that helped.
on to my next question. ;-))

here''s the code:
glBegin (GL_TRIANGLE_STRIP);
glTexCoord2f (0.49,0.99);
DrawVertex3f (Quad.Corners[0]);
glTexCoord2f (0.01,0.99);
DrawVertex3f (Quad.Corners[1]);
glTexCoord2f (0.49,0.01);
DrawVertex3f (Quad.Corners[2]);
glTexCoord2f (0.01,0.01);
DrawVertex3f (Quad.Corners[3]);
glEnd();

SetBlending (true, GL_ONE,GL_ONE);

glBegin (GL_TRIANGLE_STRIP);
glTexCoord2f (0.99,0.99);
DrawVertex3f (Quad.Corners[0]);
glTexCoord2f (0.51,0.99);
DrawVertex3f (Quad.Corners[1]);
glTexCoord2f (0.99,0.01);
DrawVertex3f (Quad.Corners[2]);
glTexCoord2f (0.51,0.01);
DrawVertex3f (Quad.Corners[3]);
glEnd();

This topic is closed to new replies.

Advertisement