Android Question Trying to render Points at the lowest level and fastest possible

Roger Taylor

Member
Licensed User
Longtime User
I've included a test program that is toying with seeing how fast I can simulate a 6847 VDG. In my example VDG is passing over an area of "RAM" from addresses 1024-1535 which is the TRS-80 CoCo's 32x16 text screen. I'm plotting each point per loop just to see if modern Android devices can simulate an old CRT's beam, so to speak. ~60 fps, 15.75 Khz raster lines, etc. Actually, as long as the raster lines are timed right, I can probably render each line in a faster way, but for now I'd like to keep it the way it is since there are CoCo demos that follow the VDG timing. Keep in mind that I'm gearing up to add a thread that emulates the 6809 CPU, so overall app speed is important.

Currently per someone's suggestion I'm using BitmapCreator and ByteConverter, which I highly doubt is the lowest level or fastest method possible to set colors in a 800x262 bitmap and have the livest possible display on the Android device. That is, when I store a color INT into the bitmap, I want it to appear immediately on some kind of surface other than a stock ImageView.

I've been looking at forum posts pertaining to libGDX and find it hard to follow because of a lack of actual examples that deal with what I'm dealing with. I'm of the mind that if somebody can write a B4A app showing hundreds of thousands of particles flying around the screen like water at 60fps, that what I'm doing should be rather simple to achieve using 209,600 static points.

Can someone have a go at converting my example to use libGDX, OpenGL, or some other low-level renderer?

*** I donate!! ***
 

Attachments

  • retro_display.zip
    10.9 KB · Views: 55
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
There are too many mistakes and bad practices in this code for me to help. Sorry.
This is simply not the correct approach. You don't need to add another thread. You shouldn't call Sleep inside critical code.

60 fps sand example: https://www.b4x.com/android/forum/t...oss-platform-falling-sand-game.94276/#content
Note that many improvements were added since this example was created. The most important one is B4XPages. Still this example might help you get started.
Make sure to test it in Release mode.
 
Upvote 0

Roger Taylor

Member
Licensed User
Longtime User
This is also a mistake. If you aim for 60fps then you have 16 milliseconds to create a frame and render it. Creating a new image after each drawing will simply kill performance.

Hence, my original post a week ago asking if there's a way to update a "live" bitmap, or whatever the View is currently set to display. As for the quality of my test code, it's not meant this early to be anything more than messy, unorganized, and junk, because I'm playing around with ideas and I'm all over the place. As for the approach I took to rendering each data pixel, I was trying to see if a modern Android device could keep up with shifting pixels onto the screen one by one, so to speak. I'm very familiar with how the 6847 works and how much software uses the precise timing of the chip, yet I realize I need to find a quicker way to render each raster line even if it means forfeiting a few features. The thread that changes the characters being displayed is nothing I plan to keep, nor was it an approach I meant to take. However, there is no reason that the VDG can't be on the main thread while an emulated CPU can run on another thread.
 
Upvote 0

Roger Taylor

Member
Licensed User
Longtime User
There are too many mistakes and bad practices in this code for me to help. Sorry.
This is simply not the correct approach. You don't need to add another thread. You shouldn't call Sleep inside critical code.

60 fps sand example: https://www.b4x.com/android/forum/t...oss-platform-falling-sand-game.94276/#content
Note that many improvements were added since this example was created. The most important one is B4XPages. Still this example might help you get started.
Make sure to test it in Release mode.

In this thread you had a different solution which worked for me to get the bitmaps displaying, otherwise not using Sleep(0) caused a lockup and timeout of the app.

 
Last edited:
Upvote 0
Top