1
$\begingroup$

I have just started learning OpenGL and I am trying to map a texture on a Quad Strip. Basically, I am trying to create a parametric surface and I don't know how to map the coordinates. What can I do? This is what I tried so far and, unfortunately, it doesn't work.

public void draw(GL2 gl, GLU glu, GLUT glut) {

    Textures.track.enable(gl);
    Textures.track.bind(gl);

    gl.glEnable(GL_TEXTURE_2D);

    gl.glBegin(GL_QUAD_STRIP);

    double t = 0.0;
    gl.glColor3f(1f, 1f, 1f);

    for(int i = 0; i <= 100; i++){
        t = t + 0.01;
        Vector tangent = getTangent(t);
        Vector normal = tangent.cross(Vector.Z);
        Vector centerPoint = getPoint(t);

        Vector point1 = centerPoint.subtract(normal.scale(w/30));
        Vector point2 = centerPoint.add(normal.scale(w/30));

        gl.glTexCoord2f((float)t, 0f);
        gl.glVertex3d(point1.x, point1.y, point1.z);
        gl.glTexCoord2f(0f, (float)t);
        gl.glVertex3d(point2.x, point2.y, point2.z);
    }
    gl.glEnd();
}
$\endgroup$

closed as unclear what you're asking by Nicol Bolas, Nathan Reed, trichoplax Jan 12 '17 at 12:58

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    $\begingroup$ Hello! Can you explain (or better yet, show!) how it isn't working, and how you expect it to work? $\endgroup$ – Alan Wolfe Jan 11 '17 at 21:26