I would like to render a 2D texture composed of horizontal and/or vertical lines in a polar coordinate space such that horizontal lines become concentric circles and vertical lines become radii.
I had everything working great using arcs and 1D textures and having the texture repeat (e.g. only horizontal lines) and this worked very well for concentric circles. Since going to a 2D texture with both H and V stripes a lot has changed and I can’t get the radii. What I would like is something like this, where I would just rotate a thinner triangle around a pivot:
I tried overlapping two vertices and tinkering with texcoords and I just end up with this:
I can’t get any kind of ‘pinch’ where stripes get closer together on one side of the triangle and further apart in the other side. Note, I’m doing all of this in 2D and I can imagine there could be some work-around using 3D and perspective, but I’d rather avoid that…
Here is a snippet of my attempt:
ofPath circleSection; circleSection.moveTo(0, 0); circleSection.lineTo(900, 0); circleSection.lineTo(900, 450); circleSection.lineTo(0, 0); circleSection.close(); ofMesh circleSectionMesh = circleSection.getTessellation(); // Convert path to mesh. circleSectionMesh.addTexCoord( ofVec2f(0, layerWidth) ); // 0 circleSectionMesh.addTexCoord( ofVec2f(layerWidth, 0) ); // 1 circleSectionMesh.addTexCoord( ofVec2f(layerWidth, layerWidth) ); // 2 circleSectionMesh.addTexCoord( ofVec2f(0, 0) ); // 3 layers.getTexture().bind(); circleSectionMesh.draw(); layers.getTexture().unbind();