Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
1.19/5 (6 votes)
See more:
hello .
I need source code of a digital clock with opengl.
I looked everywhere but could not find !.
Please help me .
thanks
Posted
Updated 4-Jun-13 3:26am
v2
Comments
Mohibur Rashid 4-Jun-13 9:07am    
what is your question?
Richard MacCutchan 4-Jun-13 9:52am    
Looked everywhere? Then how did you miss https://www.google.com/search?q=digital+clock+with+opengl?
Saeid.Babaei86 4-Jun-13 9:53am    
yes!
joshrduncan2012 4-Jun-13 10:25am    
Help you with what? You haven't shown us any effort on your part in attempting this problem yet.

1 solution

I suggest to do it yourself instead of using others code.
If you are using windows with opengl following steps are necessary to create a digital clock application.
Please use wglUseFontBitmaps to create the text items.
Prepare a timer[using SetTimer] which triggers in 1 second to redraw the scene.
In Timer handler you can call Draw() function to redraw the scene.

In Draw() function you can do the following things.
1. Retrieve the time and format as string[You can use GetLocalTime(), and swprintf to format the items from SYSTEMTIME structure].
2. Clear the screen.
3. Draw text to screen( By using glCallLists)
4. Call SwapBuffers to display the drawn text to screen.

Here are some ready made code.

http://www.openglprojects.in/2012/04/mini-project-on-clock-using-opengl.html

http://blog.wizche.ch/2009/04/opengl-programming-analogic-digital.html
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900