Quantcast
Channel: arm - openFrameworks
Viewing all articles
Browse latest Browse all 364

Shader example not working on Raspberry Pi 3

$
0
0

@sandufi wrote:

Hello guys,

anyone got working straight out of the box the shader example 09_gaussianBlurFilter on a Raspberry Pi? I don’t get any errors after doing the “make” and “make run”. However, I just get an empty grey window. I am interested in this example as it is a starting point from a project I will develop. I got working the first shader example 01_simpleColorQuad so all seems to be set up correctly. I have done the proper changes on the main.cpp as well as on the config.make file! (running on Raspbian Stretch) Here I paste the output:

pi@raspberrypi:~/openFrameworks/examples/shader/09_gaussianBlurFilter $ make run
HOST_OS=Linux
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal libcurl glfw3 rtaudio gtk+-3.0 
with PKG_CONFIG_LIBDIR=
[warning] ofAppEGLWindow: init(): X11 not availble on RPI yet, using a native window instead
[notice ] ofAppEGLWindow: setupRPiNativeWindow(): screenRect: 1920x1080
[notice ] ofAppEGLWindow: setupRPiNativeWindow(): windowRect: 1024x768
[notice ] ofAppEGLWindow: createSurface(): setting up EGL Display
[notice ] ofAppEGLWindow: createSurface(): EGL Display correctly set 0x1
[notice ] ofAppEGLWindow: createSurface(): no current renderer selected
[notice ] ofAppEGLWindow: createSurface(): GLES2 renderer detected
[notice ] ofAppEGLWindow: createSurface(): surface created correctly
[notice ] ofAppEGLWindow: createSurface(): API bound correctly
[notice ] ofAppEGLWindow: createSurface(): -----EGL-----
[notice ] ofAppEGLWindow: createSurface(): EGL_VERSION_MAJOR = 1
[notice ] ofAppEGLWindow: createSurface(): EGL_VERSION_MINOR = 4
[notice ] ofAppEGLWindow: createSurface(): EGL_CLIENT_APIS = OpenGL_ES OpenVG
[notice ] ofAppEGLWindow: createSurface(): EGL_VENDOR = Broadcom
[notice ] ofAppEGLWindow: createSurface(): EGL_VERSION = 1.4
[notice ] ofAppEGLWindow: createSurface(): EGL_EXTENSIONS = EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_vg_parent_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_lock_surface 
[notice ] ofAppEGLWindow: createSurface(): GL_RENDERER = VideoCore IV HW
[notice ] ofAppEGLWindow: createSurface(): GL_VERSION  = OpenGL ES 2.0
[notice ] ofAppEGLWindow: createSurface(): GL_VENDOR   = Broadcom
[notice ] ofAppEGLWindow: createSurface(): -------------
[notice ] ofAppEGLWindow: setupPeripherals(): peripheral setup complete
[notice ] ofAppEGLWindow: setupNativeUDev(): created udev object
[notice ] ofAppEGLWindow: setupMouse(): mouse_fd=5 devicePath=/dev/input/by-path/platform-3f980000.usb-usb-0:1.1.2:1.2-event-mouse
[notice ] ofAppEGLWindow: setupMouse(): mouse device name = Microsoft Microsoft Nano Transceiver 1.1
[ error ] ofAppEGLWindow: ioctl GABS failed
[ error ] ofAppEGLWindow: ioctl GABS failed
[notice ] ofAppEGLWindow: setupKeyboard(): keyboard_fd=6 devicePath=/dev/input/by-path/platform-3f980000.usb-usb-0:1.1.2:1.0-event-kbd
[notice ] ofAppEGLWindow: setupKeyboard(): keyboard device name = Microsoft Microsoft Nano Transceiver 1.1
[notice ] ofAppEGLWindow: setupPeripherals(): native event setup complete
[warning] ofShader: GL_VERTEX_SHADER shader reports:
Compiled
[warning] 
precision highp float;
#define IN attribute
#define OUT varying
#define TEXTURE texture2D
#define TARGET_OPENGLES
uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform mat4 textureMatrix; uniform mat4 modelViewProjectionMatrix; uniform float usingTexture; uniform float usingColors; uniform vec4 globalColor; IN vec4 position; IN vec4 color; IN vec4 normal; IN vec2 texcoord; OUT vec4 colorVarying; OUT vec2 texCoordVarying; void main(){ gl_Position = modelViewProjectionMatrix * position; if(usingTexture>.5) texCoordVarying = (textureMatrix*vec4(texcoord.x,texcoord.y,0,1)).xy; if(usingColors>.5) colorVarying = color; else colorVarying = globalColor; }

