Saturday, February 11, 2012

SharedBuffer

First things first. I want to find out how to share buffer between CPU and GPU, so that I can control the GPU filter parameters "live". Nvidia guys supposedly provided an example that demonstrates this. I was able to run the program. Let's see if I can dissect it.

NB: The second shader "ridge.frag" uses two source textures. Great for image fusion!

Here are the input and output images (feature.frag and ridge.frag) provided:

Timo's fixed vertex shader ("FULLSCREEN_QUAD_VERTEX_SHADER"), in readable form:

attribute mediump vec2 pos_attr
attribute mediump vec2 uv_attr
varying mediump vec2 outUV0

void main()
{
gl_Position = vec4(pos_attr,0.0,1.0);
outUV0 = uv_attr;
}

* * *

What is EGL? "EGL is an API for giving direct control over creation of OpenGL contexts that render to on-screen windows, offscreen pixmaps, or additional graphics-card memory."

To get the example (written by Timo Stich at Nvidia) ported to FCam environment:
  1. Copy over the libraries from the tablet to NDK as per Timo's instructions. (Slight typo in his filenames.)
  2. Merge Timo's makefile configuration 'Android.mk' to the FCam project you are working on. In particular, link 'cutils.so'.
With these steps, it should now be possible to declare SharedBuffer and the shader-related functions from the FCam source.

Also might be an interesting read:

No comments:

Post a Comment