在C ++中使用OpenGL的数字时钟 [英] Digital Clock using OpenGL in C++

查看:189
本文介绍了在C ++中使用OpenGL的数字时钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好。

我需要一个带opengl的数字时钟的源代码。

我到处寻找但找不到了!

请帮助我。

谢谢

解决方案

我建​​议你自己做,而不是使用其他代码。

如果您正在使用带有opengl的窗口以下步骤是创建数字时钟应用程序所必需的。

请使用wglUseFontBitmaps创建文本项目。

准备计时器[使用SetTimer]触发1秒后重绘场景。

在Timer处理程序中,您可以调用Draw()函数重绘场景。



在Draw中()函数你可以做以下事情。

1.将时间和格式检索为字符串[可以使用GetLocalTime()和swprintf来格式化SYSTEMTIME结构中的项目]。

2.清除屏幕。

3.将文本绘制到屏幕上(通过使用glCallLists)

4.调用SwapBuffers以显示绘制的文本到屏幕。



以下是一些现成的代码。



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



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

hello .
I need source code of a digital clock with opengl.
I looked everywhere but could not find !.
Please help me .
thanks

解决方案

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


这篇关于在C ++中使用OpenGL的数字时钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