PDA

View Full Version : texture & light



wizzo
04-16-2003, 06:24 AM
here is my problem : i can load some sphere (they are a solar system), no problem.
aside, i can load a tga texture, no problem

but when i want both at the same time, i get the planet reder, but the texture is so so dark that i almost see it...

so the problem would be the render of a light on a texture... if anybody can help great thx

wizzo

gunslinger
04-16-2003, 06:47 AM
hi there,
i had a similar problem with the rendering of a terrain. when i turned the lights on, pooof, all the land became dark. U simply have to supply the vertex normals for every vertex of the sphere. Boring but necessary. Lemme now if that was of any help. Bye and good luck, the Gunslinger

wizzo
04-16-2003, 07:27 AM
ok thx
the problem is that i am a real beginner, and that i don't know how to do the normal to a sphere... can you help me doing it (i used glut for the sphere) ?
thx for your help, really - now if i dont know how to solve the problem, i know what it is which is good =D

wizzo

nexusone
04-16-2003, 08:15 AM
Part of you problem maybe is that glutSolidSphere does not have any texture coors, only normals.

If you want to use a texture can use gluSphere and have it create normals and texture coords for you.

example:

sphere = gluNewQuadric();
gluQuadricDrawStyle( sphere, GLU_FILL);
gluQuadricNormals( sphere, GLU_SMOOTH); // Normals setting for glu objects
gluQuadricOrientation( sphere, GLU_OUTSIDE);
gluQuadricTexture( sphere, GL_TRUE); // Create texture coords.

If you want the complete code, look at glball demo on my website,uses glut for window creation and gluSphere:
www.angelfire.com/linux/nexusone/ (http://www.angelfire.com/linux/nexusone/)



Originally posted by wizzo:
ok thx
the problem is that i am a real beginner, and that i don't know how to do the normal to a sphere... can you help me doing it (i used glut for the sphere) ?
thx for your help, really - now if i dont know how to solve the problem, i know what it is which is good =D

wizzo

[This message has been edited by nexusone (edited 04-16-2003).]

[This message has been edited by nexusone (edited 04-16-2003).]

wizzo
04-16-2003, 09:06 AM
hum.... gluquadric is to map the texture to the shere right ? my original problem was to apply a texture to a square, behind the sphere but i couldnt map a texture to a sphere too, so thx, that helped me too =) i'm gonna try that
wizzo