OpenGL ES 帮助——提高 PanoramaGL 的球面分辨率?
那天晚上我开始尝试 PanoramaGL。在对下载的项目进行了一番修改之后(有一些小问题导致它无法立即编译),我让它开始工作——我加载了一张 1200 x 512(左右)的全景图像,并且球形视图工作得很好。有两个问题:我加载了太大的纹理,这使得该功能只能在 iPhone4 上运行(至少,我认为这就是它在我的 iPad 上无法运行的原因),而且全景图非常模糊。
我开始对 iPhone 上的 3D 进行一些研究,并且我并不(太)尴尬地承认大多数概念都超出了我的理解范围。我没有任何使用 3D 的经验,我希望能从 StackOverflow 的好人那里得到一些帮助。
这就是我想要做的:我想将我的全景图像分解为图块(我正在考虑垂直条,但我愿意以其他方式做到这一点)。我想将这些图块作为纹理加载到 PLSphere 视图上,并告诉它某个图块对应于某些角度。
查看 PanoramaGL
的源代码,看起来有一个放置此代码的好地方。在 PLSphere
类中,有这样的代码块
- (void)internalRender
{
gluQuadricNormals(quadratic, GLU_SMOOTH);
gluQuadricTexture(quadratic, true);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, ((PLTexture *)[textures objectAtIndex:0]).textureId);
gluSphere(quadratic, kRatio, divs, divs);
glDisable(GL_TEXTURE_2D);
}
:在 PLCube
中,我在其 internalRender
方法中看到以下代码:
// Front Face
glBindTexture(GL_TEXTURE_2D, ((PLTexture *)[textures objectAtIndex:kCubeFrontFaceIndex]).textureId);
glNormal3f(0.0f, 0.0f, 1.0f);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
基于此,我认为我可以指定一个方向(使用类似 glNormal3f
code>) 并将图块绑定为纹理。
我走在正确的轨道上吗?我希望有人能为我提供指导,使其发挥作用。
谢谢!
I started playing around with PanoramaGL the other night. After finagling with the downloaded project (there were some minor issues that prevented it from compiling right out the gate), I got it to work -- I loaded up a 1200 by 512(ish) panorama image and got the spherical view working pretty well. Two problems: I'm loading too large of a texture, which makes this work only on an iPhone4 (at least, I think that's why it didn't work on my iPad), and the panorama turned out to be pretty blurry.
I started doing a bit of studying on doing 3D on the iPhone and I'm not (too) embarrassed to admit that most of the concepts are over my head. I don't have any experience working with 3D and I'm hoping to get some help from the good folks here at StackOverflow.
Here's what I want to do: I want to break up my panorama image into tiles (I was thinking vertical strips but I'm open to doing it in other ways). I want to load these tiles as textures on the PLSphere
view and tell it that a certain tile corresponds to certain angles.
Looking at the source of PanoramaGL
, it looks like there'd be a good place to put this code in. In the PLSphere
class, there's this block of code:
- (void)internalRender
{
gluQuadricNormals(quadratic, GLU_SMOOTH);
gluQuadricTexture(quadratic, true);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, ((PLTexture *)[textures objectAtIndex:0]).textureId);
gluSphere(quadratic, kRatio, divs, divs);
glDisable(GL_TEXTURE_2D);
}
And looking at PLCube
, I see the following code in its internalRender
method:
// Front Face
glBindTexture(GL_TEXTURE_2D, ((PLTexture *)[textures objectAtIndex:kCubeFrontFaceIndex]).textureId);
glNormal3f(0.0f, 0.0f, 1.0f);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
Based on this, I would think that I could specify a direction (using something like glNormal3f
) and bind a tile as a texture.
Am I on the right track here? I'm hopeful someone can provide me with guidance to get this to work.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 Hugin/pano 将球形纹理更改为 6 个立方体纹理
请参阅
http://vinayhacks.blogspot.com/2010/11/ conversion-equirectangle-panorama-to.html
纹理大小不是必须是 2 的幂吗?
You can change speherical to 6 cube textures using hugin/pano
see
http://vinayhacks.blogspot.com/2010/11/converting-equirectangular-panorama-to.html
dont texture sizes have to be powers of 2?