Can't set glPointSize or mesh mode iOS

Hi all, I’m trying to take a polyline and convert it to a mesh, using ofxiOS.

Simply, in my draw() function, I iterate through the points of my polyline and add each vertex to an ofMesh. No matter what I set the mesh.setMode() to, the meshMode doesn’t change. I’m also unable to define point size using glPointSize().

ofMesh tempMesh;
tempMesh.setMode(OF_PRIMITIVE_POINTS);

            for (int i = 0; i < contourFinder.size(); i++){
                ofPolyline tempPoly = contourFinder.getPolyline(i);
                for (int x = 0; x < tempPoly.size(); x++){
                    tempMesh.addColor(newColor);
                    tempMesh.addVertex(tempPoly[x]);
                }

}

Above code is done in draw(). When I draw tempMesh, nothing shows up. If I remove tempMesh.setMode(OF_PRIMITIVE_POINTS), the mesh is drawn, although it is not primitive points, and my glPointSize() function does not change the points, despite it being placed in my setup(), draw(), and update() functions.

Any ideas as to why this is happening?

1 Like

I think there is no glPointSize() for OpenGL ES. You should use shader to control the point size.

1 Like

There is an example on how to do this on iOS with a shader: examples⁩ ▸ ⁨gl⁩ ▸ ⁨pointsAsTexturesExample⁩ ▸ ⁨bin⁩ ▸ ⁨data⁩ ▸ ⁨shaders_gles.

2 Likes

@Dorald Thank y’all both! Works!