在openGL中读取和打印文件 [英] File reading and printing in openGL

查看:176
本文介绍了在openGL中读取和打印文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在用Visual C ++制作GUI,并使用OpenGL进行绘图.我想从文本文件中读取一个单词并将其打印在openGL屏幕上.我需要从文件中读取要打印的单词以及它的x和y坐标也从文件中读取.有人可以建议怎么做吗?

Tim

Hi,

I am making a GUI in visual c++ and using OpenGL for drawing. I want to read a word from text file and print it on openGL screen.I need to read the word to be printed from file, as well as its x & y co-ordinates also from file. Can anyone suggest how to go about?

Tim

推荐答案

这并不难.首先,您需要阅读有关文件IO的信息.这是一篇很好的介绍性文章 http://www.cplusplus.com/doc/tutorial/files/ [ ^ ]

一旦学习了如何做,就需要提出数据存储格式.可能这可能会有所帮助.我会在每一行中写下x坐标,y坐标和文本

That is not hard to do. First you need to read about file IO. Here is a good introductory article http://www.cplusplus.com/doc/tutorial/files/[^]

Once you are learn how to do, you need to come up with your data storage format. May be this may help. I would write in each line, the x-coordinate, the y-coordinate and the text

10,10,Hello World<br />
10,20,Here I come<br />
10,30,What a Beauty....


这篇关于在openGL中读取和打印文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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