Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Basic OpenGL Transformation 'n Lighting question.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic OpenGL Transformation 'n Lighting question.



On Tuesday, September 23, 2003, at 12:01 AM, Aaron Boothello wrote:

i have an opengl scene and single light with the following attributes:

lightAmbient2[] = { 0.5f, 0.5f, 0.5f, 1.0f };
lightDiffuseColor2[] = {1.0, 1.0, 1.0, 1.0};
lightPosition2[] = {1.0, 1.0, 1.0, 1.0};

here is the pseudo code:
lighting is enabled.
pushmatrix().
transformation of object.
i draw a series of triangles into the scene.
popmatrix().

here's my problem:
region A on the group of triangles is illuminated and region B is in shadow.
i rotate the entire group of triangles about the y-axis by 90 degrees.

BUT region A is still the region that is illuminated and region B is in shadow. i'd like the light to be 'stationary' and while the object is transformed lighting on it's surfaces(triangles) changes accordingly.

Thanks,
Aaron.

The following works for me:
with MatrixMode equal to GL_MODELVIEW:
set up lighting
glLoadIdentity()
glMultMatrix(<suitable rotation>)
draw my objects.

It may be important that I call glFrustum() with MatrixMode set to GL_PROJECTION.

HTH
Chris Henrich
_______________________________________________
mac-opengl mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/mac-opengl
Do not post admin requests to the list. They will be ignored.

References: 
 >Basic OpenGL Transformation 'n Lighting question. (From: Aaron Boothello <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.