My code displays a fully transparent window that copies the background from the operating system.

Window copies the OS background rendering

This is the code I use for rendering:

void render()
    SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
    SDL_RenderDrawRect(renderer, &background);

And this is the code I use to create my window:

window = SDL_CreateWindow("title", posX, posY, windowWidth, windowHeight, SDL_WINDOW_OPENGL);
  • \$\begingroup\$ There are some issues with this question: the issue at hand is badly described, could you post some screenshots of the issue? It's not clear in the description what you're trying to achieve. There seems to be a lot of unnecessary code; trim that down to only what's important for the question. -- Please edit the question. \$\endgroup\$
    – Vaillancourt
    Commented Mar 6, 2016 at 13:37

1 Answer 1


The problem is that you are passing the SDL_WINDOW_OPENGL flag to your window in SDL_CreateWindow, but then you are using the SDL_Renderer for rendering. You need to remove the flag for SDL_Renderer to function properly.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .