Passing a variable to an OpenGL GLSL shader

One option is to pass information via uniform variables. After glUseProgram(myShaderProgram); you can use GLint myUniformLocation = glGetUniformLocation(myShaderProgram, “myUniform”); and for example glUniform1f(myUniformLocation, /* some floating point value here */); In your vertex or fragment shader, you need to add the following declaration: uniform float myUniform; That’s it, in your shader you can now access … Read more

How can I improve the performance of my custom OpenGL ES 2.0 depth texture generation?

Based on the recommendations by Tommy, Pivot, and rotoglup, I’ve implemented some optimizations which have led to a doubling of the rendering speed for the both the depth texture generation and the overall rendering pipeline in the application. First, I re-enabled the precalculated sphere depth and lighting texture that I’d used before with little effect, … Read more

OpenGL ES iPhone – drawing anti aliased lines

One can achieve the effect of anti aliasing very cheaply using vertices with opacity 0. Here’s an image example to explain: Comparison with AA: You can read a paper about this here: http://research.microsoft.com/en-us/um/people/hoppe/overdraw.pdf You could do something along this way: // Colors is a pointer to unsigned bytes (4 per color). // Should alternate in … Read more

Modifying camera output using SurfaceTexture and OpenGL

mDirectVideo = new DirectVideo(texture); texture = createTexture(); should be texture = createTexture(); mDirectVideo = new DirectVideo(texture); Shader private final String vertexShaderCode = “attribute vec4 position;” + “attribute vec2 inputTextureCoordinate;” + “varying vec2 textureCoordinate;” + “void main()” + “{“+ “gl_Position = position;”+ “textureCoordinate = inputTextureCoordinate;” + “}”; private final String fragmentShaderCode = “#extension GL_OES_EGL_image_external : require\n”+ … Read more

OpenGL vs OpenGL ES 2.0 – Can an OpenGL Application Be Easily Ported?

It’s been about three years since I was last doing any ES work, so I may be out of date or simply remembering some stuff incorrectly. No, targeting OpenGL for desktop does not equal targeting OpenGL ES, because ES is a subset. ES does not implement immediate mode functions (glBegin()/glEnd(), glVertex*(), …) Vertex arrays are … Read more

OpenGL ES 2.0 Extensions on Android Devices [closed]

Motorola Xoom Vendor:NVIDIA Corporation Driver:OpenGL ES 2.0 Render:NVIDIA Tegra NV_platform_binary OES_rgb8_rgba8 OES_EGL_sync OES_fbo_render_mipmap NV_depth_nonlinear NV_draw_path NV_texture_npot_2D_mipmap OES_EGL_image OES_EGL_image_external OES_vertex_half_float NV_framebuffer_vertex_attrib_array NV_coverage_sample OES_mapbuffer ARB_draw_buffers EXT_Cg_shader EXT_packed_float OES_texture_half_float OES_texture_float EXT_texture_array OES_compressed_ETC1_RGB8_texture EXT_texture_compression_latc EXT_texture_compression_dxt1 EXT_texture_compression_s3tc EXT_texture_filter_anisotropic NV_get_tex_image NV_read_buffer NV_shader_framebuffer_fetch NV_fbo_color_attachments EXT_bgra EXT_texture_format_BGRA8888 EXT_unpack_subimage

How do I “subtract” a color filter using GPUImageLibrary?

Color matrix is the entity that defines new color component values for some pixel as linear functions of the current color components of the same pixel. I.e. the only input for color matrix conversion is the pixel, which colors should be transformed. There is no way to involve another pixels to such conversion. Regardless if … Read more

OpenGL extensions available on different Android devices [closed]

OpenGL ES extensions on HTC G1 (Android 1.6): GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_mirrored_repeat GL_ARB_vertex_buffer_object GL_ATI_extended_texture_coordinate_data_formats GL_ATI_imageon_misc GL_ATI_texture_compression_atitc GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_stencil_wrap GL_OES_byte_coordinates GL_OES_compressed_paletted_texture GL_OES_draw_texture GL_OES_fixed_point GL_OES_matrix_palette GL_OES_point_size_array GL_OES_point_sprite GL_OES_read_format GL_OES_single_precision GL_OES_vertex_buffer_object GL_QUALCOMM_vertex_buffer_object GL_QUALCOMM_direct_texture OpenGL ES version on HTC G1 (Android 1.6): OpenGL ES 1.0-CM I’m including the version as retrieved by: gl.glGetString(GL10.GL_VERSION) It’s pretty interesting … Read more