opengl-es

Floating point textures in OpenGL ES 2.0 on iOS without clamping them to [0, 1]

只愿长相守 提交于 2019-12-21 04:34:08
问题 I need gl_FragColor to "paint" floating point values, which also can be negative (x < 0) and > 1.0. I then want to use the color attachement of the FBO this values where rendered to and use it as a texture in another FBO. Now I have read on http://www.khronos.org/opengles/sdk/docs/man/ (under glTexImage2D) that all values are clamped to a range of [0, 1] and also I didn't find a glClampColor instruction. Is there a possibility to find a workaround here or does somebody have an idea which

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)

纵饮孤独 提交于 2019-12-21 04:32:08
问题 I am creating a 2D game on Android using OpenGL. Currently I am testing and debugging the game on several devices. The problem I am facing, is the terrible "signal 11" error. When I am playing on my Samsung Galaxy Nexus, everything runs smooth, and I can play it for hours without the game throwing any errors. My Nexus is running Android 4.0 Ice Cream Sandwich. Now, when I run it on other devices, I am getting this signal 11 error. This are the devices which throw the error: HTC Desire HD

Why does a single Vec4 multiplication slow down my ogl es 2 fragment shader so much?

柔情痞子 提交于 2019-12-21 04:31:20
问题 I'm writing a 2D OpenGL game for iOS devices. Right now, i'm looking at the performance on iPad (first gen). The game has code paths for ogl 1.1 and 2.0, and I can switch which one is being used with a #define . When using ogl 2.0, the profiler tells me that my Renderer Utilization % is a fairly steady 100%, and my framerate is about 30 fps. When using ogl 1.1, the profiler tells me that my Renderer Utilization % is ~60% and my framerate is 60 fps. I want to improve the performance with ogl 2

Why does a single Vec4 multiplication slow down my ogl es 2 fragment shader so much?

坚强是说给别人听的谎言 提交于 2019-12-21 04:31:14
问题 I'm writing a 2D OpenGL game for iOS devices. Right now, i'm looking at the performance on iPad (first gen). The game has code paths for ogl 1.1 and 2.0, and I can switch which one is being used with a #define . When using ogl 2.0, the profiler tells me that my Renderer Utilization % is a fairly steady 100%, and my framerate is about 30 fps. When using ogl 1.1, the profiler tells me that my Renderer Utilization % is ~60% and my framerate is 60 fps. I want to improve the performance with ogl 2

OpenGL: Single vertex attribute for multiple vertices?

懵懂的女人 提交于 2019-12-21 03:53:26
问题 I have a vertex shader that accepts the following attributes: a_posCoord : vertex position a_texCoord : texture coordinate (passed to the fragment shader) a_alpha : transparency factor (passed to the fragment shader) The objects I'm rendering are all "billboards" (a pair of right triangles to make a rectangle). I'm using a single call to glDrawArrays to render many billboards, each which may have a unique alpha value. A single billboard has 6 vertices. Here's some pseudocode to illustrate how

Is drawing front-to-back necessary for optimizing renders?

时光毁灭记忆、已成空白 提交于 2019-12-21 03:36:24
问题 I've seen the occasional article suggest ordering your vertices from nearest to furthest from the camera when sending them to OpenGL (for any of the OpenGL variants). The reason suggested by this is that OpenGL will not fully process/render a vertex if it is behind another vertex already rendered. Since ordering vertices by depth is a costly component of any project, as typically this ordering frequently changes, how common or necessary is such design? I had previously thought that OpenGL

OpenGL Point Functionality in WebGL

若如初见. 提交于 2019-12-21 02:36:55
问题 In OpenGL you can draw define points like this: glBegin(GL_POINTS); for(float theta=0, radius=60.0; radius>1.0; theta+=0.1, radius-=0.3){ glColor3f(radius/60.0,0.3,1-(radius/60.0)); glVertex2i(200+radius*cos(theta),200+radius*sin(theta)); } glEnd(); How do you accomplish this same functionality in WebGL? 回答1: The code you wrote really doesn't do much except define some points. To do that in WebGL could do it like this var colors = []; var verts = []; var theta=0 for(var radius=60.0; radius>1

eglSwapBuffers failed: EGL_BAD_ALLOC AndEngine Android

与世无争的帅哥 提交于 2019-12-21 02:26:25
问题 I m developing a game in And engine which throws the exception. Actually I don't know the point where exceptions occurs. It is reported in market many many time. java.lang.RuntimeException: eglSwapBuffers failed: EGL_BAD_ALLOC at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1080) at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1038) at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1364) at android.opengl.GLSurfaceView

Display a gstreamer video feed into Google Cardboard SurfaceTexture

懵懂的女人 提交于 2019-12-21 01:40:09
问题 I'm using gstreamer to retrieve a video feed (sent from a RaspPi), and I need to display it into Google Cardboard. I based my work on the tutorial-3 example of gstreamer. I managed to display my video into a SurfaceView, by giving my Surface (retrieved from SurfaceView.SurfaceHolder.getSurface() , but I now need to connect it with the Google Cardboard. If I do not mistake, Google Cardboard relies on some SurfaceTexture. So I thought it would be easy to simply get the Surface from the

GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT when trying to attach texture

妖精的绣舞 提交于 2019-12-20 18:29:43
问题 I get an error GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT after I try to create a framebuffer that renders to a texture. I can't figure out what is wrong, any help is greatly appreciated. Edit: Fixed it! Working code: glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf