Skip to main content
gamedev.net
🔒 Locked

Untitled

Started by run_g Apr 23, 2009 at 10:36 AM 0 replies 800+ views
Original Post
run_g
run_g
Hello, please I need some help. After texture mapping some subSet mesh of polygons, I realised that the textures were shaded individually and thus made the image discontinuous ( see the textured image at http://profile.imageshack.us/user/oystersBug/ it is the image on the right ) So I tried to remove the shading by changing it to GL_FLAT and also remove the diffuse and specular components of the color, but the only affected out-put was the non-textured equivalent polygons ( coloured green and light green, middle and right images ). So the question then is I can I turn off the shading for texture and make it FLAT shaded only. No code that I put in seem to be able to do this. Extracted code below is where the texture mapping takes place XX


void polygon_plane::drawTexturePoly3 (  GLuint&  phTexture, int normalDirFlag,  int j_col,  int _level, int _totalCam,   point3D *PhotoPoly,   vector3D *PhotoNor,    int _subCamT,     point3D*  _texCoord                 ){
	
//	color.ambient_diffuse_specular( 0.9,  0.9,  0.9,    0.9,  0.9,  0.9,     0.9,   0.9,  0.9  );


	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);			glEnable(GL_BLEND);
	glBindTexture(GL_TEXTURE_2D, phTexture);
	glEnable(GL_TEXTURE_2D);

	glBegin( GL_QUADS );

	for( int j=0; j < 4; j++ ){

		if (j==0) glTexCoord2f(  _texCoord[3].x,      _texCoord[3].y    );			
                                if (j==1) glTexCoord2f(  _texCoord[2].x,      _texCoord[2].y  );
		if (j==2) glTexCoord2f(  _texCoord[1].x,      _texCoord[1].y ); 
		if (j==3) glTexCoord2f(  _texCoord[0].x,      _texCoord[0].y     ); 

		glVertex3f( PhotoPoly[j].getX(), PhotoPoly[j].getY(), PhotoPoly[j].getZ() );
	//	glNormal3f( PhotoNor->getX(), PhotoNor->getY(), PhotoNor->getZ() );
	}
	glEnd( );
	glFlush( );  

	glDisable(GL_BLEND);
	glDisable(GL_TEXTURE_2D);

}

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.