Hi,
I'm porting some work to SFML - I need to apply fullscreen shaders to the entire window render area, instead of just a texture rectangle. I see you can draw shaders by specifying vertices, but after trying:
const SF::Vertex vertices[] = { SF::Vertex(SF::Vector2f(-1.0f, 1.0f)), SF::Vertex(SF::Vector2f(1.0f, 1.0f)), SF::Vertex(SF::Vector2f(1.0f, -1.0f)), SF::Vertex(SF::Vector2f(-1.0f, -1.0f)) };
target.draw(&vertices[0], 4, SF::PrimitiveType::Quads, states);
1. I found it doesn't use normalized coords - how can I therefore draw to the entire window render area efficiently (do I really have to recreate 4 vertices from the app size each frame)?
2. I need to use "uniform mat4" for several of my shaders. Do I just do it manually with glUniformMatrix4fv(..., 1, GL_FALSE, &viewMatrix[0][0]); ?
3. I was looking at the code, I noticed setParameter is called in the update loop, which implicitly does: GLint location = glGetUniformLocationARB(m_shaderProgram, name.c_str()); - isn't this slow when you have quite a lot of parameters? What about providing a int getFastParamID(...) to call in init, then instead of having strings force users who don't care about optimizations to do setParameter(getID("name"), ...) - but this allows users who do care about performance to just send the private GLint from the init - do you think this'll make much difference? (I don't know much about the framework/principles/conventions in SFML yet though so may have missed something)
4. (Offtopic) Is there an easy way to use subpixel font rendering/expose it from freetype? - I haven't looked into this yet.
- P.S. Thanks so much for keeping SFML lightweight! :wink: I was very happy to see the output size, with static linking, so small.