PDA

View Full Version : smooth texture mapping on sphere



HarryB
03-08-2005, 11:05 AM
Hello,
I am struggling with mapping textures on wireframe spheres in a way that they continue smoothly at the polygon edges. In my current implementation, you can see where the next polygon starts. Who can help me? My current texture map initialization looks like this:
glTexImage2D(GL_TEXTURE_2D,0,3,p_dib->Width(),p_dib->Height(),0,GL_BGR_EXT,GL_UNSIGNED_BYTE,(GLvoid *)p_dib->GetBits());
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R, GL_NEAREST);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);//GL_DECAL);

glEnable( GL_TEXTURE_2D );
...
... and then rendering of the triangles, using the glTexCoord2d() command.

Thanks very much for your help!
HarryB

dvm
03-08-2005, 04:47 PM
You could take a look at glu's quadric gluSphere. It served me well in the past. And all texture coordinate mapping is automatically done for you, when you enable it with gluQuadricTexture. Good luck!