PDA

View Full Version : Dynamic Lightning



Micronix-TRSI
23-05-2012, 02:47 PM
Hope you like the Delphi / OpenGL oldschool example!

paul_nicholls
23-05-2012, 11:14 PM
Looks pretty, not that there is very much to see with all that darkness! LOL

de_jean_7777
24-05-2012, 06:05 AM
Looks pretty, not that there is very much to see with all that darkness! LOL
For me it looked nice for a simple example. As for the darkness, it's not that dark, and the underlying textured quad is visible even when not under direct light.

paul_nicholls
24-05-2012, 07:04 AM
It might be because I turned down the brightness on my 30" monitor here at work - it was too bright for working the whole day LOL

LP
24-05-2012, 08:30 PM
Are you sure that there are any lights? Because here it looked like a simple quad with static ambient light.

wagenheimer
24-05-2012, 11:34 PM
I saw the lights! =)

Rodrigo Robles
01-06-2012, 11:07 AM
Really nice. Remembers the oldschool Assembly demo parties.
The source is a good example for using directional lighting.
Using Freepascal would allow some multiplatformity.

farcodev
02-06-2012, 07:35 PM
cool work !

deathshadow
11-06-2012, 09:22 AM
Something's not kosher with how it works here -- after about 3 seconds the cursor appears over the animation as a hourglass, then windows complains about it not responding WHILE it's still running. Taking a guess I'd say the 'while' without a proper wm handler could have something to do with it. GetAsync is cute, it's not a substitute for actually calling windows for input handling.

since last I checked, that's just a waste of time. Likewise there's no reason to set the clear color or matrix mode on every loop.


Still VERY cool demo of openGL lighting.

-- edit -- doh, my bad on the push/popmatrix, removed that part. What I get for posting at 4AM.

deathshadow
11-06-2012, 10:38 PM
Oh, and lighting is not showing up here on high end cards (like my GTX 560ti) because you declare the glLight settings before you've set up the perspective and viewport properly. Works ok on my GMA 950 netbook, and on my Quadro NVS 320 equipped lappy, but my desktop? No lighting.

I'm working on porting this to FPC right now -- using my OpenGL kind-of framework.

de_jean_7777
12-06-2012, 11:29 AM
Yeah, depending on the manufacturer and drivers, setting up lights before projection and/or viewport has no effect. This should be done after the projection has been set up. Learned this the other day after wasting time on some debugging :D

deathshadow
12-06-2012, 11:49 AM
In my porting it to FPC, I discovered that unless you declare GL_POSITION, GL_AMBIENT, GL_DIFFUSE and GL_SPECULAR every frame, you don't get lights on my GTX 560 TI, GTX 260, or ATI 5770 machines. Intel 950 and Quadro NVS 320m don't seem to give a flying fig.

I'll probably post up my version later today -- which uses display lists to help speed things up. I'd use VBO's, but for the life of me I can't make heads nor tails of 'em. I also tried to make it into triangle_strip or quad_strip, and for some reason they refuse to render even when fed the same values -- trying to sort that right now.

Micronix-TRSI
12-06-2012, 11:57 AM
I'll probably post up my version later today -- which uses display lists to help speed things up. I'd use VBO's, but for the life of me I can't make heads nor tails of 'em. I also tried to make it into triangle_strip or quad_strip, and for some reason they refuse to render even when fed the same values -- trying to sort that right now.

Nice to read this!

deathshadow
13-06-2012, 04:54 AM
I ended up finishing my display list rewrite of glKernedFont using this as the test platform. I've got it wrapped in my handler unit for SDL/OpenGL, and tested that it compiles and runs in both windows and linux.

http://www.deathshadow.com/downloads/lightingDemo.rar

source code is naturally in /sources

in /binaries are pre-built versions for win32 and for 32 bit Ubuntu in their own little archives.

The linux binary may work in other distro's, might not. You really want to see it in linux download FPC, make sure the dev files SDL and SDL_image are installed, and build it yerself... and we wonder why not a lot of commercial developers make normal linux software (and why the real Linux success -- Android -- gets rid of most all the *nixisms)

Should build clean in either FPC 2.4 or 2.6, uses SDL to set up video modes and handle input, and SDL_image which lets us use PNG files.

Again, uses my glKernedFont library so we can see the FPS in realtime. Ah, the 'joys' of running multiple projections at the same time :D

I played with some of the values to make the 'bugs' fly around a larger area, changed it to use my FPS object to throttle the animations, and of course it uses display lists.

Full screen only, I'm still playing with it but using SDL it should start up the same resolution as your desktop. Honestly I wonder why the **** most commercial games can't even manage that...