Results 1 to 3 of 3

Thread: Large Non-Square textures

  1. #1

    Large Non-Square textures

    I'm using OpenGL to draw a city map in a 2D game. The player can zoom out, to see most of the city, or zoom way in, to see individual people walking around the city.

    The city map is stored on disk simply as a single large texture, with possibly non-power-of-two dimensions. My strategy was to break up the image into NxN squares and render each square as a quad.

    This looks fine for nearest-neighbor magnification, but when i switch to linear magnification, I get ugly artifacts at the edges of the tiles.

    I assume this is because the linear filter is doing a weighted average of the nearest four texels, and since I've split the image into tiles there is a discontinuity between the texels available on one side of a tile boundary and those on the other.

    I think I could solve the problem by adding a 1 pixel border around the tile texture, but this seems very wasteful.

    My question is, what's a good way to manage the display of very large images like this?
    The map images themselves are sizes around 1200x1200.

    Thanks,
    -Jim

  2. #2
    Senior Member Regular Contributor
    Join Date
    Apr 2001
    Location
    Fort Collins, Colorado
    Posts
    446

    Re: Large Non-Square textures

    Hmmm, I'm not sure how filtering would affect this, but perhaps if you set your texture wrap mode to GL_CLAMP_TO_EDGE_EXT it would work better?

    Just an idea, if I'm wrong I'm sure someone else will have a better suggestion.

  3. #3

    Re: Large Non-Square textures

    Thanks a lot!

    I tried GL_CLAMP and GL_CLAMP_TO_EDGE (my headers don't have a GL_CLAMP_TO_EDGE_EXT). Both give the same output, but both look much better than the default GL_REPEAT.

    It looks like this solved half of the problem. I still have a smaller but still visually intrusive discontinuity there.

    I'm going to solve this using the solution I outlined earlier unless anyone has interesting suggestions on dealing with displaying large images like this.

    On a related note, are there any guidelines for optimizing the number of textures and their sizes for best use of texture memory? Or is this something that the driver will handle and rearrange on it's own?

Similar Threads

  1. Replies: 1
    Last Post: 09-17-2014, 07:44 PM
  2. large textures
    By cragwolf in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 01-23-2007, 01:52 AM
  3. Square Textures
    By Falkenbach in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 09-11-2004, 06:53 AM
  4. Lots of small textures or fewer large textures?
    By jlamanna in forum OpenGL: Advanced Coding
    Replies: 30
    Last Post: 01-12-2004, 03:53 AM
  5. large textures
    By dans in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 05-06-2000, 03:44 AM

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