Menu

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.

Show posts Menu

Messages - fivesprites

#91
GLBasic - en / Re: Q*Boyd
2012-Nov-05
Excellent news! Well done Min :)
#92
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.

//Andy
#93
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 SDLActivity.java.  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 SDLActivity.java 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"

e.g.:

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 SDLActivity.java 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;


e.g.:

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 {
        System.loadLibrary("SDL");
        System.loadLibrary("SDL_image");
        System.loadLibrary("mikmod");
        System.loadLibrary("SDL_mixer");
        System.loadLibrary("SDL_ttf");
        System.loadLibrary("main");
    }


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

Code (glbasic) Select

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                             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");
wl.acquire();


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

Within onPause(), add:

Code (glbasic) Select

    wl.release();


Within onResume(), add:

Code (glbasic) Select

    wl.acquire();


and within onStop(), add:

Code (glbasic) Select

    wl.release();


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

//Andy
#94
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?

#95
Yep - works great!

Here's an example:  https://dl.dropbox.com/u/32204670/ShaderTest.zip

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.

:)

#96
Quote from: Slydog on 2012-Jun-11
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.

/Andy
#97
Quote from: Ocean on 2012-Jun-11
"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!
#98
Hi,

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"
ELSE
STDOUT "FAILED TO LOAD SHADER!\n"
ENDIF


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

Any help would be greatly appreciated.

/Andy

#99
Off Topic / Re: Raspberry Pi
2012-Jun-07
Quote from: veketor on 2012-Jun-06
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:

http://benosteen.wordpress.com/2012/04/27/using-opengl-es-2-0-on-the-raspberry-pi-without-x-windows/

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.

#100
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


#101
or...

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