PDA

View Full Version : texture in circle



JOSE ML
09-03-2002, 02:21 PM
hi, can anyone tell me if theres a way i can make a circle without making it with lines? and can anyone give me an example on how to texture a sphere?
thanks

31337
09-03-2002, 02:30 PM
Well you could use bezieh (that is spelled wrong) curves to make a circle and nurbs (I think). There's also some command like glCircle or somethin that will make a circle. The other method is to use sine and cosine and to for loop drawing lines to produce a circle. I have only used the last two methods before. However nomatter what all a circle is once it comes down to it is a bunch of lines (in a non theoretical sense).

Hope I have shed some light on your situation. In terms of texturing, if you use the last solution texturing would be a piece of cake.

nexusone
09-03-2002, 03:39 PM
Sorry but there is no glCircle command, a circle is a 2D object. But gluDisc makes a flat disk, with or without a hole in the center and you can add a texture to it.

Easy way for a textured sphere is with the gluSphere and the gluQuadricTexture commands.

Easy circle: you can make a circle with a paint program and apply it to a quad as a texture.

http://www.opengl.org/discussion_boards/ubb/smile.gif


Originally posted by JOSE ML:
hi, can anyone tell me if theres a way i can make a circle without making it with lines? and can anyone give me an example on how to texture a sphere?
thanks



[This message has been edited by nexusone (edited 09-03-2002).]

Miguel_dup1
09-03-2002, 06:41 PM
Well, the was I texture my sky dome is simply taking one texture and spreding it across the entire sky... I get the coordinates with simple sin cos functions which I use to create my sky dome itself...

First ask yourself how you make a sphere...
Then you will see that with the formula of the sphere with radius one you already have a full set of coordinates since a texture coordinates normally range from 0 to 1.
So after you compute your x,y,z vertices for your sphere, you could get the point of the texture in the sphere with something like:

m_Texture[0] = x*(radius)*0.5f + 0.5f;
m_Texture[1] = z*(radius)*0.5f + 0.5f;

Where the starting point is right at the top of the sphere...