Qbasicnews.com

Full Version: opengl lighting.....
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
does anyone know the format for the position command in open gl lighting....

light_position(0)= .... is there a x,y,z format??
light_position(1)= .... what exactly do i put here??
light_position(2)= .... and what does it mean??
light_position(3)= .... is there life in space??

any help would be appreciated..

ps.. collision engine is complete.. is there a place to upload a demo in here??
You might try http://www.xmission.com/~nate/tutors.html for lighting. There's a link at the top for source code (via ZIP file). Not sure if that will help though. I tried Google and it seems evasive.
Quote:does anyone know the format for the position command in open gl lighting....

light_position(0)= .... is there a x,y,z format??
light_position(1)= .... what exactly do i put here??
light_position(2)= .... and what does it mean??
light_position(3)= .... is there life in space??

any help would be appreciated..

ps.. collision engine is complete.. is there a place to upload a demo in here??

Code:
light_position(0)= x
light_position(1)= y
light_position(2)= z
light_position(3)= w

quickhost.tk
it never seems to surprise me what you know rel thanks..and thanks rpgfan, what does the 'w' stand for? width??
it's a firth coordinate used for projection and non linear operations involving the 3d coordinates ( perspective texture mapping etc. ) basically converting things from one space to another etc.
well i got that part workin, is seems the tut's from rpgfan are really helpfull. i now know that the 'w' means either directional or positional..anyone who is using open gl for 3d stuff should definately get this tut, its better then the directX sdk..now for the next question. it seems that my lighting isnt staying on all the time... when i rotate camera it turns completely off at a specific spot,, and even though i have slection positional lighting, it moves around with camera rotation, and its not moveing evenly, its way off...

hehehe this one is goin to be tricky, :bounce:
It just depends on when you call... glLightfv with GL_Position as the second parameter. If you do it after you've rotated an object space, then it's going to translate/rotate with the current modelview matrix. How are you doing it now?
drawscene:
glloadidentity
gldisable gl_blend
GluLookAt camx,camy,camz,camrx,camry,camrz,upx,upy,upz'camx,camy,camz,camrx,10,camrz,0,0,1
glLightfv (GL_LIGHT0, GL_POSITION, @light_position(0))
glClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT
gldisable gl_cull_face
glscalef 2000,150,2000
gosub DrawCube
return


thats a sub thats called after movement,collision,ect is dechipered..
Well, that should work fine as long as your rotation isn't going on the other side of the light... or that large scaling value isn't clipping the light. :???:
first i was thinking that too but when i select positional lighting , the light still moves around the world when i move, and as for scale, it doesnt make sence that the lighting is being drawn on the objects properly but moving around....if scale was the problem then it wouldnt draw on the scaled objects properly...it looks like good lighting but it wont stay still!!!
Pages: 1 2