opengl-es-2.0

black screen / no events in iOS OpenGL ES 2

扶醉桌前 提交于 2019-12-10 15:36:49
问题 I'm dealing with an error for about 45 days. I already tried dozens of method calls, change the whole program, but nothing works. I use GLES 2, with a UIViewController that is the rootViewController, that has a view of type UIView, whose layerclass is CAEAGLLayer. When i run the application, the screen gets black and if i press the screen, no events are generated. If i rotate the application, the screen appears and the events work. Even worst, if i dont rotate the application, but put a

applying texture to Cube, different texture on each face of cube

跟風遠走 提交于 2019-12-10 14:48:28
问题 I'm trying to apply different texture on cube with shaders using samplerCube and textureCube. But I'm not able to get texture drawn on faces of cube only single color is appearing. Screenshots of output Below is my shader code: Vertex Shader String strVShader = "attribute vec4 a_position;" + "uniform mat4 u_VPMatrix;" + "attribute vec3 a_normal;" + "varying vec3 v_normal;" + "void main()" + "{" + "gl_Position = u_VPMatrix * a_position;" + "v_normal = a_normal;" + "}"; Fragment Shader String

Translation after rotation

北城以北 提交于 2019-12-10 13:43:56
问题 I'm using OpenGL ES 2.0 for Android. I'm translating and rotating a model using the touch screen. My translations are only in the (x, y) plane, and my rotation is only about the z-axis. Imagine looking directly down at a map on a table and moving to various coordinates on the map, and being able to rotate the map around the point you are looking at . The problem is that after I rotate, my subsequent translations are to longer matched to the motions of the pointer on the screen, the axes are

GLSurfaceView onDrawFrame clearing behavior

家住魔仙堡 提交于 2019-12-10 13:24:41
问题 I ran into different behaviors with the GLSurfaceView. AFAIK it is the responsibility of the program to clear the buffer (color and depth ) each frame. Which means that if I don't clear the buffer I get the content of the last frame ( or the one before that for double buffering ). It seems though as if the buffer is cleared no matter what on some devices. I ran the following modification of the "Hello Triangle" program from the Addison Wesley OpenglES2.0 Programming Guide on some test devices

Media Codec and Rendering using GLSurfaceview, Optimization for OnDrawFrame

情到浓时终转凉″ 提交于 2019-12-10 11:48:44
问题 I am using media codec for encoding frame coming from camera and render it using gl surface view. my ondrawframe looks like this public void onDrawFrame(GL10 unused) { float[] mtx = new float[16]; GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); surface.updateTexImage(); surface.getTransformMatrix(mtx); mDirectVideo.draw(surface); saveRenderState(); delegate.mInputSurface.makeCurrent(); mDirectVideo.draw(surface); delegate.swapBuffers(); restoreRenderState(); } So here

Recording videos with overlay images without using third party library on android

旧巷老猫 提交于 2019-12-10 11:14:43
问题 Iam trying to develop an android based camera application which requires recording videos on live camera preview with overlay images. Is there any way on android using which we can record videos with overlay images without using any third party library . Currently iam using an additional Surfaceview as an overlay on live camera screen and MediaRecorder class for recording videos.Here is my code : recorder = new MediaRecorder(); recorder.setCamera(mCam); String filename=""; String path="";

Android OpenGL ES 2.0 : Can a GL_FLOAT texture be assigned to a FBO as a COLOR attachment?

自闭症网瘾萝莉.ら 提交于 2019-12-10 10:24:32
问题 I want to get the value using GL_FLOAT texture by glReadPixels. My Android device support OES_texture_float . but, it became an error to attach GL_FLOAT texture. In OpenGL ES 2.0 in Android, to attach GL_FLOAT texture to FBO is impossible? Or depend on hardware? Part of my code is: Init: glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D,texture); glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,texWidth,texHeight,0,GL_RGB,GL_FLOAT,NULL); FBO Attach: glBindFramebuffer(GL_FRAMEBUFFER,framebuffer);

Reasonable texture sizes in android

℡╲_俬逩灬. 提交于 2019-12-10 06:26:18
问题 I'm trying to develop an app that uses opengl on android, and ideally make it run on any phone as old as the original droid (or at least any phone that has OpenGL ES 2.0 support). Currently, I'm using a 2048x2048 ETC1 texture compression. It works fine on the Droid X I'm testing it on, but I currently don't have an original droid to test it on, and I can't find much data on this topic either. I know the G1 didn't do well with textures bigger than 512x512, and the droid seems to do fine with

for-loop in shader code working with hardcoded number but not with uniform variable

大城市里の小女人 提交于 2019-12-10 05:37:14
问题 I asked for help about an OpenGL ES 2.0 Problem in this question. What seems to be the answer is very odd to me. Therefore I decided to ask this question in hope of being able to understand what is going on. Here is the piece of faulty vertex-shader code: // a bunch of uniforms and stuff... uniform int u_lights_active; void main() { // some code... for ( int i = 0; i < u_lights_active; ++i ) { // do some stuff using u_lights_active } // some other code... } I know this looks odd but this is

Can an OpenGL ES fragment shader change the depth value of a fragment?

天大地大妈咪最大 提交于 2019-12-10 02:36:29
问题 Can fragment shader in OpenGL ES 2.0 change the Z value (depth) of a pixel? How is this achieved in OpenGL ES 2.0? 回答1: No -- gl_FragDepth (which is part of the desktop version of GLSL) is not present in OpenGL ES. You can, however, check for the existence of GL_EXT_frag_depth . If it's available, then you can write the depth to gl_FragDepthEXT . The extension paper gives more details about how to enable the extension and such. 回答2: While gl_fragDepth is not available in OpenGL ES 2.0, is is