Forum > Games

SDL2 Software_Render

(1/1)

mosquito:

I want to run a window with a simple "Hello World" in SDL2, that doesn't touch the GPU. According to the documentation, I create the Render like this:



--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- //initilization of video subsystem  if SDL_Init(SDL_INIT_VIDEO) < 0 then Halt;    // full set up    sdlWindow1 := SDL_CreateWindow('Window1', 50, 50, 500, 500, SDL_WINDOW_SHOWN);    if sdlWindow1 = nil then Halt;      sdlRenderer := SDL_CreateRenderer(sdlWindow1, -1, SDL_RENDERER_SOFTWARE);     if sdlRenderer = nil then Halt;   

But the window in question takes up 15-20% of my GPU, like any other hardware accelerated SDL2 window.


I'm on Debian12 with I3WM.
* I know I can force software rendering on Linux with environment variables, but that's not what I'm looking for


Thank you so much.

furious programming:
Probably the reason is that SDL cannot create a software renderer. Use SDL_GetError function and check if the error is reported or not. SDL can ignore your request in the case of problems and create a renderer of the first supported type, which in your case is a hardware renderer.

SDL provides many functions to check various information. You should check if the error is reported but also you can check what is the type (name) of renderer that the SDL created.

mosquito:
I'm going to test, thank you very much for the info

Navigation

[0] Message Index

Go to full version