[android-developers] Re: Game using Canvas porting to OpenGL please help
Take a look at the sprite drawing code in the apps-for-android code here http://code.google.com/p/apps-for-android/ You will see how you go about drawing a bitmap onto the OpenGL surface. Trying to explain the steps required to re-implement your sample code in Android might have seemed a bit of a big job hence no replies. I have implemented an abstraction for line drawing in my BulletML demo which lets you switch between Canvas and OpenGL here: http://code.google.com/p/netthreads-for-android/ This only handles line drawing though. It's not easy to get your head around this stuff. I spent a lot of time stumbling around towards a solution. Al. On Jun 30, 10:05 pm, TjerkW tje...@gmail.com wrote: Nobody can help me? On 18 jun, 14:12, TjerkW tje...@gmail.com wrote: Hello All, My game runs fairly well on my phone, but i want to increase the performance by usingopengl. However currently i use the Canvas. I am a beginner inopengl. I have to port all my drawing code toopengl. However can somebody give me directions. For example how do i do the following inopengl: c.save(); c.scale(0.3f+scale, 0.3f+scale, width/2, height/2); c.drawBitmap( bMsg.bitmap, width/2 - bMsg.bitmap.getWidth()/2, dy+height/2 - bMsg.bitmap.getHeight()/2, MESSAGE_PAINT ); c.restore(); And why cant i just use Canvas as an abstraction layer (facade) foropengl. An implementation of canvas could call the correctopenglmethods in order to render. Why do i have to port all my code. I thought the canvas was a good abstraction interface to a drawing surface, why do i have to bother withopengl? It looks like this is possible, when is see the following contructor: public Canvas (GL gl) Also the this seems usefull. SURFACE_TYPE_GPU Surface type: creates a surface suited to be used with the GPU So what should i do? Re implementing the GamePainter completely and callopenglfunctions directly? Or is there some kind of abstraction mechanism, so that i can useOpenGLwith just a few lines of code? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Game using Canvas porting to OpenGL please help
I am already reading some opengl es tutorials. OpenGL is really low level as i see it, but not that difficult. So i will manage i hope. Greetings 2009/7/1 Alistair. alistair.rutherf...@googlemail.com Take a look at the sprite drawing code in the apps-for-android code here http://code.google.com/p/apps-for-android/ You will see how you go about drawing a bitmap onto the OpenGL surface. Trying to explain the steps required to re-implement your sample code in Android might have seemed a bit of a big job hence no replies. I have implemented an abstraction for line drawing in my BulletML demo which lets you switch between Canvas and OpenGL here: http://code.google.com/p/netthreads-for-android/ This only handles line drawing though. It's not easy to get your head around this stuff. I spent a lot of time stumbling around towards a solution. Al. On Jun 30, 10:05 pm, TjerkW tje...@gmail.com wrote: Nobody can help me? On 18 jun, 14:12, TjerkW tje...@gmail.com wrote: Hello All, My game runs fairly well on my phone, but i want to increase the performance by usingopengl. However currently i use the Canvas. I am a beginner inopengl. I have to port all my drawing code toopengl. However can somebody give me directions. For example how do i do the following inopengl: c.save(); c.scale(0.3f+scale, 0.3f+scale, width/2, height/2); c.drawBitmap( bMsg.bitmap, width/2 - bMsg.bitmap.getWidth()/2, dy+height/2 - bMsg.bitmap.getHeight()/2, MESSAGE_PAINT ); c.restore(); And why cant i just use Canvas as an abstraction layer (facade) foropengl. An implementation of canvas could call the correctopenglmethods in order to render. Why do i have to port all my code. I thought the canvas was a good abstraction interface to a drawing surface, why do i have to bother withopengl? It looks like this is possible, when is see the following contructor: public Canvas (GL gl) Also the this seems usefull. SURFACE_TYPE_GPUSurface type: creates a surface suited to be used with the GPU So what should i do? Re implementing the GamePainter completely and callopenglfunctions directly? Or is there some kind of abstraction mechanism, so that i can useOpenGLwith just a few lines of code? -- -- Tjerk Wolterink @ GMail --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Game using Canvas porting to OpenGL please help
Nobody can help me? On 18 jun, 14:12, TjerkW tje...@gmail.com wrote: Hello All, My game runs fairly well on my phone, but i want to increase the performance by usingopengl. However currently i use the Canvas. I am a beginner inopengl. I have to port all my drawing code toopengl. However can somebody give me directions. For example how do i do the following inopengl: c.save(); c.scale(0.3f+scale, 0.3f+scale, width/2, height/2); c.drawBitmap( bMsg.bitmap, width/2 - bMsg.bitmap.getWidth()/2, dy+height/2 - bMsg.bitmap.getHeight()/2, MESSAGE_PAINT ); c.restore(); And why cant i just use Canvas as an abstraction layer (facade) foropengl. An implementation of canvas could call the correctopenglmethods in order to render. Why do i have to port all my code. I thought the canvas was a good abstraction interface to a drawing surface, why do i have to bother withopengl? It looks like this is possible, when is see the following contructor: public Canvas (GL gl) Also the this seems usefull. SURFACE_TYPE_GPU Surface type: creates a surface suited to be used with the GPU So what should i do? Re implementing the GamePainter completely and callopenglfunctions directly? Or is there some kind of abstraction mechanism, so that i can useOpenGLwith just a few lines of code? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---