How to synchronize an array

Problems with Canvas, OpenGL, etc...

How to synchronize an array

Postby svhopta » Wed Feb 29, 2012 6:20 am


I am new to android development and I'm working on a OpenGL game. It's a basic Maze game. onDrawFrame will read a 2 dimension array that holds the location of the walls in the array. The first dimension is a Y location and the second is the X. My program works great until I try to execute my solve routine. It updates the array once every 20 ms with a single location of the answer to the maze. On a medium size maze, the solution should take about 10-30 seconds to solve withe the 20 ms delay. This should allow the user to see the maze solved on the screen. The problem I'm running into is the Thread that executes the onDrawFrame is not seeing the updates.

Can someone help me with this. How can I synchronize this array between the two threads. I tried to use a Synchronize routine but it seemed like the onDrawFrame thread never released the array to be updated by the main Thread.

Any help would be appreciated.


Posts: 2
Joined: Wed Nov 03, 2010 8:03 pm


Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 4 guests