适用于iPhone的OpenGL ES 1.1的OpenGL颜色索引? [英] OpenGL Color Index for iPhone's OpenGL ES 1.1?

查看:387
本文介绍了适用于iPhone的OpenGL ES 1.1的OpenGL颜色索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在openGL ES 1.1中使用颜色调色板?

Is it possible to use color pallettes in openGL ES 1.1?

我目前正在开发一款具有播放器精灵的游戏,玩家精灵需要能够改变成不同的队的颜色。例如,改变衬衫的颜色而不是面部颜色,这排除了简单的色调旋转。

I'm currently developing a game which has player sprites, and the player sprites need to be able to be changed to different teams' colors. For example, changing the shirts' colors but not the face colors, which rules out simple hue rotation.

这是可能的,还是必须手动实现纹理数据直接)?

Is this possible, or will this have to be implemented manually (modifying the texture data directly)?

推荐答案

这不是MBX的硬件功能,而是快速检查gl.h的ES 1 .x从iPhone SDK发现 GL_PALETTE4_RGB8_OES GL_PALETTE8_RGBA8_OES 和一堆其他可用作常量之一根据手册页 glCompressedTexImage2D =nofollow>此处。所以你可以传递纹理与调色板,但我敢打赌的任何驱动程序将它们转换为RGB纹理在CPU上,然后上传到GPU。我不相信苹果支持这些类型的压缩纹理除了它们是ES 1.x规范之外的任何原因。

It's not a hardware feature of the MBX but a quick check of gl.h for ES 1.x from the iPhone SDK reveals that GL_PALETTE4_RGB8_OES, GL_PALETTE8_RGBA8_OES and a bunch of others are available as one of the constants to pass to glCompressedTexImage2D, as per the man page here. So you can pass textures with palettes to that, but I'll bet anything that the driver will just turn them into RGB textures on the CPU and then upload them to the GPU. I don't believe Apple support those types of compressed texture for any reason other than that they're part of the ES 1.x spec.

在ES 2.x你可以随意做任何你想要的。您可以轻松地将调色板上传为一个纹理(例如,(x,0)的像素是调色板索引x的颜色)和调色纹理作为另一个。然后,你将使用两个纹理单元做一个可能在绘制片段时可能做的工作,所以使用你自己的判断是否你能负担得起。

On ES 2.x you're free to do whatever you want. You could easily upload the palette as one texture (with, say, the pixel at (x, 0) being the colour for palette index x) and the paletted texture as another. You'll then utilise two texture units to do the job that one probably could do when plotting fragments, so use your own judgment as to whether you can afford that.

这篇关于适用于iPhone的OpenGL ES 1.1的OpenGL颜色索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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