Lighting

Started by NickyP101, April 17, 2005, 00:36:20

Previous topic - Next topic

NickyP101

Good morning everyone :)

Im well into my 2d tiles based shooter (top down view and only multiplayer - over internet).

Ive only used to Java API so far and ive actually completed the majority of the game, smooth scrolling works fine, the networking is fine. Im just adding the detail now.

Anyway, ive never used OpenGL, ive used LWJGL for OpenAL but not openGL. I want to use lighting, for example atm my tiles make the game appear as if it is day time, can i use openGL to make it appear night time without creating new tiles? Also when it is night time my player will have a tourch attached to his gun, so can i creat the touch effect using openGL?

Ok here are the questions:

- Can this be done using the Java API? If so how?

- If not, do i use the LWJGL for OpenGL? And are there any good OpenGL Lighting tutorials?

- And lastly, if i use OpenGL, will i be able to implement the lighting without having to change my of my game?

Thanks in advance :) Nick!

princec

Very tricky in Java, almost certainly very slow. You can do it in OpenGL but to actually achieve the effect you don't actually want to use GL lighting at all; instead just modulate your tile corner colours with the appropriate colour.

OpenGL is very different to Java2D so be prepared for a huge shock!

Cas :)

NickyP101

Yeah im aware of the difference, lol will take me a while, but its worth it :) I dont understand what you mean by tile corner colours? Why only the corner?

Fool Running

To do lighting with your tiles you need to change the vertex colors to produce the effect of lighting (i.e. make them brighter the closer to a light source they are). OpenGL lighting is done with polygons in 3D space using normals which wouldn't work too well with 2D sprites (unless you wanted to make it super advanced and super slow and do perpixel lighting on all of your tiles :lol: )
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

elias4444

Hey NickyP101, just to warn you: your post here sounds an awful lot like my first post when I found the lwjgl. I had my game basically done in Java2D, but as soon as I realized how much fun lwjgl was I revamped the whole thing into true 3D. There is a learning curve, but it's been well worth traversing.
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com