Author Topic: blitting text and images  (Read 21264 times)

Offline raft

  • quad
  • ******
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: blitting text and images
« Reply #15 on: March 31, 2010, 12:29:59 pm »
maybe. the outer part is not fixed in size, it's scaled according to inner text part.

btw, seems as texure's arent needed to be added to TextureManager for blitting. they are uploaded at first use i suppose ? how can i dispose them ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11771
    • View Profile
    • http://www.jpct.net
Re: blitting text and images
« Reply #16 on: March 31, 2010, 12:42:00 pm »
In desktop jPCT, you can do this via the TextureManager. In AE, you can't. I guess, i somehow missed that part in the porting...i'll add it.

Offline raft

  • quad
  • ******
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: blitting text and images
« Reply #17 on: March 31, 2010, 12:48:33 pm »
great :) i wasn't even aware of TextureManager.unload.. method. you must have added it while i wasnt on the scene i guess..

i would expect uploading a new texture and modifying it with a texture effect perform almost the same, right ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11771
    • View Profile
    • http://www.jpct.net
Re: blitting text and images
« Reply #18 on: March 31, 2010, 12:58:02 pm »
Not quite. Modifying will always be cheaper, because it removes some gl overhead that the creation of a new texture will cause. It might not be that much though.

Offline raft

  • quad
  • ******
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: blitting text and images
« Reply #19 on: March 31, 2010, 01:26:55 pm »
Quote from: raft
instead of character blitting, i can render each bubble's text to a texture and blit it. this is what i do in desktop karga except it's java2d not blitting. this will dramatically reduce number of blits in cost of texture creation

yeap, this doubled the performance on emulator ;D
http://www.aptalkarga.com/tmp/B1.apk

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11771
    • View Profile
    • http://www.jpct.net
Re: blitting text and images
« Reply #20 on: March 31, 2010, 02:05:54 pm »
Up to 26 fps now on the phone. I'll try to improve blitting speed somewhat anyway.

Offline dl.zerocool

  • long
  • ***
  • Posts: 104
    • View Profile
Re: blitting text and images
« Reply #21 on: March 31, 2010, 03:33:53 pm »
Nice to see you guys working on better solutions, as always, you can ask for tests (Since that's the only help I can provide atm.)
I'm working on the project so feel free to ask.


Offline raft

  • quad
  • ******
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: blitting text and images
« Reply #22 on: March 31, 2010, 04:25:13 pm »
@dl.zerocool
feel free to try the app above and paste the results ;D

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: blitting text and images
« Reply #23 on: March 31, 2010, 05:05:52 pm »
i would expect uploading a new texture and modifying it with a texture effect perform almost the same, right ?

Not quite. Modifying will always be cheaper, because it removes some gl overhead that the creation of a new texture will cause. It might not be that much though.

When I was working on my "video texture" project, I found that the overhead of adding new textures was significantly more than modifying existing textures (to the point that the first option was not really an option if you want smooth video playback).

-- I haven't tested if this is still true for JPCT-AE though.
« Last Edit: March 31, 2010, 05:08:07 pm by paulscode »

Offline raft

  • quad
  • ******
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: blitting text and images
« Reply #24 on: March 31, 2010, 05:12:10 pm »
Quote from: paulscode
When I was working on my "video texture" project, I found that the overhead of adding new textures was significantly more than modifying existing textures (to the point that the first option was not really an option if you want smooth video playback).

but i suppose you were doing this every frame ? in my case this is done once per bubble. indeed every time font size changes for each bubble but on Android font size wont change

Offline dl.zerocool

  • long
  • ***
  • Posts: 104
    • View Profile
Re: blitting text and images
« Reply #25 on: March 31, 2010, 06:03:23 pm »
@dl.zerocool
feel free to try the app above and paste the results ;D

First since I don't know what your application is doing, I only see few bubbles with text.

Next, when loading it start at 40fps and then go to 60fps and stay at 60fps.
Some time after the bubbles start disappearing gently to let the black screen alone, always at 60fps of course.

And stop animation from menu does nothing.


Offline raft

  • quad
  • ******
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: blitting text and images
« Reply #26 on: March 31, 2010, 06:16:34 pm »
Quote from: dl.zerocool
First since I don't know what your application is doing, I only see few bubbles with text.

ehm ;D it's an image and text blitting test application, and hence the bubbles. you can hit center key to add more bubbles. and as you noticed they disappear after some time.

Quote
Next, when loading it start at 40fps and then go to 60fps and stay at 60fps.

same thing with animation, dalvik somehow warms up, good for us :D

Quote
Some time after the bubbles start disappearing gently to let the black screen alone, always at 60fps of course.

60fps with and without bubbles, i suppose there is vsync or something which limits fps.

and nevermind the menu, "copy paste is the mother of all evil" ;D

Offline dl.zerocool

  • long
  • ***
  • Posts: 104
    • View Profile
Re: blitting text and images
« Reply #27 on: March 31, 2010, 06:39:55 pm »

ehm ;D it's an image and text blitting test application, and hence the bubbles. you can hit center key to add more bubbles. and as you noticed they disappear after some time.
Sorry I don't understand what "blitting" means, I'm living in Switzerland and my mothers tongue is French, even I also speak Portuguese, English, German(school level) :) and learning Japanese.

Quote
and nevermind the menu, "copy paste is the mother of all evil" ;D
Ahah I do know this very well...
---
"Last week we had to "play" program few small trains with train station in real. (It was to prove our understanding about threads using the pthread lib).
And I spent 45minutes why my TrainA was not doing is stops and the TrainB suddenly stop itself when it was not needed.
Each train has is own thread and I did a copy paste at start to not having to rewrite the all thing... Well it was a bad idea since i copied TrainStop(B); everywhere... on the A thread."
---
Now about A1.
If I add bubbles the fps drop under 60 fps
with 14 bubbles ~43fps
with 18 bubbles ~38fps
and as soon as they start disappearing it goes back to 60fps.

anther thing is that when you leave the application (home for exemple) then go back in, there's no more bubbles, only text appear. (same fps as with bubbles)

moving arround with the pad don't make any changes on fps. Or so few that's not visible.

Offline raft

  • quad
  • ******
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: blitting text and images
« Reply #28 on: March 31, 2010, 06:59:25 pm »
Quote from: dl.zerocool
Sorry I don't understand what "blitting" means..
blitting is something like pasting 2d image or text on top of rendered scene

Quote
And I spent 45minutes why my TrainA was not doing is stops and the TrainB suddenly stop itself when it was not needed...
hehe, yeap such things happens all the time..

Quote
Now about A1.
thanks for the tests. did you download A1.apk B1.apk ?

Quote
anther thing is that when you leave the application (home for exemple) then go back in, there's no more bubbles, only text appear. (same fps as with bubbles)
i suppose that happens because some textures are lost when GL surface is recreated. that should be handled in a regular application

Offline dl.zerocool

  • long
  • ***
  • Posts: 104
    • View Profile
Re: blitting text and images
« Reply #29 on: March 31, 2010, 07:18:09 pm »
Quote
Now about A1.
thanks for the tests. did you download A1.apk B1.apk ?
Thanks for the explanation.
I downloaded B1.apk, but the software name is A1, sorry for the confusion.