如何使用SOIL,GLUT或OpenGL从PNG文件中获取特定部分 [英] How do I use SOIL, GLUT or OpenGL to take specific parts from PNG file

查看:80
本文介绍了如何使用SOIL,GLUT或OpenGL从PNG文件中获取特定部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用OpenGL和GLUT以及库SOIL并尝试编写一个简单的2D游戏,

我成功将图片上传到窗口但我不明白。通常在程序中精灵你得到像http://www.luxinia.de/uploads/Tutorials/explosprite.png这样的图片

这是一张图片中的几帧,所以它节省了内存,更有用而且舒服。我不知道这么做,SOIL中是否有任何内置函数或者在openGL或GLUT中以任何方式执行此操作?你知道,INSTEAD把它保存到16个不同的图片(我做了,直到我得到一个解决方案)

I'm using OpenGL and GLUT together with the library SOIL and trying to program a simple 2D game,
I succeeded uploading pictures onto the window but I didn't understand something. Usually at sprites in programs you got pictures like http://www.luxinia.de/uploads/Tutorials/explosprite.png
It's a couple of frames in ONE picture so it saves memory and is more useful and comfortable. I don't know hot to do that, is there any built-in functions in SOIL or any way to do that in openGL or GLUT ? You know, INSTEAD of saving it to 16 different pics (which I did, untill I get a solution)

推荐答案

你会像往常一样做同样的事情位图的一部分。这就是说我们大多数人都对GLUT感到沮丧并放弃直接进入Win32 OpenGL API,这更容易。如果你达到了这个挫折点,那么这里有一个好的起点



http://bobobobo.wordpress.com/2008/02/11/opengl-in-a-proper-windows-app-no-glut/ [ ^ ]
You would do exactly the same thing as always just draw part of the bitmap. That said most of us just get frustrated with GLUT and give up and go direct onto the Win32 OpenGL API which is much easier. If you reach that frustration point a good start point is here

http://bobobobo.wordpress.com/2008/02/11/opengl-in-a-proper-windows-app-no-glut/[^]


这篇关于如何使用SOIL,GLUT或OpenGL从PNG文件中获取特定部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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