使用gldrawpixels的OpenGL旋转 [英] opengl rotation using gldrawpixels

查看:316
本文介绍了使用gldrawpixels的OpenGL旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的团队目前仅限于在opengl 1.4平台上绘制图像,这意味着我们不能使用任何漂亮的纹理映射来绘制图像(是的,我们仅限于使用Intel集成图形平台,这非常恼人的).到目前为止,我们已经能够绘制,缩放和翻转图像,但是进行图形处理的人声称使用glDrawPixels不能通过glRotate进行旋转,我们必须去纹理等等,在Intel平台上不起作用.

我打赌他午餐了,那里有一个旋转功能,例如glRotate,它将对直线位图起作用.是否存在这样的功能? glRotate可以工作吗?我对这个图形问题有点新手,但似乎很荒谬的是,该库不允许通过纹理旋转来进行位图旋转.

谢谢.

解决方案

您不能将glRotate与glDrawPixels一起使用.

glDrawPixels是迄今为止将像素显示在屏幕上的最差,性能最差的方法.使用较差的书面软件光栅化程序,将像素放到屏幕上,您甚至会获得更好的性能.

简而言之,glDRawPixels会将像素数据从过程内存复制到图形内存,并将进行一些非常琐碎的转换,例如翻转和缩放.一切更高级的功能(例如旋转)都需要您实际使用图形芯片组的功能.例如.您必须使用纹理.

纹理可以正常工作.它们还可以与GL 1.4和Intel图形芯片组配合使用.我自己已经在这种芯片组上工作了一段时间.您将无法获得现代ATI或NVIDIA芯片组的性能,但是它们也不是很糟糕.

我最好的选择是有人试图创建非2幂次幂的纹理,但没有这样做,并决定通常该纹理在芯片组上不起作用.

那是不对的.他们工作.您只需要知道OpenGL要求您以二维的力量创建纹理,并且必须使用较大纹理的子矩形或将多个图像放入一个非常大的纹理中(后者称为纹理图集). /p>

您可以通过调整纹理坐标来补偿较大纹理中的较小图像.

My team is currently limited to drawing images on an opengl 1.4 platform, which means that we can't use any nifty texture mapping to draw an image (yes, we're confined to using the intel integrated graphics platform, it's very annoying). So far, we're able to draw, scale, and flip an image, but the guy doing the graphics claims that rotation via glRotate can't be done while using glDrawPixels, that we'd have to go to textures and so forth, which don't work on the Intel platform.

I've bet him lunch that there is a rotation function, like glRotate, that will work for straight bitmaps. Does such a function exist? Would glRotate work? I'm a bit of a novice to this graphics thing, but it seems ludicrous that the library wouldn't allow for bitmap rotation except via texture rotation.

Thanks.

解决方案

You can't use glRotate with glDrawPixels.

glDrawPixels is the worst and least performant way to get pixels onto the screen by far. You will even get better performance by putting the pixels onto the screen using a bad written software-rasterizer.

In short glDRawPixels will copy pixel data from the process-memory to the graphics memory and will do some very trivial transformations like flipping and scaling. Everything more advanced (like rotating) requires you to actually use the features of the graphic-chipset. E.g. You have to use textures.

And textures do work. They also work well with GL 1.4 and the Intel graphic chipsets. I've worked on such a chipset myself for quite a while. You won't get the performance of modern ATI or NVIDIA chipsets, but they aren't that bad either.

My best bet is that someone tried to create textures of a non power of two size, failed to do so and decided that textures in general don't work on the chipset.

That's not true. They do work. You just have to know that OpenGL requires you to create textures at power of two dimensions and that you have to either use a subrectangle of the larger texture or put multiple images into one very large texture (the later is called a texture atlas).

You can compensate for the smaller image within a larger texture by adjusting the texture-coordinates.

这篇关于使用gldrawpixels的OpenGL旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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