Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - soupStand

Pages: [1]
1
Graphics / SFML and Shaders
« on: November 18, 2022, 06:59:09 pm »
I have a bit of a conundrum... using some old shaders I made long time ago with c++ and openGL, and trying to get them to work with SFML now...
I get this strange thing, when I use the background as the shader effect, but it only shows on 1/4 of the screen, but apparently it works.
Trying to troubleshoot why not full screen :D so... i'm wondering how to get the current window's boundaries..? something something getglobalbounds() ?
Thinking of sending the window boundaries to the shader and see if I can affect it... not even sure if this shrinking shader bug is in shaders itself or the c++ code :D

I am using this game example from a book, the game is called Thomas was Late and the book is Beginning C++ Game Programming that deals with SFML, C++ and just a little bit with GLSL.
There is a split screen option in the game but not sure how it would affect the shader to take only this quarter of a screen...?
Sorry, but it's really baffling me :D

Another thing, in general... How do you get the position sent to the shaders in SFML?
I haven't seen any good tutorial on it yet.
Like in "proper" openGL you usually use in vertex shader:

layout (location = 0) in vec3 aPos;

void main()
{
   gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);
}

but I'm not sure if this works in SFML like that?
All the examples I've seen use deprecated 1.0 stuff, that is really old.
I mean I try to use 3.3 core, and even that's old, but at least it's a bit modern...

Pages: [1]
anything