使用 gldrawpixels 进行 opengl 旋转
我的团队目前仅限于在 opengl 1.4 平台上绘制图像,这意味着我们无法使用任何漂亮的纹理映射来绘制图像(是的,我们仅限于使用 intel 集成图形平台,这非常烦人)。 到目前为止,我们能够绘制、缩放和翻转图像,但是制作图形的人声称在使用 glDrawPixels 时无法通过 glRotate 进行旋转,我们必须转到纹理等,不适用于 Intel 平台。
我在午餐时跟他打赌,有一个旋转函数,比如 glRotate,适用于直位图。 这样的功能存在吗? glRotate 可以工作吗? 我对这个图形问题有点新手,但除了通过纹理旋转之外,该库不允许位图旋转,这似乎很可笑。
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能将 glRotate 与 glDrawPixels 一起使用。
glDrawPixels 是迄今为止将像素显示到屏幕上最差且性能最低的方法。 通过使用糟糕的书面软件光栅器将像素放置到屏幕上,您甚至可以获得更好的性能。
简而言之,glDRawPixels 会将像素数据从进程内存复制到图形内存,并执行一些非常简单的转换,例如翻转和缩放。 任何更高级的东西(比如旋转)都需要您实际使用图形芯片组的功能。 例如,您必须使用纹理。
纹理确实有效。 它们还可以与 GL 1.4 和 Intel 图形芯片组配合良好。 我自己已经在这样的芯片组上工作了一段时间。 您无法获得现代 ATI 或 NVIDIA 芯片组的性能,但它们也没有那么差。
我最好的选择是,有人试图创建非二次方尺寸的纹理,但失败了,并认为纹理通常不适用于芯片组。
这不是真的。 他们确实工作。 您只需要知道 OpenGL 要求您创建二维的纹理,并且您必须使用较大纹理的子矩形或将多个图像放入一个非常大的纹理中(后者称为纹理图集)。
您可以通过调整纹理坐标来补偿较大纹理中的较小图像。
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.