|
Hello,
I have tried without success to map a texture on a NURBS surface using gluNurbsSurface. So far, the surface shows up fine, but without the texture. Here are the relevant fragments of my code:
GLUgl2 glugl2; GLUnurbs nurbs;
float[] knots , ctrl_pts;
Texture t; float[] t_knots , t_pts;
*** inside init:
glugl2 = new GLUgl2(); nurbs = glugl2.gluNewNurbsRenderer();
gl.glEnable(GL2.GL_AUTO_NORMAL);
knots = new float[] { 0.0f , 0.0f , 0.0f , 0.0f , 1.0f , 1.0f , 1.0f , 1.0f };
ctrl_pts = new float[] { ... 4 * 4 * 3 coordinate values ... };
try { t = TextureIO.newTexture(new File("EarthMap_2500x1250.jpg") , true); } catch(Exception e) {}
t_knots = new float[] { 0.0f , 0.0f , 1.0f , 1.0f };
t_pts = new float[] { 0.0f , 0.0f , 0.0f , 1.0f
, 1.0f , 0.0f , 1.0f , 1.0f };
*** inside display:
t.enable(); t.bind();
glugl2.gluBeginSurface(nurbs);
glugl2.gluNurbsSurface(nurbs, 4 , t_knots , 4 , t_knots, 2 * 2 , 2 , t_pts, 2 , 2, GL2.GL_MAP2_TEXTURE_COORD_2);
glugl2.gluNurbsSurface(nurbs, 8 , knots , 8 , knots, 4 * 3 , 3 , ctrl_pts, 4 , 4, GL2.GL_MAP2_VERTEX_3);
glugl2.gluEndSurface(nurbs);
t.disable();
Many thanks in advance for any help,
Manuel
|