egg / raindrop shape, how?

I have been trying to model an egg shape with a sphere and an ellipse without being very succesful. Now things are worse because I need to apply a texture to it.

Does anyone know how could I deform a sphere so that it looks like an egg?

Thanks
Joan

As you get to more advanced 3D models, most peole start using a 3D modeling program to design their object.

With a drop, try drawing it out on paper then build it using a vertex array.
Should not be that hard to do.

Originally posted by jpuig:
[b]I have been trying to model an egg shape with a sphere and an ellipse without being very succesful. Now things are worse because I need to apply a texture to it.

Does anyone know how could I deform a sphere so that it looks like an egg?

Thanks
Joan[/b]

If I was you I would write an OBJ loader and model it with a 3d modeling program like MAYA then load it into memory with your code and draw it.

First of all, thanks for all your replies.
A modeller is not going to help me because I need to be able to change the shape of it in run-time

I was hoping there would be some sort of transformation matrix that would help me with that

Thanks
Joan

There are examples of changing object shape during run-time. nehe.gamedev.net has a tutor on that, also I have seen some others out there.

But it you build with array’s, you need only make changes on the effected array values to make a object deform or change shape.

example:

array1 sphere = data_set1;
array2 drop = data_set2;
both data set’s have same amount of points.

array3 drawing_data; here is where you will store data to be drawn.
You will start with drawing_data = sphere;
then have the vertex point start moving to the vertex points in drop. This will make the object morf into one or the other.

Originally posted by jpuig:
[b]First of all, thanks for all your replies.
A modeller is not going to help me because I need to be able to change the shape of it in run-time

I was hoping there would be some sort of transformation matrix that would help me with that

Thanks
Joan[/b]

I draw alot of my stuff with rings. What you could do is draw a series of rings with different diameters. I draw pipes that way. I connect all the rings together. and it looks like one piece if you do the same but adjust the diameters as you go then you can have an egg.

grab milkshape . it’s only $20 and the file format is quite simple. come’s with an SDK for creating your own plug-ins.

b

Using rings seems like a very good idea (the second thing that came to my mind after a fransformation matrix), but the reason why I posted in the begginer forum is because I can’t do anything above the real basic stuff. I would like to know if there is a tutorial online that I could use to get me started, or if it is very simple, could you post some sample code

Thanks
Joan

Hmm, try this. I am at work so can’t try it but It is an idea.

extra=1.5; //extra length in the egg direction
for (int i=0;i<=upsegs;i++)
{
glBegin(TriangleStrip)
for (int j=0;j<=segs;j++){
if (i<upsegs/2)
{
glTexCoord2f(j/segs,i/upsegs);
glVertex3f(rSin(i2PI/upsegs)Cos(j2Pi/segs),rSin(i2Pi/upsegs)Sin(j2PI/segs),rCos(j2PI/upsegs));
glTexCoord2f(j/segs),(i+1)/upsegs);
glVertex3f(rSin((i+1)2PI/upsegs)Cos(j2Pi/segs),rSin(i+12Pi/upsegs)Sin(j2PI/segs),rCos(j+12PI/upsegs));
}
else
{
glTexCoord2f(j/segs,iextra/upsegs);
glVertex3f(r
Sin(i2PI/upsegs)Cos(j2Pi/segs),rSin(i2Pi/upsegs)Sin(j2PI/segs),rCos(j2PI/upsegs)extra);
glTexCoord2f(j/segs),(i+1)extra/upsegs);
glVertex3f(r
Sin((i+1)2PI/upsegs)Cos(j2Pi/segs),rSin(i+1
2Pi/upsegs)Sin(j2PI/segs),r
Cos(j+1*2PI/upsegs)*extra);
}
}

glEnd();

The idea is to create a sphere but with the bottom half z vaklues multiplied by 1.5 (extra). The texture coorinates then just follow the same rule (although this means they are repeated at the top) If you want a single texture to wrap the object them you have to work out the extra length (post here and I will have a think),

fringe