Thanks Robert, So in short you are stating that I use a texture atlas
approach. The second approach is what I used right now, for every face
of the cube construct that side and binding it to the texture which
was really inefficient.
  Well, you have said something about the distortion. I read at nehe's
site that you can use mimaps to upload image of any size which will be
scaled to the best aspect ratio and will minimize the distortion.
Could I use that technique to create the texture atlas? Also, could
you give me some pointers or articles which discuss the creation of a
texture atlas since I'm fairly new at this.

On Jun 26, 12:01 am, Robert Green <rbgrn....@gmail.com> wrote:
> No, that's not what cube maps are for.
>
> You can only draw 1 texture at a time (unless multitexturing but
> that's totally different and not what you want) so you have 2 options:
>
> 1)  Combine all textures together into a single one and map the
> coordinates to each side accordingly (will run much faster)
> 2)  Draw side-at-a-time binding to the appropriate texture for each
> side. (not usually the preferred method.)
>
> A trick many of us use when doing something like... say you want to
> have the user pick 6 photos from their SD card and then you want to
> display those on a cube, one on each face.  At some point you must
> load each photo up, clipping and scaling it to fit aspect ratio and a
> power-of-two texture and then uploading it to vram.  Well, instead of
> uploading each one as a separate texture, why not just create a
> 1024x1024 bitmap and draw all 6 photos to it in different spots.  You
> could use 50% of the texture vertically and 33% horizontally (for
> example) to pack 6 photos onto it for 100% usage.  It's ok if they
> distort going on to it so long as you draw them aspect-correct.  You
> then keep track of which one is where (using UVs, so percentages from
> 0 to 1).  Upload that texture atlas as a single texture and when you
> draw your cube, you just bind to that atlas once and draw everything
> in one shot.  It'll run fast and it's not really that hard to do.
>
> On Jun 25, 6:26 pm, chaitanya <vengeance...@gmail.com> wrote:
>
> > Hi,
> >       I have just began opengl programming in android and i am fairly
> > new to opengl as well. I've been using nehe's opengl tutorials as well
> > as insanitydesign's android ports. I successfully managed to create a
> > cube with a single texture mapped to all its 6 faces. I even mapped
> > multiple textures to different faces of the cube.
> >         But the way I did it was to create 6 faces seperately, have 6
> > seperate index and texture buffers and then using glBindTexture() with
> > the selected texture for each face and then calling glDrawElements.
> > Isn't there an efficient way around this. Should i use a cube map
> > texture instead of a GL_TEXTURE_2D?
>
> >   Any suggestions would be appreciated?
> > Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to