An OpenGL oddity I could use some help on
Bob Arning
arning at charm.net
Wed Oct 2 20:48:17 UTC 2002
Hi all,
I must be missing something, but what?
Cheers,
Bob
'From Squeak3.2 of 11 July 2002 [latest update: #4956] on 2 October 2002 at 4:45:13 pm'!
"Change Set: lightingTest
Date: 2 October 2002
Author: Bob Arning
This has been puzzling me for quite a while. I have a simple 3-D scene with a cube and a directional light, like the sun.
BobsTestMorph new openInWorld
The effect of the light, as I understand it, should depend on the angle between the light and the surface normals of the cube - not the position of the camera. However, as you move the camera (click and shift-click in this example), the shading of the sides of the cube will sometimes change. As the example is set up, one click in either direction will show a change in shading. Any ideas what's up?"!
B3DSceneMorph subclass: #BobsTestMorph
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Balloon3D-Demo Morphs'!
!BobsTestMorph commentStamp: 'raa 10/2/2002 15:35' prior: 0!
BobsTestMorph new openInWorld!
!B3DDirectionalLight methodsFor: 'converting' stamp: 'raa 10/2/2002 15:48'!
direction: aVector
direction _ aVector
! !
!BobsTestMorph methodsFor: 'as yet unclassified' stamp: 'raa 10/2/2002 16:43'!
createDefaultScene
| sceneObj camera obj lightColor |
"
BobsTestMorph new openInWorld
"
sceneObj _ B3DSceneObject named: 'Sample Cube'.
obj _ B3DIndexedMesh vrml97Box copy.
sceneObj texture: ((Form extent: 32 at 32 depth: 32) fillColor: Color gray; asTexture).
obj faceNormals.
sceneObj geometry: obj.
camera _ B3DCamera new.
camera position: 3.5 at 0@3.5.
camera fov: 20.
self extent: 100 at 100.
scene _ B3DScene new.
scene defaultCamera: camera.
scene objects add: sceneObj.
lightColor _ B3DMaterialColor new.
lightColor ambientPart: (Color gray: 0.5).
lightColor diffusePart: (Color gray: 0.5).
lightColor specularPart: (Color gray: 0.5).
scene lights add: (
B3DDirectionalLight new lightColor: lightColor; direction: 1 at 1@1
).
! !
!BobsTestMorph methodsFor: 'as yet unclassified' stamp: 'raa 10/2/2002 16:41'!
initialize
super initialize.
self color: Color lightBlue.
self accelerationEnabled: true.
self on: #mouseDown send: #myMouseDown: to: self.
! !
!BobsTestMorph methodsFor: 'as yet unclassified' stamp: 'raa 10/2/2002 16:12'!
myMouseDown: evt
scene defaultCamera rotateBy: (evt shiftPressed ifTrue: [-15] ifFalse: [15]).
self changed.! !
!BobsTestMorph methodsFor: 'as yet unclassified' stamp: 'raa 10/2/2002 16:09'!
step
"nada"! !
More information about the Squeak-dev
mailing list
|