OpenGL ES Scrolling Background
Hi,
I'm trying to make a scrolling background using the Texture2D class. I assuming the best way to do this is to create an image that is like 4800 pixels and then just use coordinates to just load part of the picture and keep shifting the coordinates every x time period to shift the image. Is there a better way?
The Texture2D class seems to be limiting the file to 1024 pixels (kMaxTextureSize), can you change that? When I load my file of 4800 it ends up really blurry.
Thanks
I'm trying to make a scrolling background using the Texture2D class. I assuming the best way to do this is to create an image that is like 4800 pixels and then just use coordinates to just load part of the picture and keep shifting the coordinates every x time period to shift the image. Is there a better way?
The Texture2D class seems to be limiting the file to 1024 pixels (kMaxTextureSize), can you change that? When I load my file of 4800 it ends up really blurry.
Thanks
The best way to do this depends on what you want to do.
Is your background one giant unique image, or built out of tiles?
Will the background only scroll in integral pixel amounts, or do you want to support rotating/zooming/subpixel scrolling?
Whatever you want to do, you need to work within the hardware limits.
Is your background one giant unique image, or built out of tiles?
Will the background only scroll in integral pixel amounts, or do you want to support rotating/zooming/subpixel scrolling?
Whatever you want to do, you need to work within the hardware limits.
The background is currently one big image, do I need to chop it up?
Thanks
Thanks
Assuming "glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);" is accurate, the max texture size on the iPhone is 1024x1024. If you want larger than that you'll need multiple textures, or a tiling/repeating texture.
Thanks for the reply, so I've cut it up into multiple textures, but now I'm having a tough time getting them lined up. Can someone help me understand the following two methods:
glTexCoordPointer;
glDrawArrays;
I'm trying to find some picture that will help me understand what the coordinates should be. I'm using GL_TRIANGLE_STRIP
Thanks
glTexCoordPointer;
glDrawArrays;
I'm trying to find some picture that will help me understand what the coordinates should be. I'm using GL_TRIANGLE_STRIP
Thanks
Bachus Wrote:... the max texture size on the iPhone is 1024x1024.
Yes, it actually says that in the iPhone programming guide.
@abdm436: glTexCoordPointer is used to tell OpenGL where to find the array of texture coordinates for the object you are about to draw. You will also need at least glVertexPointer specified as well which does the same thing for your array of vertex coordinates. Plus you'll need to make sure you've glEnableClientState(GL_VERTEX_ARRAY); and glEnableClientState(GL_TEXTURE_COORD_ARRAY); once before drawing. Plus you need to glBindTexture to specify which texture to use, and glEnable(GL_TEXTURE_2D) to turn on texturing. Then you can do your transforms and call glDrawArrays, which takes the vertex and texCoord arrays you specified with glVertexPointer and glTexCoordPointer, and draws an object with them.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Scrolling content but not background | omriykl | 1 | 4,621 |
Jun 14, 2009 01:45 PM Last Post: uripo |
|
| OpenGL ES: Doing a background distortion | soulstorm | 2 | 3,006 |
May 14, 2009 04:00 PM Last Post: soulstorm |
|
| OpenGL - how to draw background image? | SDyer777 | 1 | 5,810 |
Mar 9, 2009 11:17 AM Last Post: AnotherJake |
|

