opengl-es-2.0

How to show camera preview by opengl

假如想象 提交于 2019-12-23 03:47:10
问题 I want to show camera preview by SurfaceTexture. I have read this sample and it work well:: Modifying camera output using SurfaceTexture and OpenGL Now I want to do some process to the preview frames, how to get the data and push to the texture? 回答1: There are two ways to use opengl to show this pixels data Using Opengl in JAVA Using opengl in c or c++ ( JNI ) Actually, either way, It is going to be easy if you know what opengl pipeline is I alway use opengl with c++ because of reusability

How to render a mesh behind another mesh, like a mask?

空扰寡人 提交于 2019-12-23 03:25:16
问题 I would like it so that when mesh A (the character), is behind mesh B (a wall), it is still rendered but with a solid gray color. I'm beginning opengles 2.0 and I'm still unsure as to go about this. From what I understand the depth buffer allows meshes to fight out who will be seen in the fragments they encompass, also there are various blend functions that could possibly involved in this, finally the stencil buffer looks like it would also have this desirable functionality. So is there a way

Load .obj file out of Blender

倖福魔咒の 提交于 2019-12-23 02:38:22
问题 im searching now for a quite long time to find something working to import Blender 3D .obj files into xcode to use it on an iphone application. i cant find a description how to implement something like that anywhere! i dont want to use any engine. i just want to know the steps i have to fullfill and the basic things to do. there is really nothing on the www. you can find articles from 2005 - 2008 but thats all not up to date and nothing working. So, does anybody knows how to do that? 回答1:

android opengl 2.0 stencil buffer not working

与世无争的帅哥 提交于 2019-12-23 02:31:37
问题 I'm facing very strange behaviour on my android device when I am trying to use stencil buffer feature. (GLES20.glEnable(GLES20.GL_STENCIL_TEST);) here is my code: GLES20.glEnable(GLES20.GL_STENCIL_TEST); GLES20.glStencilFunc(GLES20.GL_GEQUAL, 1, 0xff); GLES20.glStencilOp(GLES20.GL_KEEP, GLES20.GL_INCR, GLES20.GL_INCR); GLES20.glStencilMask(0xff); m_index_buffer.position(start_index); GLES20.glDrawElements(GLES20.GL_TRIANGLE_STRIP, n_indicies, GLES20.GL_UNSIGNED_SHORT, m_index_buffer); GLES20

GL Maximum Textures Size Policy

安稳与你 提交于 2019-12-22 23:39:08
问题 I'm developing a game with AndEngine. Since I'm doing it for Android and I want to cover as many devices as possible without the textures quality trade off I have 2 texture packs types: the HD and the LOW: HD textures = 2048x2048 LOW textures= 1024x1024 HD camera = 800x1280 LOW camera = 400x640 I've have made all the logic of setting up a HD texture pack or a LOW texture pack, what I need now is a good policy for choosing witch to use when the app starts up. Using AndEngine's: GLState state =

Rendering to depth texture - unclarities about usage of GL_OES_depth_texture

旧时模样 提交于 2019-12-22 18:03:17
问题 I'm trying to replace OpenGL's gl_FragDepth feature which is missing in OpenGL ES 2.0. I need a way to set the depth in the fragment shader, because setting it in the vertex shader is not accurate enough for my purpose. AFAIK the only way to do that is by having a render-to-texture framebuffer on which a first rendering pass is done. This depth texture stores the depth values for each pixel on the screen. Then, the depth texture is attached in the final rendering pass, so the final renderer

Post processing and resulting texture

痞子三分冷 提交于 2019-12-22 13:54:17
问题 I'm trying to understand how post processing work. From what I understood, I need to to something like that: -> Bind render texture -> Draw my scene -> Unbind render texture -> Draw a quad full screen using the resulting texture using a shader to apply an effect (blur, …) The problem with that system is: How can I apply multiple effects on the resulting quad? In my mind, I think applying the "effects" (shaders) on the resulting texture then drawing the quad his probably the best solution, but

Using GL_RG_EXT and GL_UNSINGED_BYTE

爱⌒轻易说出口 提交于 2019-12-22 13:01:41
问题 I met some problems while using GL_RG_EXT and GL_UNSIGNED_BYTE. Related code: class TextureBuffer { public: GLuint texture; GLuint frameBuffer; GLenum internalformat; GLenum format; GLenum type; int w,h; TextureBuffer() : texture(0), frameBuffer(0) {} void release() { if(texture) { glDeleteTextures(1, &texture); texture = 0; } if(frameBuffer) { glDeleteFramebuffers(1, &frameBuffer); frameBuffer = 0; } } }; TextureBuffer _maskTexture; generateRenderToTexture(GL_RG_EXT, GL_RG_EXT, GL_UNSIGNED

Why is glGenVertexArrays defined for a C program but not a C++ program on Linux?

橙三吉。 提交于 2019-12-22 12:37:25
问题 Consider the following file: #include <SDL.h> #include <GLES2/gl2.h> int main() { SDL_Init(SDL_INIT_VIDEO); SDL_Window *window = SDL_CreateWindow("Test", 0, 0, 200, 200, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN); SDL_GLContext context = SDL_GL_CreateContext(window); GLuint vao; glGenVertexArrays(1, &vao); } If the above is test.c, then the following line (compiling as C code) works perfectly: gcc test.c -I/usr/include/SDL2 -lGLESv2 -lSDL2 This next one (compiling as C++ code), however, does not:

Hud with shaders (opengl-es 2.0)

懵懂的女人 提交于 2019-12-22 10:44:21
问题 How to draw a HUD using shaders on opengl es 2.0? I have a shader which draws a textured quad on screen, it uses MVP matrix. The quad has it own vertices which are independent of view position and so on (cause of MVP matrix) Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3f, 17); Matrix.setLookAtM(mVMatrix, 0, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f); I'd like to show the same quad on the top right corner (like a button or something else, HUD). As I understand, i need create an ortho