Easiest way to move 2d to opengl for andriod is to create a a triangle strip of two triangles to make a square (quad), and apply a texture to that Look a say blog.jayway.com/2009/12/03/opengl-es-tut... to get your self started, and then part 6 for texturing If you keep the camera in the same plane as the quads you are able to just use translate operations to move them around the screen. Keep an orthogonal view instead of perspective, and you will be able to layer things along the z axis. Eg draw your back grounds further from the screen than your sprites After that all your normal code that would draw a different image as part of the animation, simply sets a different texture instead eg pseudo code begin (do once per frame) gl.
GlEnableClientState(GL10. GL_VERTEX_ARRAY); //set that you are using vertexs gl. GlEnableClientState(GL10.
GL_TEXTURE_COORD_ARRAY); // and textures gl. GlFrontFace(GL10. GL_CCW); // you are using counter clock wise notation gl.
GlVertexPointer(3, GL10. GL_FLOAT, 0, vertexFloatBuffer); // here is your floatbuffer for your quad gl. GlTexCoordPointer(2, GL10.
GL_FLOAT, 0, textureFloatBuffer); // here is your texture coordinate float buffer gl. GlNormalPointer(GL10. GL_FLOAT, 0, normalFloatBuffer); // here is your normal buffer (optional only if you are doing lighting) //draw For each sprite s { gl.
GlTranslatef(s. X,s. Y,s.
Z) // move it gl. GlBindTexture(texMode, s. Texid); // set the texture to the sprites animation frame gl.
GlDrawElements(GL10. GL_TRIANGLE_STRIP, indicesLength, GL10. GL_UNSIGNED_BYTE, quadByteBuffer); // draw it } //end (do once per frame or when ever you change vertex lists eg if you have additional complex shapes.) gl.
GlDisableClientState(GL10. GL_VERTEX_ARRAY); gl. GlDisableClientState(GL10.
GL_TEXTURE_COORD_ARRAY) Cheers - K.
Easiest way to move 2d to opengl for andriod is to create a a triangle strip of two triangles to make a square (quad), and apply a texture to that. Look a say blog.jayway.com/2009/12/03/opengl-es-tut... to get your self started, and then part 6 for texturing. If you keep the camera in the same plane as the quads you are able to just use translate operations to move them around the screen.
Keep an orthogonal view instead of perspective, and you will be able to layer things along the z axis. Eg draw your back grounds further from the screen than your sprites. After that all your normal code that would draw a different image as part of the animation, simply sets a different texture instead.Eg pseudo code //begin (do once per frame) gl.
GlEnableClientState(GL10. GL_VERTEX_ARRAY); //set that you are using vertexs gl. GlEnableClientState(GL10.
GL_TEXTURE_COORD_ARRAY); // and textures gl. GlFrontFace(GL10. GL_CCW); // you are using counter clock wise notation gl.
GlVertexPointer(3, GL10. GL_FLOAT, 0, vertexFloatBuffer); // here is your floatbuffer for your quad gl. GlTexCoordPointer(2, GL10.
GL_FLOAT, 0, textureFloatBuffer); // here is your texture coordinate float buffer gl. GlNormalPointer(GL10. GL_FLOAT, 0, normalFloatBuffer); // here is your normal buffer (optional only if you are doing lighting) //draw For each sprite s { gl.
GlTranslatef(s. X,s. Y,s.
Z) // move it gl. GlBindTexture(texMode, s. Texid); // set the texture to the sprites animation frame gl.
GlDrawElements(GL10. GL_TRIANGLE_STRIP, indicesLength, GL10. GL_UNSIGNED_BYTE, quadByteBuffer); // draw it } //end (do once per frame or when ever you change vertex lists eg if you have additional complex shapes.
) gl. GlDisableClientState(GL10. GL_VERTEX_ARRAY); gl.
GlDisableClientState(GL10. GL_TEXTURE_COORD_ARRAY); Cheers - K.
I haved used surfaceview/canvas to make 2d games for a while now so I have decided to move on to OpenGL ES. But I have never used openGL or ES before. I've tried browsing the web but only found complex 3D tutorial with polygons and stuff like that.
I just want pure 2D. So if anyone have a good start for really OpenGL ES beginners I'm would'd be really happy! I have tried AndEngine but I the Lib is so huge and to complex -.
- but I do want to load sprites.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.