opengl-es-2.0

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

你说的曾经没有我的故事 提交于 2019-12-06 01:20:18
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); glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,texture,0); checkGlError("FBO

Sprite quads & depth testing correctly in OpenGL ES 2

冷暖自知 提交于 2019-12-06 00:03:46
I am trying to render 2D (flat) sprites in a 3D environment using OpenGL ES 2. The way I create each sprite is pretty standard: I create a quad consisting of two triangles, and I map the texture onto that. Everything works fine, except I noticed something strange: when depth testing is turned on (which it should be in 3D mode), the corners of my sprites are painted using the background color. The easiest way to show this is by illustration: When I turn off depth testing (on the left) it looks fine, but when I turn it on (on the right) you can see the green sprite's rectangle overlapping on top

OpenGL ES 2.0 Multiple shader programs - texture rendering not working anymore

别来无恙 提交于 2019-12-05 21:19:18
My app draws a mixture of point sprites and standard quad textures. Until recently, I was using a single shader program for this - however a branch in the fragment shader (to decide whether to use point sprite coords/colors) was seriously throttling the performance of my rendering. My fragment shader originally looked like this: precision highp float; uniform sampler2D u_textureSprite; uniform bool u_isSprite; varying vec4 v_color; varying vec2 v_textureCoord; void main() { vec4 textureColor = texture2D(u_textureSprite, u_isSprite ? gl_PointCoord : v_textureCoord); if (u_isSprite) { gl

Fatal signal 11 and INVALID HEAP ADDRESS IN dlfree error when using glShaderBinary

≯℡__Kan透↙ 提交于 2019-12-05 21:06:23
Device : Samsung Galaxy Note Android version: 4.0.4 My application apply some visual effects to a video stream using OpenGL Shaders. I need to use binary shaders for security reasons. I am using glSurfaceView and SurfaceTexture to access the frame data in OpenGL shaders and using the extension GL_OES_EGL_image_external . This is working fine as far as I am using shader source. When I try to use compiled shader binaries I often get an error A/libc(4242): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1) and the program crashes. When It is working when I try to close the app with back key I

EGL linker errors

感情迁移 提交于 2019-12-05 20:20:53
I'm trying to link a really simple GLES2 & EGL program using g++ 4.9.1, on a Ubuntu Trusty system. I'm using the mesa libraries. I'm getting linker errors for EGL functions: test.cpp:(.text+0x342): undefined reference to `eglGetDisplay' test.cpp:(.text+0x389): undefined reference to `eglInitialize' test.cpp:(.text+0x40f): undefined reference to `eglCreateContext' test.cpp:(.text+0x458): undefined reference to `eglCreatePbufferSurface' test.cpp:(.text+0x49e): undefined reference to `eglMakeCurrent' I am compiling test.cpp with g++ -std=c++0x -Wall -Werror -lEGL -lGLESv2 -o test test.cpp I've

Can you write to a Unity texture, from an iOS C plugin, “on the spot”?

眉间皱痕 提交于 2019-12-05 19:48:47
Say you have a low-level Unity plugin for iOS, So in c# using System.Runtime.InteropServices; using AOT; public class Teste: MonoBehaviour { [DllImport("__Internal")] private static extern void set_texture_from_unity(System.IntPtr texture, int w, int h); have a texture, .Apply() it, and then send the pointer to the native iOS plugin: public void ClickPassTexture() { tex = new Texture2D(256, 256, TextureFormat.ARGB32, false); tex.filterMode = FilterMode.Point; tex.Apply(); // ACTUALLY UPLOAD TO GPU someMaterial.mainTexture = tex; set_texture_from_unity( tex.GetNativeTexturePtr(), tex.width, tex

Issue getting gradient square in glsl es 2.0, Gamemaker Studio 2.0

大兔子大兔子 提交于 2019-12-05 18:38:47
I made a triangle list with 4 triangles, having the middle point a different color. And then aim to combine the triangles to get a nice gradient. But the edges of the triangles create unwanted lines, I don't want these lines I want it to be smooth al the way. How can I get the desired result? Images: Shader Code: // Simple passthrough vertex shader // attribute vec3 in_Position; // (x,y,z) attribute vec4 in_Colour; // (r,g,b,a) attribute vec2 in_TextureCoord; // (u,v) varying vec2 v_texcoord; varying vec4 v_colour; void main() { vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in

WebGL debug tools?

痴心易碎 提交于 2019-12-05 18:36:24
I am looking for WebGL debug and inspection tools - something like FireBug for WebGL. Any recommendations? Just found WebGL Inspector. It claims to be an advanced WebGL debugging toolkit. I haven't personally tried it yet. http://benvanik.github.com/WebGL-Inspector/ As mentioned above WebGL-Inspector is a tool, allowing you to analyze textures and buffers passed into shader programs. For low-level issues advanced tools are necessary which track driver API calls, memory consumption etc. Depending on the used OS you can use OpenGL/DirectX Debuggers and attach them to your browser. WebGL

In OpenGL ES 2.0, how can I draw a wireframe of triangles except for the lines on adjacent coplanar faces?

最后都变了- 提交于 2019-12-05 15:37:51
I vaguely remember seeing something in OpenGL (not ES, which was still at v1.0 on the iPhone when I came across this, which is why I never used it) that let me specify which edges of my polygons were considered outlines vs those that made up the interior of faces. As such, this isn't the same as the outline of the entire model (which I know how to do), but rather the outline of a planar face with all its tris basically blended into one poly. For instance, in a cube made up of tri's, each face is actually two tris. I want to render the outline of the square, but not the diagonal across the face

Reasonable texture sizes in android

随声附和 提交于 2019-12-05 14:47:25
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 images as large as 1024x1024, but what about 2048x2048? (Again, etc1 compression, so it's about 2 MB