Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - fivesprites

Pages: 1 ... 5 6 [7]
GLBasic - en / Re: Q*Boyd
« on: 2012-Nov-05 »
Excellent news! Well done Min :)

Announcements / Re: GLBasic V11 public beta
« on: 2012-Sep-16 »
The compilation errors are, I believe, due to GLB performing some case updates on your code.  For example, I had the issue with it changing the names of my Types:

Previously I had:

Code: (glbasic) [Select]
myType as MyType
but now, GLB changes this to:

Code: (glbasic) [Select]
MyType as MyType
To fix this I modified my type to be TMyType and then all instances renamed:

Code: (glbasic) [Select]
myType as TMyType
Took a while to work through the whole project, but this fixed all of my initial issues.


GLBasic - en / Re: Preventing from sleeping
« on: 2012-Sep-06 »
Slightly old topic, but I thought it worth updating rather than creating a new one.

The above changes didn't work for me on various devices and I had to perform a few other changes to get it to work properly.

In summary, I had to employ the use of "wakelocks" by updating the AndroidManifest.xml and also updating  This allows us to enforce a full wake lock which prevents dimming and the eventual stand-by action.

I've already passed these changes on to Gernot for possible inclusion in a future GLB release.  (Hi Gernot - krakatomato here!) :)

I haven't attached my file as I'm unsure as to the license implications (GLB free vs GLB pro) however, the changes are simple to include:

In AndroidManifest.xml, add the new permission:

<uses-permission android:name="android.permission.WAKE_LOCK"


Code: (glbasic) [Select]
    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<supports-screens android:resizeable="false"

In we need to make a few changes:

Add the following at the top of the file (anywhere after the class definition, but before the onCreate() method):

Code: (glbasic) [Select]
    // Power management
    PowerManager pm;
    PowerManager.WakeLock wl;


Code: (glbasic) [Select]
    // Audio
    private static Thread mAudioThread;
    private static AudioTrack mAudioTrack;

    // Power management
    PowerManager pm; // <<-- ADD THIS LINE
    PowerManager.WakeLock wl; // <<-- ADD THIS LINE

    // Load the .so
    static {

Within the onCreate() method we also need to ensure that FLAG_KEEP_SCREEN_ON is set (as mentioned in this thread):

Code: (glbasic) [Select]
                             WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

We also need to add the following to the very end of the onCreate() function:

Code: (glbasic) [Select]
pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "GLBTag");

And finally, we need to ensure we release/acquire the wakelock on certain events:

Within onPause(), add:

Code: (glbasic) [Select]

Within onResume(), add:

Code: (glbasic) [Select]

and within onStop(), add:

Code: (glbasic) [Select]

Don't think I've missed anything, and I apologise if this sounds complicated - it's not really - and it certainly works :)


Pretty much figured the same :(

Gernot, do you plan to introduce support for GLES2.0 at some point in the near future?  Is there anything we could do to help move this along?

Yep - works great!

Here's an example:

This modifies the background image by changing the colour using RGB->HSV->RGB.  Move the mouse around to change the Hue and Saturation and the Left/Right mouse buttons to adjust the Value.


Do fragment shaders work with GLBasic? (Since it's only OpenGL 1.1?)
I wonder if the hardware on the PC just didn't mind the shader code, while the Android version is more strict.

@mentalthink: Cool, never heard of the Khhonos Library yet!  So it MAY be possible to run OpenGL 2.0 in GLBasic?!?!

It does look like it's an 2.0 thing.  It's a shame really as the shaders I'm using look lovely on the PC (using GLB) :(

Hopefully Gernot will be able to introduce support for it in the future.

Thanks guys.


"test.frg"  in the GLB code misses an 'a' `?

Unfortunately, no - that was a typo by we when writing the post - wish it was that simple!

GLBasic - en / Problem with shaders on Android
« on: 2012-Jun-11 »

Has anybody managed to get shaders working on the Android platform? 
No matter what I try, I can't seem to get even the most basic to work - even though they work without fault on PC.

Simple Fragment Shader (test.frag)

Code: (glbasic) [Select]
void main(void)
  gl_FragColor = vec4( 1, 1, 0, 1);

Any request to load that shader using:

Code: (glbasic) [Select]
IF (X_LOADSHADER(1, "", "test.frg"))
STDOUT "Shader loaded ok\n"

results in "FAILED TO LOAD SHADER" being lobbed out in the Android logs.  No other clues given :(

Any help would be greatly appreciated.


Off Topic / Re: Raspberry Pi
« on: 2012-Jun-07 »
Could be possible, with the future compiler for PI, that the generated code works without X (I refer directly from the CLI) ?

I've been playing around with the Pi for a little while now and have also tried some Caanoo test programs on it - all very promising.

With regards to running outside of X Windows, Gernot would need to implement his own routine that created a display surface.  I've done the same and it works well.  Here's a decent example:

Running outside of X, in some circumstances, would be preferable due to the limited memory on the Pi (256MB).

The default memory split on the Pi is 224MB for CPU and 32MB for GPU.  You can adjust this weighting, but it's not something general users will know how to do.  Clearly, the case for running without an X server is compelling due to the memory footprint it will have.

Bug Reports / Re: Float precision
« on: 2012-May-03 »
Or, if this is what you're after:

manx = 9, mx = 9
manx = 9.2, mx = 9
manx = 9.4, mx = 9
manx = 9.6, mx = 9
manx = 9.8, mx = 9
manx = 10, mx = 10
manx = 10.2, mx = 10
manx = 10.4, mx = 10
manx = 10.6, mx = 10

then you can get it with:

IMPORT "C" double ceil(double)

mx = ceil(manx*100)/100.0

Bug Reports / Re: Float precision
« on: 2012-May-03 »

IMPORT "C" double round(double)

mx = round(manx)

manx = 9.2, mx = 9
manx = 9.4, mx = 9
manx = 9.6, mx = 10
manx = 9.8, mx = 10
manx = 10, mx = 10
manx = 10.2, mx = 10
manx = 10.4, mx = 10
manx = 10.6, mx = 11

Pages: 1 ... 5 6 [7]