Skip to main content
GameDev.net gamedev.net
🔒 Locked

texture mapping

Started by skinx Sep 19, 2005 at 11:03 PM 3 replies 1.4k views
Original Post
skinx
skinx
guys, i have problems doin on the texture mapping on sphere, it just cant map it out.. why? this is just a normal sample (every thing is set, like the image is load): glDisable(GL_LIGHTING); mat_specular[0] = 2.55; mat_specular[1] = 0.0; mat_specular[2] = 2.55; mat_specular[3] = 1.0; glMaterialfv(GL_FRONT, GL_SPECULAR,mat_specular); GLfloat light_position[]={50.0, 200.0,50.0,1.0}; glLightfv(GL_LIGHT0, GL_POSITION, light_position); glPushMatrix(); glTranslatef(a, b, 0.0f); glEnable(GL_TEXTURE_2D); glutSolidSphere(5.0,50.0,10.0); glEnd(); glPopMatrix(); glDisable(GL_TEXTURE_2D); glEnable(GL_LIGHTING); why this code cant load the image? it just turned black...
ff8
ff8
try to put glColor3f(1,1,1); b4 glutSolidSphere and make sure u enabled TEXTURE_2D
NLDEV
NLDEV
IIRC, the glut drawing routines do not generate texture coordinates, which would be detrimental to your texturing.
...
Hmm, actually just looked at the glut spec. Try drawing a teapot--it seems that glutSolidTeapot is unique in that it does generate texture coordinates.
skinx
skinx
hmmm i tried the glColor3f(1,1,1); but still cant works... i dunno y.. but everything seems alright.. do u guys have other alternative to this?
Kalidor
Kalidor
Is your texture bound, because you aren't binding it in the code you posted? Did you try with the teapot instead since the other glut objects don't have texture coordinates? Are you sure you're loading and creating the texture correctly? What is that glEnd doing there?

Topic Locked

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

Sign in to reply to this topic.