如何将五个 OpenGL 纹理合并为一个?
我想在 OpenGL ES 1.x iPhone 中将 5 个“子图层”合并为一个纹理(您知道,类似于 Photoshop 中的“拼合图像”)。我是 OpenGL 新手,还没有找到答案。
I want to merge 5 "sublayers" to one single texture (you know, somethin' like Flatten Image in Photoshop) in OpenGL ES 1.x iPhone. I'm new to OpenGL, and just haven't find the answer yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设它们一开始就是图像,你不能将它们按顺序绘制到内存图像上
code< /a>
assuming they are images to begin with can't you just draw them sequentially onto an in memory image
code
您不需要 GL 将纹理组合在一起。只需在 C 中对每个纹理像素进行数学计算即可。
现在,如果您想使用 GL,您将需要渲染到纹理(您的最终结果)。
这是通过 OES_framebuffer_object 完成的。现在如何绘制该纹理完全取决于您。您可以绘制 5 个四边形,每个四边形都有一个纹理,然后使用混合来合并它们(您必须指定要应用的数学),您可以使用多重纹理以更少的通道完成工作(并使用纹理环境指定如何合并)。
您想要什么样的扁平化操作?
You don't need GL to combine textures together. Just do the math on each texel in C.
Now, if you want to use GL, you'll want to render to a texture (your final result).
This is done with OES_framebuffer_object. Now how you draw to that texture is completely up to you. You could draw 5 quads, each with a single texture, and use blending to merge them (you'll have to specify which math you want to apply though), you can use multi-texturing to do the work in less passes (and use Texture Environments to specify how to merge).
What kind of flattening operation do you want ?