donkim
donkim

Reputation: 13137

Help with OpenGL ES -- Improving PanoramaGL's spherical resolution?

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!

Upvotes: 2

Views: 1868

Answers (1)

brian.clear
brian.clear

Reputation: 5327

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?

Upvotes: 2

Related Questions