How to implement Sea Light?

Hello everyone.

I am now implementing a small fish project, which the fish can swim freely in the sea.

I want some tutorials, references or libraries on how to implement the light under the sea, which similar to the dolphin example in DirectX SDK. Thanks you very much.

P.S: Is there any homepage about using OpenGL to rewrite the examples in DirectX?

[This message has been edited by takumi (edited 10-27-2002).]

On this website under programming advanced and FAQ, are some examples of underwater effects.

Originally posted by takumi:
[b]Hello everyone.

I am now implementing a small fish project, which the fish can swim freely in the sea.

I want some tutorials, references or libraries on how to implement the light under the sea, which similar to the dolphin example in DirectX SDK. Thanks you very much.

P.S: Is there any homepage about using OpenGL to rewrite the examples in DirectX?

[This message has been edited by takumi (edited 10-27-2002).][/b]

Thanks a lot, let me check it.

Thx nexusone

[This message has been edited by takumi (edited 10-31-2002).]

I have followed the demo to implement the underwater caustics. However, the light do not have any ripple effect (movement), it just performed as a static light in my scene.

The Demo use GLUT function to build the display window, and my project are base on NeHe base code. Is that I have miss something out in this part?

Please give me some advises. Thanks you.

[This message has been edited by takumi (edited 10-31-2002).]

I don’t think switching from glut to win32 api would change the gl code part much if at all. I looked at the program underwater.c, if you have coverted it from GLUT to widows API.

What did you replace the glutIdelFunc with?
This is what caused the patterns to chagne.

Originally posted by takumi:
[b]I have followed the demo to implement the underwater caustics. However, the light do not have any ripple effect (movement), it just performed as a static light in my scene.

The Demo use GLUT function to build the display window, and my project are base on NeHe base code. Is that I have miss something out in this part?

Please give me some advises. Thanks you.

[This message has been edited by takumi (edited 10-31-2002).][/b]

[This message has been edited by nexusone (edited 11-01-2002).]

Originally posted by nexusone:
[b]I don’t think switching from glut to win32 api would change the gl code part much if at all. I looked at the program underwater.c, if you have coverted it from GLUT to widows API.

What did you replace the glutIdelFunc with?
This is what caused the patterns to chagne.

[This message has been edited by nexusone (edited 11-01-2002).][/b]

I think I have replace the glutIdelFunc wrongly…
How should I replace the glutIdelFunc correctly in Windows API?

Please teach me…thanks you very very very much.

[This message has been edited by takumi (edited 11-01-2002).]

Ether post your code here or email me what you have written, so I can see what you are doing…

Originally posted by takumi:
[b] I think I have replace the glutIdelFunc wrongly…
How should I replace the glutIdelFunc correctly in Windows API?

Please teach me…thanks you very very very much.

[This message has been edited by takumi (edited 11-01-2002).][/b]

That’s ok…but, would u mind to give me some ideas that how to implement glutIdelFunc in Windows API? Because I want to learn and try to implement it by myself~~~

Thx nexusone and all of you~

I think a simple function called somewhere in your gameloop (like at the beginning) would be fine to do the code in GlutIdleFunc
Am I wrong ?
Just guessing…
Good Luck that’s an interresting question


Evil-Dog
let’s have a funny day

I am not good at windows programming, try this website:

Originally posted by takumi:
[b]That’s ok…but, would u mind to give me some ideas that how to implement glutIdelFunc in Windows API? Because I want to learn and try to implement it by myself~~~

Thx nexusone and all of you~[/b]

Look up the documentation for glutIdleFunc http://www.opengl.org/developers/documentation/glut/spec3/spec3.html and see what it does.

Go to nehe’s site(previous post) and learn how to open windows with opengl support.

You might want to check out some simple window gui samples at msdn.microsoft.com to understand how window/message management works under win32.

The short answer is, since glut is callback driven you need a way of executing code “all the time”, hence glutIdleFunc. In win32 you would have a while loop instead of the glutMainLoop that processes messages.

You will see code like this all the time in win32 gui c apps:

while(GetMessage(&msg…)) {
TranslateMessage(…)
DispatchMessage(…)

// here you could call idle()
// and here display()
}

nehe code probably implements the while loop
somewhat different to call display() as often
as possible.

[This message has been edited by roffe (edited 11-05-2002).]