Since I cannot find a way to paste a figure , isketched how my output looks like:
/--\
/------\
/----------\
/----------------\
/----------------------\
/----------------------------\
/-----------------------\
/-------------------\
/------------\
/--------\
/----\
/--I am reading from a file the vertices of a sphere, When i represent my sphere on screen (by using GL_POLYGON) I get the result in the above "slices". The front face of the sphere that I see has the texture that I am applying to it, but when I start to rotate my sphere I see these "slices". It's as if the sphere is created by a lot of cone polygons (for some reason).
What I really want is to have a solid sphere with a uniform texture applied to it. The thing is that I want this object to be created from reading a data file for vertices, so i cannot use something like solisphere etc.
Any ideas guys?
Cheers
[Edited by - cockney on December 22, 2004 3:34:16 PM]
Draw a surface based on a set of points?
you add an image with <img src="the images url" />
http://www.roboguy.net(WIP) - lisperati - SICP - Haskell - Python - OCaml - Lambda the Ultimate - Good Math, Bad Math - Wiki (not Wikipedia) - Pure - Term-Rewriting Functional Language

I guess it does not work, I do not have a web site, I have the image locally into my PC.
Sorry boy, I was so busy with the work and I also didn't get used to this forum yet. It just sent me an email, so I logged on right away.
I used the algorithm in this website. I checked out lots of them, but it is a routine with input and output.
http://astronomy.swin.edu.au/~pbourke/terrain/triangulate/
I hope it helps, I know how it feels;)
BTW, Happy Holiday
I used the algorithm in this website. I checked out lots of them, but it is a routine with input and output.
http://astronomy.swin.edu.au/~pbourke/terrain/triangulate/
I hope it helps, I know how it feels;)
BTW, Happy Holiday
Thx , but I do not want ot create a surface, I just want to texture an object that is created by reading vertices from a data file.
Any ideas guys?
Here is the latest source:
Any ideas guys?
Here is the latest source:
public override void glDraw() { GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);// Clear The Screen And The Depth Buffer GL.glLoadIdentity(); // Reset The View GL.glEnable(GL.GL_TEXTURE_2D); GL.glBindTexture(GL.GL_TEXTURE_2D, textures[0]); GL.glTranslatef(cx, cy, cz); // Translate The The Current Position To Start Drawing GL.glRotatef(xrot, 1, 0, 0); // Rotate On The X Axis By xrot GL.glRotatef(yrot, 0, 1, 0); // Rotate On The Y Axis By yrot GL.glRotatef(zrot, 0, 0, 1); // Rotate On The Z Axis By zrot xrot += xspeed; yrot += yspeed; zrot += zspeed; // Increase xrot, yrot & zrot by xspeed, yspeed & zspeed float tx, ty, tz; // Temp X, Y & Z Variables Vertex q; // Holds Returned Calculated Values For One Vertex float[] t=new float[2]; float[] xyz=new float[3]; GL.glBegin(GL.GL_POLYGON); for (int i=0; i < morph1.verts; i++) { if (morph) q = calculate(i); else q.x = q.y = q.z = 0; // If morph Is True Calculate Movement Otherwise Movement=0 helper.points.x -= q.x; // Subtract q.x Units From helper.points.x (Move On X Axis) helper.points.y -= q.y; // Subtract q.y Units From helper.points.y (Move On Y Axis) helper.points.z -= q.z; // Subtract q.z Units From helper.points.z (Move On Z Axis) tx = helper.points.x; // Make Temp X Variable Equal To Helper's X Variable ty = helper.points.y; // Make Temp Y Variable Equal To Helper's Y Variable tz = helper.points.z; // Make Temp Z Variable Equal To Helper's Z Variable xyz[0]=tx; xyz[1]=ty; xyz[2]=tz; float c=PI/180.0f; GL.glTexCoord2f(0.0f,1.0f); GL.glTexCoord2f(1.0f,1.0f); GL.glTexCoord2f(1.0f,0.0f); GL.glTexCoord2f(0.0f,0.0f); GL.glTexCoord2f(((float)Math.Sin(tx))*((float)Math.Cos(tx)),((float)Math.Sin(ty))*((float)Math.Cos(ty))); GL.glVertex3f(tx,ty,tz); } GL.glEnd(); uint error = GL.glGetError(); if(error != GL.GL_NO_ERROR) { Console.WriteLine(error); } else {Console.WriteLine("No error occured");} GL.glDisable(GL.GL_TEXTURE_2D); GL.glFlush(); }[\source]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement