Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / AGK tier 1 - 1076 - Getimage()/SetScissor() - Errors

Author
Message
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 17th Jul 2012 13:03
Compiled my first own player for 1076 and still got alot of weird errors.

I use alot of set scissor and get image in my app.

Spent the early morning by trying to find the problem with writing alot of various functions.

Then i found this pretty simple fix?

This is at the top of my app and it now always works right


There is simply something in the sync command that corrects something?

Android 2.3 Gingerbread , ZTE Skate , 480x800 , 4.3 inches , 800 mhz cpu , 512 mb ram
Android 4.0 Sandwich , Dmtech 3g 9738B , 1024x768 , 9.7 inches , cortex A8 1.2 cpu , 1 gb ram.
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 17th Jul 2012 16:37
Possibly applying the SetVirtualResolution() command.

I've noticed image size "oddities" with getImage() if you don't set the resolution first.
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 17th Jul 2012 19:56
I have found that after setting the SetOrientationAllowed command on android, you need to run sync() twice, to make sure it gets right. If not, then the first graphics will be in the wrong orientation, if the user started the app with the device in the wrong orientation, until 2 sync() are done in the main loop.

I guess TGC should add sync() to that command as a default?

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 17th Jul 2012 20:08
Quote: "Possibly applying the SetVirtualResolution() command.

I've noticed image size "oddities" with getImage() if you don't set the resolution first. "

No! its the sync command

If i dont do it so is the get image and set scissor screwed up ?
Quote: "I have found that after setting the SetOrientationAllowed command on android, you need to run sync() twice, to make sure it gets right. If not, then the first graphics will be in the wrong orientation, if the user started the app with the device in the wrong orientation, until 2 sync() are done in the main loop.

I guess TGC should add sync() to that command as a default?"

I only got black texture on my track before this.
And now it works all the time.

Android 2.3 Gingerbread , ZTE Skate , 480x800 , 4.3 inches , 800 mhz cpu , 512 mb ram
Android 4.0 Sandwich , Dmtech 3g 9738B , 1024x768 , 9.7 inches , cortex A8 1.2 cpu , 1 gb ram.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 17th Jul 2012 22:08
well its no big deal doing a couple of syncs at the start as long as it fixes everything

is this in t1 or t2?
3d point in space
15
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 17th Jul 2012 22:28
actually i found that you can sync anywhere in your program. You can also make some weird effects sync at the different locations.

Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 18th Jul 2012 00:09
Basically, you need to run sync() anytime you want to update the screen, after making changes to the position or information of objects. But beware that making more than one sync() between main loop runs, you will make overhead (slowdown of FPS). I guess you also tell the physics to update itself more than once every loop, making errors there.

Most AppGameKit programs I have seen are running around 45% CPU on a galaxy II, even if it's just a simple "Hello world!" loop. I guess the sync() command does ALLOT every time it's called. In simple games with little movements, I guess you only need to run sync() when something has moved, to save CPU/battery.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 18th Jul 2012 02:28
Quote: "is this in t1 or t2?"

Tier 1 but tier 2 have the same core?
Fixed my problems at least

Android 2.3 Gingerbread , ZTE Skate , 480x800 , 4.3 inches , 800 mhz cpu , 512 mb ram
Android 4.0 Sandwich , Dmtech 3g 9738B , 1024x768 , 9.7 inches , cortex A8 1.2 cpu , 1 gb ram.
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 18th Jul 2012 02:30
Quote: "Quote: "Possibly applying the SetVirtualResolution() command..."

Quote: "No! its the sync command"


Yeah, I wasn't clear - I meant that the sync() command is applying the resolution changes from SetVirtualResolution().

Quote: "Basically, you need to run sync() anytime you want to update the screen"

..is a better way of putting it
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 18th Jul 2012 09:26
Quite a lot of OpenGL calls are queued internally for efficiency, so it may be that a Sync() command is need to flush the queue.

-- Jim
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 18th Jul 2012 12:59
Maybe tgc should make somethings clear with commads that forces an device to use other orientations and resolutions.
That you nead to use sync right after.

But i also found this command.

UpdateDeviceSize( w, h )

Description

If for any reason the device dimensions may have changed (e.g. a change in orientation rotates the viewspace to a new size) call this function to update the internal values.

But i havent tested it as iam on vacation and not home so much.

Android 2.3 Gingerbread , ZTE Skate , 480x800 , 4.3 inches , 800 mhz cpu , 512 mb ram
Android 4.0 Sandwich , Dmtech 3g 9738B , 1024x768 , 9.7 inches , cortex A8 1.2 cpu , 1 gb ram.

Login to post a reply

Server time is: 2024-11-23 18:17:59
Your offset time is: 2024-11-23 18:17:59