OpenGl 1.7 Library

RFI Bill

Member
Licensed User
Longtime User
Hi there!

Just running the OpenGL examples Jim Brown made on my Acer Iconia A200 Tablet and I keep getting really random errors thrown back at me at completely random times. Im running his latest Nehe implementation what includes texture mapping.
The bizarre thing is - when I run them on the emulator I get zero errors and everything runs smooth.

-------------------
The main error I get that reoccurs is
LogCat connected to: A7070434480A1D7
--------- beginning of /dev/log/main


--------- beginning of /dev/log/system
** Service (widgetservice) Create **


** Service (widgetservice) Start **
** Service (widgetservice) Start **
** Service (widgetservice) Start **


image in cache
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
main_timer1_tick (B4A line: 68)
End Sub

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at anywheresoftware.b4a.debug.Debug.PopSubsStack(Debug.java:158)
at basic.android.NeheDemo.main._timer1_tick(main.java:1164)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:136)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:103)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4126)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer



Only I cannot see where I would be trying to cast a string into an integer (maybe its because im a noob).

I also occasionally get the error stating that my rendering thread is trying to change something on the GUI thread.

Im really enjoying the OPENGL side of things and want to learn more, but am wondering if its pointless if theres something wrong with the library or if its just something retarded with Acer Iconia Tabs.

Thank You!
 

agraham

Expert
Licensed User
Longtime User
It looks like you have compiled in debug mode and that the error is in the hidden debug code and not your code. Are you trying to stop and step your OpenGL rendering code? If so it is possibly a cross-thread problem as I suspect that the debug code assumes it is always running on a single main thread, Erel might want to look at this. This might also be the cause of the rendering thread touching the GUI error. See if it runs OK when normally compiled.

The rendering code runs on a separate thread so I gave the library a means of communication both ways between the threads. The GLSurfaceView RunOnGuiThread method can be used to invoke a Sub to run on the main thread and the GLSurfaceView QueueEvent used to invoke a Sub to run on the rendering thread.
 
Upvote 0

RFI Bill

Member
Licensed User
Longtime User
Thank you for the reply!

I am compiling in debug mode however Im not stepping through it - will give it a go in Release mode tomorrow and see if I get the errors occuring again! Will post back here soon.

What would be a general rule with invoking using your RunOnGuiThread/QueueEvent methods? Im unclear on when to use it probably because im just getting into this - but its really fun and I got some texture mapping happening yesterday! (on a side note - its rather annoying how OpenGL ES doesnt have an unproject function to allow for quick and easy ray picking!)

Cheers!
 
Upvote 0

RFI Bill

Member
Licensed User
Longtime User
You were right Agraham! - Its something to do with running it in debug mode - I ran it in Release and it didnt shit itself once. Thank you very much for your assistance its really appreciated. (Scoured the forums and internet for about 3 days trying to find the issue)
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
What would be a general rule with invoking using your RunOnGuiThread/QueueEvent methods?
There isn't one. They are there if you need them. For example as the rendering thread cannot touch UI elements the demo (which can barely be called that!) uses RunOnGuiThread to report any exception on the rendering thread to the main thread where it can display a Msgbox.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…