¿Cómo dibujar un toro texturizado en OpenGL sin usar GLUT?
Necesito renderizar un toro en OpenGL, sin usar GLUT. Estoy usando enlaces de C # y Tao Framework. Tengo el siguiente código, que obtuve deaqu.
private void DrawTorus() {
int numc = 100, numt = 100;
double TWOPI = 2 * Math.PI;
for (int i = 0; i < numc; i++) {
Gl.glBegin(Gl.GL_QUAD_STRIP);
for (int j = 0; j <= numt; j++) {
for (int k = 1; k >= 0; k--) {
double s = (i + k) % numc + 0.5;
double t = j % numt;
double x = (1 + 0.1 * Math.Cos(s * TWOPI / numc)) * Math.Cos(t * TWOPI / numt);
double y = (1 + 0.1 * Math.Cos(s * TWOPI / numc)) * Math.Sin(t * TWOPI / numt);
double z = 0.1 * Math.Sin(s * TWOPI / numc);
Gl.glVertex3d(2 * x, 2 * y, 2 * z);
}
}
Gl.glEnd();
}
}
Este código dibuja un toro, pero ahora necesito ponerle una textura. Estoy tratando de usaresta fórmulas para las coordenadas de textura, pero no puedo entender qué usar para R y r (radio interno y externo respectivamente).
v = arccos (Y/R)/2pi
u = [arccos ((X/(R + r*cos(2pi * v))] * 2pi
Tengo algunos problemas para comprender ese código, agradecería una explicación o tal vez un código alternativo más intuitivo con comentarios. Cualquier ayuda será muy apreciada