I'm having a bit of trouble figuring out how to add a texture to this half sphere generation code. As the title says, I'm trying to create a simple skydome, but I'm attempting to use a horizontal texture @ 512x128, so it has to wrap around. I've searched the net for days, but have never found a single ounce of code that does what I need to do here. This is what I have so far:

void RenderDome()
{
#define PI 3.1415926535897932384626433832795
#define K1 PI/20.f
#define K2 PI/20.f
#define R 100
GLfloat i,j;
GLfloat x,y,z;
static int t1,t2;
for (u=0;u<=PI;u+=K1)
{
glBegin(GL_QUAD_STRIP);
for (v=0;v<=PI+K2;v+=K2)
{
x=R*cos(i)*sin(i);
y=R*sin(i)*sin(i);
z=R*cos(j);
glVertex3f(x,y,z);
x=R*cos(i+K1)*sin(j);
y=R*sin(i+K1)*sin(j);
glVertex3f(x,y,z);
}
glEnd();
}
}

So, how would generate the texture coordinates from this? Any ideas? Thanks.

Follow Shogun3D on the official website: http://shogun3d.net

*"Yo mama so fat, she can't be frustum culled." - yoshi_lol*

*"One objection to a “critique of C#” would be that you can’t talk about C# without talking about the whole “.Net experience”. However, one can approach the topic of Hitler without a complete discussion of Nationalist Socialism, so I feel justified." - Steve White.*