SFML community forums
General => Feature requests => Topic started by: xfixium on May 19, 2014, 11:36:05 pm
-
Hello everyone! First off, I have recently switched from my home brew implementation of OpenGL to SFML. I just retrofitted a c# application I have been working on for some time with SFML libraries. (https://gmare.codeplex.com/) I must admit, everything went very smoothly in the transition, plus it runs much faster, which is awesome.
More to the point. My map application draws lines that use a stipple pattern. I use the stipple pattern for a "marching ants" selection rectangle and for the grid lines on the designer. I was wondering if this feature could somehow be implemented?
I have done a search, but found nothing on this topic.
-
This feature sounds very specific and not like something that must be part of the core library.
I have not used stipple patterns before, but isn't it possible to create the resulting curve using the existing API? Have you researched how this is usually implemented?
-
The way I implemented it prior was just to use glEnable(GLOption.LineStipple). This was through a c# OpenGL wrapper I used. So basically using OpenGL's built-in functionality. However, after reading through some things on the internet just now, it seems it has been depreciated since OpenGL3.1. :-\
-
If I understand stippling correctly, you can replicate the effect by making several smaller lines or applying a texture to a single line. https://stackoverflow.com/questions/1937444/drawing-stippled-lines-using-opengl-es seems to go into a bit more detail. Either way it'll be far more flexible than the old line stippling.
-
Thank you for the suggestion, but I fail to see how it's more flexible. If anything, the methods described are more involved. The cool thing about the stipple pattern is all you have to do is assign some bits that represented the stipple pattern (Which is customizable to whatever you like). Which meant you could animate it as well by shifting the bits on a timer. Draw a solid white line or rectangle underneath, and bam, Marching ants selection style.
-
Being more involved is not the opposite of being more flexible. In any good API, the complex approach is always the more flexible one.
With more modern methods you could easily do everything you just described along with segments that smoothly fade out or are partially transparent or have different colors or fuzzy edges and all sorts of other things.
-
The cool thing about the stipple pattern is all you have to do is assign some bits that represented the stipple pattern (Which is customizable to whatever you like). Which meant you could animate it as well by shifting the bits on a timer. Draw a solid white line or rectangle underneath, and bam, Marching ants selection style.
I can't test things right now, but this sounds exactly what has been said in the SO answer above.
Use a sf::VertexArray and set the texture coordinates to a specific texture with a stripe pattern and then draw the line and pass the texture.
-
I don't need an answer. ;) The texture route was always an obvious option, this is not my first rodeo. This is a feature request, which I'm guessing will never happen because of its non-existence in ES, and the depreciation of it in OpenGL. But I thank you anyway.
I believe there has been some talk about clipping rectangle, that would be a good feature as well. At least from an application stand point, not so much a game engine one.