OpenGL 中的图像加载用于 GIS 应用程序
我目前正在开发一个内部 GIS 应用程序。背景图像通过将图像分解为我认为所谓的纹素和 mipmap 来加载到 OpenGL 中,之后构建显示列表以将每个纹素纹理映射到矩形上。这听起来很标准,但问题是,目前对于没有整齐地划分为 2^n 像素 x 2^m 像素纹素的图像,剩余部分将被丢弃。即使我要捕获剩余部分并以某种方式处理它们,我也无法想象答案是不断测试纹素细分,最终导致在整齐的边界上完全捕获图像?或者是吗?
在某些情况下,我加载的图像是 geotiff,我需要将每个像素都包含在我的背景中。我听说 glDrawPixels 很慢。我知道我可以自己测试一下,但我有一种感觉,这个领域的人正在使用 opengl 中的纹理,而不是跟踪像素转储。
我是 OpenGL 新手,我相信该应用程序将自身限制为 1.1 调用。
I am currently working on an in house GIS app. Background images are loaded in OpenGL by breaking the image down into what I guess are termed texels and mipmapped, after which a display list is built to texture map each texel onto rectangles. This sounds pretty standard, but the issue is that currently for images that do not divide neatly into 2^n pixel x 2^m pixel texels, the remainders are thrown away. Even if I were to capture the remainders and handle them in some way, I can't imagine that the answer is to continually test for texel subdivisions that eventually result in total capture of the image on neat boundaries? Or is it?
In some cases the images that I'm loading are geotiffs, and I need every single pixel to be included on my background. I've heard that glDrawPixels is slow. I know I could test this for myself, but I have a feeling that people in this space are using textures in opengl, not keeping track of pixel dumps.
I'm new to OpenGL, and I believe that the app is limiting itself to 1.1 calls.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 OpenGL 1.1 中处理两个图像的非幂的标准方法是将图像存储在尺寸为最接近的较大二次幂的纹理中,然后修改纹理坐标,一些伪代码:
使用更高版本的 OpenGL 或者如果您'使用扩展时,您可以使用矩形纹理:
http://www.opengl.org /registry/specs/ARB/texture_rectangle.txt
The standard way of handling non power of two images in OpenGL 1.1 is to store the image in a texture with dimension of the nearest larger power of two and then modifying the texture coordinates, some pseudocode:
With a higher version of OpenGL or if you're using extension you can use rectangular textures:
http://www.opengl.org/registry/specs/ARB/texture_rectangle.txt