PDA

View Full Version : How to implement Sea Light?



takumi
10-27-2002, 01:32 AM
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. http://www.opengl.org/discussion_boards/ubb/smile.gif

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).]

nexusone
10-27-2002, 04:58 AM
On this website under programming advanced and FAQ, are some examples of underwater effects.


Originally posted by takumi:
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. http://www.opengl.org/discussion_boards/ubb/smile.gif

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).]

takumi
10-28-2002, 09:07 AM
Thanks a lot, let me check it.

takumi
10-29-2002, 11:51 PM
Thx nexusone



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

takumi
10-31-2002, 10:20 PM
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).]

nexusone
11-01-2002, 06:13 AM
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:
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).]



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

takumi
11-01-2002, 06:38 PM
Originally posted by nexusone:
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).]

I think I have replace the glutIdelFunc wrongly... http://www.opengl.org/discussion_boards/ubb/frown.gif
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).]

nexusone
11-02-2002, 03:34 AM
Ether post your code here or email me what you have written, so I can see what you are doing....


Originally posted by takumi:
I think I have replace the glutIdelFunc wrongly... http://www.opengl.org/discussion_boards/ubb/frown.gif
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).]

takumi
11-02-2002, 06:21 PM
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~~~ http://www.opengl.org/discussion_boards/ubb/smile.gif

Thx nexusone and all of you~

Evil-Dog
11-02-2002, 06:49 PM
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*

nexusone
11-03-2002, 05:54 AM
I am not good at windows programming, try this website:

nehe.gamedev.net



Originally posted by takumi:
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~~~ http://www.opengl.org/discussion_boards/ubb/smile.gif

Thx nexusone and all of you~

roffe
11-05-2002, 10:39 AM
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).]