Advertisement

Pleas help

Started by
2 comments, last by dawidjoubert 18 years, 11 months ago
I am doing a project about tree by using OPENGL. This is my first time to use it. However, when i try to draw a tree by using a loop, i want to show it step by step after every period of time. I use SwapBuffers(hDC); Sleep(1000); but it disappeared after the last drawing step and loop again; It makes me crazy!! How can i stop it at last;
Can you describe the problem in more detail? The following information makes it easier for us to help:

- Define your goals. If we know what you are trying to do, we can tell you what steps to take.
- Post code (i.e. where in the code you think the problem is).
- Give context. By that I mean:
---- Which operating system?
---- Are you using console, win32, mfc?

Cheers,
- llvllatrix
Advertisement
Try something like:
(pseudo-code)

loop forever
-#nodes_to_draw++;
-nodes_to_draw = min ( nodes_to_draw, nodes_in_tree )
-for( i = 0 to nodes_to_draw )
--draw a node i of your tree
-swapbufffers

Since openGL only draws what you send it each frame.
You need to send every part of the tree that you want drawn
and to freeze it on the screen, you need to keep sending the
entire tree
I think what hes doing is drawing the Tree upon loading time THUS only once
and to buffer A

then he keeps calling SwapBuffer in the Main Program loop.. and so each
second Update he sees a black buffer!!..

Just a thought as i cant understand what he is saying
----------------------------

http://djoubert.co.uk

This topic is closed to new replies.

Advertisement