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.

Topics - 6Peppered9

Pages: [1]
General / SFML Color bug for transparent windows with nvidia gpu
« on: May 14, 2021, 11:25:33 am »
3 years ago i posted a question how to make the window background transparent.
link: https://en.sfml-dev.org/forums/index.php?topic=24697.msg165592#msg165592

The user "texus" hacked some code in the SFML source to work around.

This works fine on Intel GPUs, but on Nvidia GPUs it seems that everything (colors, textures, etc) is drawing with an alpha channel and looks semi transparent

Is there a way to fix this?
I'm not familiar with the xlib API but it i think it can be a problem in the nvidia driver.

My 2 question is how other libs like qt or gtk do this?
And why is there not the possibility to create transparent windows in SFML?

Graphics / Problem to set cursor image
« on: October 05, 2020, 10:44:41 pm »
i'm trying to change the cursor image using sf::Cursor loadFromPixels (...).

It compiles without problems, but the result shows strange white lines in the cursor.
Im using the latest Ubuntu version.

My Code:
#include "CPP.hpp"
#include "SFML.hpp"

int main(int argc, char const *argv[])
        sf::RenderWindow renderWindow(sf::VideoMode(900, 600, 32), "cur", sf::Style::None);

        sf::Image curimg;
        sf::Cursor cur;
        cur.loadFromPixels(curimg.getPixelsPtr(), curimg.getSize(), sf::Vector2u(0,0));

        while(renderWindow.isOpen()) {
                sf::Event event;
                        if(event.type == sf::Event::Closed)


        return 0;

In the attachment you can find the image that i used.

I think it remains to the warning in the documentation https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1Cursor.php#ac24ecf82ac7d9ba6703389397f948b3a

On Unix, the pixels are mapped into a monochrome bitmap: pixels with an alpha channel to 0 are transparent, black if the RGB channel are close to zero, and white otherwise.

But i dont know how to fix this, or is there a workaround?


Window / application generates multiple key release event
« on: March 12, 2019, 04:39:30 am »

I'm dealing with the sfml events and have a problem that my application generates several KeyReleased events.

My pollEvent loop

while(rootWindow->pollEvent(event)) {
    for(auto it : drawStack) {
        if(it->eventable) {


drawStack is a stack of pointers of objects that I want to draw on the screen.
The polled event should be forwarded to the respective objects, which then decide what happens.


void handleEvent(sf:: Event) {
    switch(event.type) {
        case sf::Event::KeyReleased:
            cout << "obj 1 KeyReleased" << endl;


everything works as long as there is only one object on the stack.
But with two objects on the stack I get such an output:
obj 1 KeyReleased
obj 2 KeyReleased
obj 2 KeyReleased
obj 2 KeyReleased
obj 2 KeyReleased
obj 2 KeyReleased

This is what i want:
obj 1 KeyReleased
obj 2 KeyReleased

is my procedure right?
Is there another way to do it?
Or did I not understand sf :: Event?

General / Need help to change the mouse cursor
« on: December 02, 2018, 01:33:30 pm »
I want to change my mouse pointer in my SFML application. (using SFML 2.5.1 on Linux)

I have used the following steps from the documentation:
sf::Cursor cursor;
cursor.loadFromPixels(image.getPixelsPtr(), image.getSize(), {0, 0});

The image I want to use as a mouse pointer is a red rectangle in PNG format

When I start the application, the mouse pointer is rendered strange.

Instead of the white lines, the mouse pointer should normally be displayed.

Do I lose any data when loading the image, so I get such an output?

General discussions / Change mouse cursor image
« on: November 29, 2018, 01:10:33 am »
Hello, i want to change my mouse cursor in my sfml window.

Using C++ SFML 2.5.0 on Linux.

This is the image that i want to set as cursor:

(Red Rectangle)

cursor.loadFromPixels(image.getPixelsPtr(), image.getSize(), {0,0});

but if i run the application it looks strange:

what i need to do to fix it?


Window / SFML: Transparent Window Background?
« on: October 31, 2018, 01:02:32 am »

I have a normal window with SFML (C ++) and I want to render the background of the window (not its content) transparent, e.g. can change the alpha channel.

Since the rendering of the window is the window manager's task and I do not have a direct way to change the window properties directly via SFML, I go back to X11 and tried the following:


I'm not really familiar with the Xlib.

The problem is that I use the above method to make the entire window transparent (including the contents of the window).

Does anyone know a way to make only the background of the window transparent? I would be very happy about code examples. ?

Thank you.

Pages: [1]