[warning] ofShader: GL_FRAGMENT_SHADER shader reports:
Compiled
[warning] 
precision highp float;
#define IN varying
#define OUT
#define TEXTURE texture2D
#define FRAG_COLOR gl_FragColor
#define TARGET_OPENGLES
uniform sampler2D src_tex_unit0; uniform float usingTexture; uniform float bitmapText; IN vec4 colorVarying; IN vec2 texCoordVarying; void main(){ vec4 tex; if(usingTexture>.5){ tex = TEXTURE(src_tex_unit0, texCoordVarying); if(bitmapText>.5 && tex.a < 0.5){ discard; }else{ FRAG_COLOR = colorVarying*tex; } }else{ FRAG_COLOR = colorVarying; } }

[warning] ofShader: GL_VERTEX_SHADER shader reports:
Compiled
[warning] 
uniform mat4 modelViewProjectionMatrix;

attribute vec4 position;
attribute vec2 texcoord;

varying vec2 texCoordVarying;

void main()
{
    texCoordVarying = texcoord;
	gl_Position = modelViewProjectionMatrix * position;
}

[warning] ofShader: GL_FRAGMENT_SHADER shader reports:
Compiled
[warning] 
precision highp float;

uniform sampler2D tex0;

uniform float blurAmnt;

varying vec2 texCoordVarying;

// Gaussian weights from http://dev.theomader.com/gaussian-kernel-calculator/

void main()
{
	vec4 color = vec4(0.0, 0.0, 0.0, 0.0);

	color += 0.000229 * texture2D(tex0, texCoordVarying + vec2(blurAmnt * -4.0, 0.0));
	color += 0.005977 * texture2D(tex0, texCoordVarying + vec2(blurAmnt * -3.0, 0.0));
	color += 0.060598 * texture2D(tex0, texCoordVarying + vec2(blurAmnt * -2.0, 0.0));
	color += 0.241732 * texture2D(tex0, texCoordVarying + vec2(blurAmnt * -1.0, 0.0));

	color += 0.382928 * texture2D(tex0, texCoordVarying + vec2(0.0, 0));

	color += 0.241732 * texture2D(tex0, texCoordVarying + vec2(blurAmnt * 1.0, 0.0));
	color += 0.060598 * texture2D(tex0, texCoordVarying + vec2(blurAmnt * 2.0, 0.0));
	color += 0.005977 * texture2D(tex0, texCoordVarying + vec2(blurAmnt * 3.0, 0.0));
	color += 0.000229 * texture2D(tex0, texCoordVarying + vec2(blurAmnt * 4.0, 0.0));
    
    gl_FragColor = color;
}

[warning] ofShader: GL_VERTEX_SHADER shader reports:
Compiled
[warning] 
uniform mat4 modelViewProjectionMatrix;

attribute vec4 position;
attribute vec2 texcoord;

varying vec2 texCoordVarying;

void main()
{
    texCoordVarying = texcoord;
	gl_Position = modelViewProjectionMatrix * position;
}

[warning] ofShader: GL_FRAGMENT_SHADER shader reports:
Compiled
[warning] 
precision highp float;

uniform sampler2D tex0;

uniform float blurAmnt;

varying vec2 texCoordVarying;

// Gaussian weights from http://dev.theomader.com/gaussian-kernel-calculator/

void main()
{
	vec4 color = vec4(0.0, 0.0, 0.0, 0.0);

	color += 0.000229 * texture2D(tex0, texCoordVarying + vec2(0.0, blurAmnt * 4.0));
	color += 0.005977 * texture2D(tex0, texCoordVarying + vec2(0.0, blurAmnt * 3.0));
	color += 0.060598 * texture2D(tex0, texCoordVarying + vec2(0.0, blurAmnt * 2.0));
	color += 0.241732 * texture2D(tex0, texCoordVarying + vec2(0.0, blurAmnt * 1.0));

	color += 0.382928 * texture2D(tex0, texCoordVarying + vec2(0.0, 0.0));

	color += 0.241732 * texture2D(tex0, texCoordVarying + vec2(0.0, blurAmnt * -1.0));
	color += 0.060598 * texture2D(tex0, texCoordVarying + vec2(0.0, blurAmnt * -2.0));
	color += 0.005977 * texture2D(tex0, texCoordVarying + vec2(0.0, blurAmnt * -3.0));
	color += 0.000229 * texture2D(tex0, texCoordVarying + vec2(0.0, blurAmnt * -4.0));
	
    color /= 25.0;
    
    gl_FragColor = color;
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 364

Trending Articles