[cl-opengl-devel] Trying to do Nehe tutorials

Ken Tilton kentilton at gmail.com
Thu Sep 21 23:43:06 UTC 2006


On 9/21/06, Charlie Burrows <charlie.burrows at gmail.com> wrote:
>
> Hi,
> I've been trying to do the nehe tutorials in cl-opengl and I've got
> the first two working but there's a small problem. It is probably an
> opengl issue rather than a cl-opengl problem but I'm sure all you nice
> people won't mind my ignorance (too much) and besides where else could
> I post my code and get a reply!
>
> Ok so I've got two classes; the first one works find (as far as it
> goes) the second also works but only if I don't enable depth testing.
> If I enable depth testing then the two shapes I draw disappear.
> The code is here: http://paste.lisp.org/display/26461


I wonder why you ever see anything. Where are you setting the color?  I must
be missing something since you say you see something without depth testing.
This is nehe-2? nehe-2 sets colors:

int DrawGLScene(GLvoid)                                    // Here's Where
We Do All The Drawing
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);    // Clear Screen
And Depth Buffer
    glLoadIdentity();                                    // Reset The
Current Modelview Matrix
    glTranslatef(-1.5f,0.0f,-6.0f);                        // Move
Left 1.5Units And Into The Screen
6.0
    glBegin(GL_TRIANGLES);                                // Drawing Using
Triangles
        glColor3f(1.0f,0.0f,0.0f);                        // Set The Color
To Red
        glVertex3f( 0.0f, 1.0f, 0.0f);                    // Top
        glColor3f(0.0f,1.0f,0.0f);                        // Set The Color
To Green
        glVertex3f(-1.0f,-1.0f, 0.0f);                    // Bottom Left
        glColor3f(0.0f,0.0f,1.0f);                        // Set The Color
To Blue
        glVertex3f( 1.0f,-1.0f, 0.0f);                    // Bottom Right
    glEnd();                                            // Finished Drawing
The Triangle
    glTranslatef(3.0f,0.0f,0.0f);                        // Move Right 3
Units
    glColor3f(0.5f,0.5f,1.0f);                            // Set The Color
To Blue One Time Only
    glBegin(GL_QUADS);                                    // Draw A Quad
        glVertex3f(-1.0f, 1.0f, 0.0f);                    // Top Left
        glVertex3f( 1.0f, 1.0f, 0.0f);                    // Top Right
        glVertex3f( 1.0f,-1.0f, 0.0f);                    // Bottom Right
        glVertex3f(-1.0f,-1.0f, 0.0f);                    // Bottom Left
    glEnd();                                            // Done Drawing The
Quad
    return TRUE;                                        // Keep Going
}

Confused.

kt

ps. I suggest you make each example standalone and not try to inherit code
for lesson 2 from lesson 1 if this is going to be stuff in a public library.
Of course if you just want to mix in CLOS training I understand, but it may
compromise the value of the contrib to cl-opengl. kt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cl-opengl-devel/attachments/20060921/46f6a856/attachment.html>


More information about the cl-opengl-devel mailing list