Questions tagged [sdl-2]
For questions and issues regarding Simple DirectMedia Layer 2 (SDL2). If you're using SDL 1.2, use tag [sdl-1.2]. If you're questioning the library in general, use tag [sdl].
sdl-2
3,014
questions
1
vote
0
answers
45
views
ASCII art with SDL2, an unexpected output
I wanted to create ASCII art using SDL2, but I don’t understand why I’m getting this result:program output](https://i.sstatic.net/1IUV743L.png) for the orginal image is](https://i.sstatic.net/ytrb2R0w....
-2
votes
0
answers
19
views
Point not rotating around centre correctly [duplicate]
When trying to make a vehicle simulation, the hitch point for the trailer needs to be rotated with the tractor, however it does not seem to be working and the hitch point is too far away from the ...
-5
votes
0
answers
30
views
What can cause an application to run faster under oprofile? [closed]
I am trying to speed up a very slow SDL2 application on Linux. I want to use oprofile to see where the problem areas are. When running under oprofile, with no changes, it runs 80-100x faster than ...
0
votes
1
answer
60
views
Why does this raycaster slow down whenever the player is near a wall?
I am writing a 2.5d game and I have noticed that whenever I am up close to and facing a wall, the game slows down tremendously. This was exacerbated when I added in textures. I am using an inefficient ...
1
vote
0
answers
66
views
SDL2 Window won't show
I am trying to follow a tutorial that creates a blank window that can be closed using the Esc button, but the window never shows. This is on WSL running Ubuntu 20.05.6
The code compiles and runs ...
0
votes
0
answers
60
views
SDL2 Window not showing (C - Debian 12)
I created a simple project with just a window, compiled it and executed it:
#include <SDL2/SDL.h>
#include <SDL2/SDL_events.h>
#include <SDL2/SDL_pixels.h>
#include <SDL2/...
0
votes
1
answer
44
views
Using SDL2 Render Pixels to create video using ffmpeg
I made a small animation using SDL2 and I want to use ffmpeg to convert it to an h264 encoded video. I'm getting the texture RGBA pixels using SDL_RenderReadPixels and sending them to ffmpeg for ...
1
vote
1
answer
29
views
Nice old example on SDL2 render-to-texture, window doesn’t appear, what changed?
Seeking to understand how to use SDL2 in the render-to-texture mode, I found this nice, crisp example from the answer to this question and tried it. It builds, it executes without reporting any error ...
1
vote
0
answers
57
views
Software Rendering text glitch in DearImGUI, fixes?
the text looks like blocks, but neither of the fonts are supposed to look that way, and I don't know why it looks wrong, yet.
Main File:
#include <SDL_main.h>
#include <SDL.h>
#include <...
-1
votes
1
answer
58
views
why is this triangle shader that I wrote splitting into four?
I wrote a triangle shader with an edge function and tried to use weight to color it in, but the colors split into 4 separate triangles each with their own smaller version of the shader for some reason....
1
vote
0
answers
58
views
How to have two identical windows in SDL2?
In my app I draw things and put sprites on a renderer, and I need to have two windows that show the exact same thing, from this renderer.
Is there a way I can do that ?
I tried things such as reading ...
0
votes
0
answers
35
views
SDL-GPU Rendering to texture results in rough edges
I have a texture and I render a circle to it using SDL-GPU, then I render this texture to the window:
#include "SDL2/SDL.h"
#include "SDL2/SDL_gpu.h"
int main() {
if (SDL_Init(...
0
votes
0
answers
28
views
Correct capitalization of SDL2 add-on packages for CMake?
Building on a Mac with CMake, I am trying to use the various add-on packages that go along with SDL2:
sdl2_gfx, sdl2_ttf, sdl2_mixer, etc. Question: when dealing with these packages through homebrew, ...
1
vote
1
answer
66
views
SDL2 Program Crashes After Generating Random Pixels for a Few Seconds
I am working on a project using SDL2 to generate random pixels in a terminal display.
My program compiles and runs:
#include <SDL2/SDL.h>
#include <random>
int main(int argc, char* argv[])...
0
votes
0
answers
40
views
Can’t find SDL2_gfxPrimitives.h with cmake
Building on a Mac under CMake, I am trying to use SDL2_gfxPrimitives.h . The compiler can't find it, although it finds SDL2/SDL.h without difficulty. I installed SDL2 using homebrew. I pursued the ...