thank you sooo much, everyone!
i've been meaning for someone to tell me that since a very long time
ago, but no one did, so i was stuck!
:)
On Apr 9, 3:30 pm, Dianne Hackborn hack...@android.com wrote:
If you want to use the standard 2d APIs, don't use OpenGL.
On Thu, Apr 9, 2009 at 1:45
Just my 2 stotinki -- I see more and more developers using this WRONG
resource acquisition pattern with try...finally:
try
{
acquireResource();
}
finally
{
releaseResource();
}
This is plain wrong. The correct way to obtain a resource and release
it is to acquire it BEFORE the try
I hadn't realised you are doing openGL stuff. I've used surfaceview/
holder in the same was as the lunarlander, but I haven't used openGL
so I don't know how that works.
But, at a glance, it looks like you've got a mix of two different
approaches here - maybe the lockcanvas/unlockcanvasandpost
If you want to use the standard 2d APIs, don't use OpenGL.
On Thu, Apr 9, 2009 at 1:45 PM, mcmc manni...@gmail.com wrote:
wow thanks so much for your help. I think you're right! :D
however, now I run into another problem. Do you know how to convert
openGL to simply using the standard
Sorry, I misread your code before. It looks the same as lunarview and
also the same as my game loop, both of which work fine, so I think it
must be something you are doing outside of this code snippet.
You do have to unlock for every successful lock (but not if you get a
null back), so your code
The exception is thrown the 1st time around the loop. And Unlock is
never called, since there was never a successful Lock in the first
place... :(
Right now, my code looks like this one:
http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/graphics/GLSurfaceView.html
Oh - I think I can see the problem in your code now. You've got your
'finally' block outside of your while loop, rather than inside it.
This means that you are calling lockCanvas() repeatedly without
calling UnlockCanvasAndPost(). The exception is going to be thrown on
the 2nd iteration of the
my finally is inside my while loop.
but maybe i'm not doing it correctly...
do I have to call unlockCanvasAndPost every time I call lockCanvas
(even if it returns a null)? or do I only call unlockCanvasAndPost if
the lockCanvas returns a non null canvas (which is my current
implementation)?
On
my finally is inside my while loop.
but maybe i'm not doing it correctly...
do I have to call unlockCanvasAndPost every time I call lockCanvas
(even if it returns a null)? or do I only call unlockCanvasAndPost if
the lockCanvas returns a non null canvas (which is my current
implementation)?
On
actually, I am drawing onto the surface from a different thread...
that's not allowed?? how would I go around doing this?
I'm not drawing before the surfaceCreated() callback...
On Apr 5, 11:15 am, ellipsoidmob...@googlemail.com
ellipsoidmob...@googlemail.com wrote:
Might also be worth
i, now, combined the two threads into one, and I still get the same
error at lockCanvas().
any ideas would be much appreciated. thank you.
On Apr 6, 11:47 am, mcmc manni...@gmail.com wrote:
actually, I am drawing onto the surface from a different thread...
that's not allowed?? how would I go
Might also be worth checking that you aren't drawing into the surface
from a different thread, and that you aren't drawing before the
surfaceCreated() callback
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android
I don't have a direct answer for you.
But this is what i usually do when problems baffle me. I browse the
git-source of Android.
Try to find the source of SurfaceHolder and find the lockCanvas( ) and
see why it may throw an exception.
On Apr 3, 1:32 pm, mcmc manni...@gmail.com wrote:
Everytime
13 matches
Mail list logo