PDA

View Full Version : Blending -> Black Lines Through Textures (Wireframe like)


hangt5
2005.04.05, 04:43 AM
Enabling blending makes all my textures have these weird black lines go through them. Kinda like a wireframe, if my mesh where triangulated. Heres a pic: Screenie (http://lostcreation.com/bl.jpg)

Again this only happens when i enable blending.

Iv tried:

Nearly every possible combination of texture filtering.
Changing my materials... enabling/disabling... no change.
Changing the blending function...
Clamping my textures...
enabling mipmaps...
changing the texture enviroment...

Some relevant code:

//Blending
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);



//texture generation
glBindTexture(GL_TEXTURE_2D, textureId);

glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);

glTexImage2D( GL_TEXTURE_2D, 0, 3, size.width,
size.height, 0, glFormat,
GL_UNSIGNED_BYTE, bytes );

// Linear filtering
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );

glTexEnvi(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, -3);
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MO DULATE);




//Model Rendering
if([textures count])
glBindTexture(GL_TEXTURE_2D, [[textures objectAtIndex:0] tId]);
else
glBindTexture(GL_TEXTURE_2D, 0);

glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, [mat get:LC_DIFFUSE]);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, [mat get:LC_AMBIENT]);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [mat get:LC_SPECULAR]);
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, [mat get:LC_EMISSIVE]);

[self calculateAbsoluteVertices];
glMultMatrixf((GLfloat*)finalMatrix);

if([self useVertexArrays])
{
glVertexPointer(3,GL_FLOAT,0,vertices);
glNormalPointer(GL_FLOAT,0,normals);
glTexCoordPointer(2,GL_FLOAT,0,uvVertices);
glDrawArrays(drawType,0,nPoints);

} else {



Thanks in advanced.
-Joe

hangt5
2005.04.05, 05:01 AM
if i disable materials/textures it still happens...

EDIT: Having glEnable(GL_POLYGON_SMOOTH); was doing it. So my question becomes... Is there anyway to use Polygon smoothing and blending at the same time?

ThemsAllTook
2005.04.05, 09:06 AM
Having glEnable(GL_POLYGON_SMOOTH); was doing it. So my question becomes... Is there anyway to use Polygon smoothing and blending at the same time?

Sadly, no. See Arekkusu's explanation in this thread (http://www.idevgames.com/forum/showthread.php?t=8785).

- Alex Diener