Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-27-2009, 12:41 PM   #1 (permalink)
Gal
Registered Member
 
Join Date: Mar 2009
Posts: 14
Gal is on a distinguished road
Red face Opengl Background Scrolling

I'm working on a game with a scrolling background. The problem is I'm using very very big images as textures in the background, and the iphone doesnt have enough memory to work with those images. I was wondering if it is possible to load textures dynamically in the animation loop, using gltexsubimage2d instead of glteximage2d.

I can run my program with 10 pictures instead of 20, but my levels would be kinda short. But even when I use 10 pics I have problems: the textures should be placed next to each other nicely, but between every texture there is a nasty line of unwelcome pixels... any idea how to fix this?
Gal is offline   Reply With Quote
Old 08-27-2009, 09:13 PM   #2 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 253
zhyla is on a distinguished road
Default

Dynamically loading/unloading the textures sounds like the thing to do. Can you just split your background into tiles and keep track of which ones are visible?
zhyla is offline   Reply With Quote
Old 08-29-2009, 07:14 AM   #3 (permalink)
Gal
Registered Member
 
Join Date: Mar 2009
Posts: 14
Gal is on a distinguished road
Unhappy Big texture not loading

Quote:
Originally Posted by zhyla View Post
Dynamically loading/unloading the textures sounds like the thing to do. Can you just split your background into tiles and keep track of which ones are visible?
I solved my second problem (with the flashing lines between textures): just use GL_CLAMP_TO_EDGE as a parameter for glTexParameterf()

But one problem still remains: Dynamically loading textures would take away a lot of performance, and tiles are worthless for a game without repetition of textures. My background is different everywhere...

What I do not understand: it is said that the iphone has 30mb memory for my textures, but my texture ( which is 1024*10240 big, shame on me ) is only 500 kb big... Why cant it load the texture then?

Maybe I should load tiles instead, but I dont quite know what to do with that idea...

Anyway ty for the reply
Gal is offline   Reply With Quote
Old 08-30-2009, 06:44 AM   #4 (permalink)
Gal
Registered Member
 
Join Date: Mar 2009
Posts: 14
Gal is on a distinguished road
Smile Solved it

I know the solution to my problem now: pvrtc textures are a huge change. I always wanted to avoid that type as they seemed to be very ugly and they took a lot more ROM, but the uglyness wasnt as bad as I thought, and its very helpful for using less RAM. Anyone who has problems with big backgrounds (which are not made of tiles, cfr asterope) should use pvrtc.

And in addition, the time it takes to load 10 1024*1024 textures is very very small.

There is still one problem though: I now have a fuzzy group of pixels between two textures, and I am using GL_CLAMP_TO_EDGE...
Gal is offline   Reply With Quote
Old 09-02-2009, 12:11 PM   #5 (permalink)
Gal
Registered Member
 
Join Date: Mar 2009
Posts: 14
Gal is on a distinguished road
Thumbs up Problem now fully solved

Quote:
Originally Posted by Gal View Post
I know the solution to my problem now: pvrtc textures are a huge change. I always wanted to avoid that type as they seemed to be very ugly and they took a lot more ROM, but the uglyness wasnt as bad as I thought, and its very helpful for using less RAM. Anyone who has problems with big backgrounds (which are not made of tiles, cfr asterope) should use pvrtc.

And in addition, the time it takes to load 10 1024*1024 textures is very very small.

There is still one problem though: I now have a fuzzy group of pixels between two textures, and I am using GL_CLAMP_TO_EDGE...
Quote:
What I do not understand: it is said that the iphone has 30mb memory for my textures, but my texture ( which is 1024*10240 big, shame on me ) is only 500 kb big... Why cant it load the texture then?
The iphone doesnt load the textures as png's, but as bmp's, which are much larger of course.

Veiledgames.com is a great website for learning bout pvrtc textures. Thanks to those guys I was able to solve all my problems.

Quote:
There is still one problem though: I now have a fuzzy group of pixels between two textures, and I am using GL_CLAMP_TO_EDGE...
I read at veiledgames.com that pvrtc textures do have a weird edge. The best solution is to overlap them with png textures (with a width of 32 pixels or less).

If you have problems just ask I may be able to help you as I searched for a solution during hours.

Last edited by Gal; 09-02-2009 at 12:15 PM. Reason: I forgot to solve one of my problems
Gal is offline   Reply With Quote
Old 09-02-2009, 01:44 PM   #6 (permalink)
Indie Dev
 
hm50's Avatar
 
Join Date: May 2009
Location: South Bend, Indiana
Posts: 162
hm50 is on a distinguished road
Default

@Gal,

I am going to be implementing the scrolling background for my app soon, which means doing exactly as you have done. Where did you start? Where should I start? I am only animating the background in this way (I think anyway) the rest of the game, I have animated using UIImageView PNG animations etc. I am completely new to OpenGl and even how to begin using it.

Thanks in advance for any help you can provide!
__________________
iPhone 3G

Support Indie Devs!! (that goes for newbs too!)

Apps:
Spell Blocks
See Read Say
iStatus
myVIP
myMVP
hm50 is offline   Reply With Quote
Old 09-02-2009, 04:11 PM   #7 (permalink)
Gal
Registered Member
 
Join Date: Mar 2009
Posts: 14
Gal is on a distinguished road
Post Some advice

Quote:
Originally Posted by hm50 View Post
@Gal,

I am going to be implementing the scrolling background for my app soon, which means doing exactly as you have done. Where did you start? Where should I start? I am only animating the background in this way (I think anyway) the rest of the game, I have animated using UIImageView PNG animations etc. I am completely new to OpenGl and even how to begin using it.

Thanks in advance for any help you can provide!

All right Im typing on my ipod so I cant post my code, but I can give you some advice now:

- simon maurice made a wonderful blog about opengl es: google ' simon maurice opengl' and you will find it.
- I made my scrolling background by making ten squares in space, each filled with a different texture. Then i move from left to right using gltranslatef (as described by simon maurice). Ill give you my code, but in the meantime you can have a look at the default opengl app in xcode. The important part is the drawview method, where everything is drawn.

For making 2d games youll need my code, but ill post it tomorrow (i dont know what time it is in your country but its 11 pm here).

Anyways what kind of app are you gonna make cuz it would be kinda annoying if you make the same app as mine I would be helping you to be my concurrent :S.

Just dont forget: simon maurice is THE reference for opengl es tutorials. I almost read all his lessons, but you can skip most of them.
Gal is offline   Reply With Quote
Reply

Bookmarks

Tags
background, huge, opengl, scrolling, textures

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 324
13 members and 311 guests
chiataytuday, coolman, givensur, glenn_sayers, guusleijsten, ipodphone, jbro, mediaspree, mottdog, mtl_tech_guy, Punkjumper, vilisei, whitey99
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,114
Posts: 402,883
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:29 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0