Yo! This might more be of a brainstorming/discussion than an actual feature request.
As some might know there is an upcoming huge change to the Graphics module where it will include Vertex Shader capability to SFML.
If using a Vertex Shader it would for us be possible to create 3D graphics in SFML without actually concerning ourselves with any OpenGL stuff at all more than the language GLSL. the main requirements would be a vertex shader that looks something like this I guess:
uniform mat4 toWorldSpace;
uniform mat4 toViewSpace;
uniform mat4 projection;
// I know OpenGL has ModelView matrix instead of separating
// it into two seperate but I'm writing with what I am comfortable with.
void main() {
vec4 vertex = gl_Vertex
vertex *= toWorldSpace;
vertex *= toViewspace;
vertex *= projection
gl_Position = vertex;
}
Have never used GLSL so somethings might be wrong but the math should be the same as my software renderer and as in HLSL.
Though this requires us to be able to pass 3D vertexes to OpenGL to use it which SFML at the moment don't support and I don't expect it to either since it's a 2D library.
Also from what I know using a Shader makes most of the states in OpenGL unused unless you use it in your own Shader. So from my point of view and the knowledge I got of OpenGL is that it would make it possible for us to generate 3D graphics with SFML, no custom OpenGL calls and no need of maintaining the state machine right?
My feature request is that somehow be able to pass on 3D vertexes to OpenGL trough SFML. Maybe by defining a custom drawable and have the sf::Renderer extended to take in 3D coordinates instead of only 2D for placing a vertex? This request is not related with:
http://www.sfml-dev.org/forum/viewtopic.php?t=5729 What I want is the possibility to create 3D graphics using only SFML, no custom OpenGL and no change in how the drawing interface works now or will work after the change.
Note even if Laurent decides no he don't want this, I still won't give up I'll try and hack something together as an extension that will first be available for rbSFML and then C++ :twisted: One of the reasons I want this is because I have trouble getting ruby-opengl installed on my Windows machine and this would make things SO much simpler.
Anyone else that might have more experience with 3D and OpenGL/Shaders than me that might be able to give more detailed information?