Results 1 to 6 of 6

Thread: OpenGL ES using multiple textures on single plane

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2011
    Location
    Florida
    Posts
    5

    OpenGL ES using multiple textures on single plane

    Next up on my list of things to figure out! I'm rendering a square that covers the screen, and is to be used to display the 'ground' for a 2D game, where the 'camera' is looking straight downward. I am able to texture the square, however I have multiple textures that I'd like to tile across this object to form different terrain patterns, I've read somewhere that this can be done using vertex arrays and texture coordinates, but I can't seem to find any documentation that specifically goes over what I'm trying to do.

    I understand how texture coordinates work, and how they can be used to 'select' part of an image to use as a texture, but how can one 'select' part of a square to be textured?
    Platform: iOS
    API: OpenGL ES 1.1
    OpenGL Experience: Total n00b
    <www.patrickcossette.com>

  2. #2
    Junior Member Newbie
    Join Date
    Feb 2011
    Location
    Florida
    Posts
    5

    Re: OpenGL ES using multiple textures on single plane

    ..bump? >.>
    Platform: iOS
    API: OpenGL ES 1.1
    OpenGL Experience: Total n00b
    <www.patrickcossette.com>

  3. #3
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: OpenGL ES using multiple textures on single plane

    Draw a texture for each small quad ?
    Or you want to smoothly blend between textures, for that use an alpha map ?

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2011
    Location
    Florida
    Posts
    5

    Re: OpenGL ES using multiple textures on single plane

    I need to tile textures across the plane to create a "floor". In example, if I needed 30x30 I can create a square with hundreds of vertices, and then assign each face a different texture, but is it really necessary to create that many vertices and that many faces just to tile different textures across a plane?

    Platform: iOS
    API: OpenGL ES 1.1
    OpenGL Experience: Total n00b
    <www.patrickcossette.com>

  5. #5
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: OpenGL ES using multiple textures on single plane

    In fact 1000 vertices is not much, compared to the cost of switching from a texture to another. If several of the quads use the same texture, draw them all at once.
    Sometimes you can use a texture atlas to group all or most of small textures in a single big one, then tweaking texcoords will allow to quickly select which small texture you display. Beware of filtering though.

  6. #6
    V-man
    Guest

    Re: OpenGL ES using multiple textures on single plane

    I have a iPod generation 2 and this thing supports 2 texture units. You could probably search for multitexture and opengl and find a lot of examples since the technology has been available on desktops for 12 years.

    http://www.opengl.org/wiki/Texture_Combiners

Similar Threads

  1. Multiple objects: single or multiple shaders?
    By sam_thedancer in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 04-29-2013, 03:29 AM
  2. multiple textures on a single VBO?
    By coffeeaddict in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-09-2011, 08:44 AM
  3. Replies: 1
    Last Post: 05-09-2011, 08:21 AM
  4. Multiple textures, single texture unit
    By randomnumbers in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-05-2009, 02:22 PM
  5. Displaying multiple VB ActiveX OpenGL Controls in a single form
    By vagb11 in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 10-27-2002, 06:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean