realbasic-games
[Top] [All Lists]

Re: OpenGL Lighting again

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: OpenGL Lighting again
From: Asher Dunn <asher at fireyesoftware dot com>
Date: Mon, 25 Oct 2004 16:32:13 -0400
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <BDA1ACDE dot 57EE%mauitom at maui dot net>

On Oct 25, 2004, at 1:02 AM, Thomas Cunningham wrote:

Unless I misunderstand you, the normals should rotate with the cube.=20
The normals are cube relative, aren't they? When you use glRotate*,=20
that rotates *everything* (actually I'm using glMultMatrixf, but it=20
doesn't matter).

Right. It's the calls to glScale that messes up the normals, not rotate or
translate. I am not sure about glMultMatrix.

glMultMatrixd takes a 4x4 matrix, so you can to translation, rotation, and scaling (presumably in that order) in one operation. I am using a scale of 1.0 now, and I have GL_RESCALE_NORMAL enabled, so the normal's aren't the issue. They are pre calculated (by hand, by me) anyway. It's just a cube, so I can afford to do that.

This setting of the normal is set in between each primitive drawn inside of glEnd and glEnd. This solves the problem for me. As I rotate the object the
light pattern looks correct now.

I'm using display lists, with the color and normal specified per vertex. I will try with glBegin/glEnd and see if that changes anything (maybe my normals are getting mangled when I load them into the memoryBlock).

If you want to see a few demo apps of mine.
http://www.maui.net/~mauitom/OpenGL.html

Big Gollum you've got there!!
The Lit Sphere demo does look nice. Are you willing to share any code? :-)

The pyramid one is completely freaked out on my computer. It has some clipping issues. Not as bad as my demos used to have, but it still gets clipped strangely.

Asher Dunn
--------------------------------------------------------
President and Head Developer of Fireye Software <http://www.fireyesoftware.com/> Make PDFs from your RB app <http://www.fireyesoftware.com/code/pdfclasses/>
AIM and Yahoo: fireye7517
REALbasic 5.5.3 Mac OS X 10.3.5

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>