GLUT underwater example and multitexturing

I think I’m doing something wrong… I’m using multitexturing for a school project, and what I’m trying isn’t working. So I decided to modify the inspiration, the underwater example from GLUT.

My modified version doesn’t work either, so that’s why I think I’m doing something wrong. Could someone take a look at it? I’ve placed the modified underwater.c at

It compiles under Apple’s OpenGL for MacOS X, I don’t know if it’ll compile elsewhere.

Okay, I’ve managed to get this working… however, I don’t have it working in my own code… ugh… any insight as to where I could possibly be going wrong?

I have some primitives with a primary texture, some with materials. In order to keep my caustic texture, I’m using a blank texture for the primitives with materials. For the others, the first texture unit is that primitive’s texture. For all primitives, texture 2 is the caustic texture. However, at the moment, it’s not showing up on any of them.


Are you calling glEnable(GL_TEXTURE_2D) for both texture units?

    GLfloat sPlane[4] = { 0.05, 0.03, 0.0, 0.0 };
    GLfloat tPlane[4] = { 0.0, 0.03, 0.05, 0.0 };
    static const float causticScale = 1.0;

    // First set the texture coordinates for that point
        glMultiTexCoord2f(GL_TEXTURE0_ARB, fTexS, fTexT);
        sPlane[0] = 0.05 * causticScale;
        sPlane[1] = 0.03 * causticScale;
        tPlane[1] = 0.03 * causticScale;
        tPlane[2] = 0.05 * causticScale;
        // see tex coord generation mode
        glTexGenfv(GL_S, GL_OBJECT_PLANE, sPlane);
        glTexGenfv(GL_T, GL_OBJECT_PLANE, tPlane);

This is done just before I define the vertex. Is everything in the proper order? Should texture coordinate generation be elsewhere? Thanks!

[This message has been edited by skwirl (edited 12-16-2001).]