使用OpenGL以1度精度旋转图像 [英] Image Rotation with 1 degree precision using OpenGL

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

问题描述

我想通过使用OpenGL以1度精度旋转BMP图像,我想导出旋转图像并保存为BMP文件。



任何人都可以请告诉我是否可以在OpenGL中使用标准函数?

谢谢

i want to rotate an BMP image with 1 degree precision by using OpenGL and i want to Export the Rotated image & save is as BMP file.

Could anyone please tell me is it possible by using standard functions in OpenGL?
Thanks

推荐答案

大部分都可以在OpenGL中完成。 />


加载和保存图像不是OpenGL的功能。



要做到这一点,你需要加载将位图存入内存。

在内存中创建目标位图。

设置Open GL渲染到目标位图。

将原始位图应用为纹理到方形网格。

旋转网格。

渲染网格。

保存目标位图。



此链接描述了如何渲染纹理。

http://www.opengl-tutorial.org/intermediate-tu torials / tutorial-14-render-to-texture / [ ^ ]



请注意,某些OpenGL函数使用GL_RGB参数。

对于24位窗口位图,您可以使用GL_BGR,因为窗口的红绿色和蓝色反转。

对于32位窗口位图,请使用GL_BGRA



这些设置允许您直接使用位图缓冲区,而无需修改颜色顺序的代码。
Most of it can be done in OpenGL.

Loading and saving images isn't an OpenGL function though.

To do this you need to load the bitmap into memory.
Create a destination bitmap in memory.
Set Open GL to render to your destination bitmap.
Apply the original bitmap as a texture to a square mesh.
Rotate the mesh.
Render the mesh.
Save the destination bitmap.

This link describes how to render to a texture.
http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/[^]

Note that some OpenGL functions use the GL_RGB parameter.
For 24 bit windows bitmaps, you can use GL_BGR instead, as windows has the Red Green and Blue reversed.
For 32 bit windows bitmaps, use GL_BGRA

These settings allow you to use the bitmap buffers directly, without the need for code that corrects the color order.


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

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