How do I render 2D sprites in OpenGL given that I have a png of the sprite? See images as an example of the effect I'd like to achieve. Also I would like to overlay weapons on the screen like the rifle in the bottom image. Does anyone know how I would achieve the two effects? Any help is greatly appreciated.
相关问题
- OpenGL Shaders. Pass array of float
- debugging webgl in chrome
- Difference from eglCreatePbufferSurface and eglCre
- SecurityError for same-origin image texImage2D
- Render 3d Objects into Cameraview
相关文章
- Why is glClear blocking in OpenGLES?
- Writing to then reading from an offscreen FBO on i
- How to get OpenGL version using Javascript?
- Why do I need to define a precision value in webgl
- How to change one texture image of a 3d model(maya
- Issue in passing Egl configured surface to native
- Draw a line over UIViewController
- Why do my three.js examples not load properly?
a) For the first case:
That's not really 2D sprites. Those men seem to be rendered as single quads with a texture with some kind of transparency (either alpha test or alpha blending).
Anyway, even a single quad can still be considered a 3D object, so for such situation you might want to treat it as one: track its translation and rotation and render it in the same way as any other 3D object.
b) For the second case:
If you want the gun (a 2D picture, I pressume) to be rendered in the same place without any perspective transformation, then you can use the same technique one uses for drawing the GUI (etc). Have a look at my post here:
2D overlay on a 3D scene