ofMesh::drawVertices() on GLES?

I’m not seeing anything when trying to drawVertices() from a mesh on Raspberry Pi.


ofGLESWindowSettings settings;
settings.glesVersion = 2;
ofRunApp(new ofApp());

02_simpleVertexDisplacement example

with plane.drawVertices() instead of plane.drawWireframe() in ofApp::draw()

this is with legacy GL drivers and of_v0.10.0RC3_linuxarmv6l_release

Basically, I’m trying to use a vertex shader to do vertex displacement on a point cloud…
how can I do this on Raspberry Pi (3 B+)?

Are you getting any errors logged? The rPi shaders can be a bit finicky, due to some configs.

Check here if it helps:

Sorry - was away from the Pi for a bit, so just tested again.

Now I’m trying to run ‘of_v0.10.0RC3_linuxarmv6l_release/examples/3d/pointCloudExample’ (which manually creates a point cloud in setup(), then draws it without any extra shaders).

If I use the default main.cpp:

ofSetupOpenGL(1024,768, OF_WINDOW);
ofRunApp( new ofApp());

it works.

But if instead I try to run with GLES v2:

ofGLESWindowSettings settings;
settings.glesVersion = 2;
ofRunApp( new ofApp());

I see no points.

I also get [warning] msgs about the default shaders in the console, but the messages have no content…?

$ make RunRelease
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 libmpg123 
[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 = Logitech M705
[ 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.2-event-kbd
[notice ] ofAppEGLWindow: setupKeyboard(): keyboard device name = Logitech K520
[notice ] ofAppEGLWindow: setupPeripherals(): native event setup complete
[warning] ofShader: GL_VERTEX_SHADER shader reports:
precision highp float;
#define IN attribute
#define OUT varying
#define TEXTURE texture2D
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:
precision highp float;
#define IN varying
#define OUT
#define TEXTURE texture2D
#define FRAG_COLOR gl_FragColor
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; } }

[notice ] ofAppEGLWindow: destroyNativeKeyboard()
[notice ] ofAppEGLWindow: destroySurface(): destroying EGL surface

Ok, I think I figured it out.
The vertex shader needs:

gl_PointSize = 1.0; // or whatever point size

in GLES to draw point clouds (GL_POINTS) properly.
(Maybe otherwise it’s drawing 0-sized points?)

Perhaps that line should be added to the default vertex shader for GLES…?

ps. the fact that ofShader seems to report a [warning] when compiling successfully is pretty confusing