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,021
questions
0
votes
1
answer
39
views
Where is glClear and glClearColor defined using GLEW and SDL2?
I'm using windows 10, vs 2019, GLEW 2.1.0, and SDL2. I'm pretty sure that I have everything linked. I've triple checked.
I have all the version information and stuff like that set, since I'm following ...
0
votes
0
answers
26
views
Why is there a difference of vertical offset between two ImGUI Text components
I am trying to display two slidebar for my X and Y positions in ImGUI.
And while the "Y :" label seems to be correctly centered, the "Position" and the "X :" label seems ...
0
votes
0
answers
12
views
CMake Cannot Find SDL2TTF package
I installed SDL2ttf for a project and SDL2_image and it seems that cmake cannot find the package only of SDL2ttf although i applied the same logic. Specifically i downloaded the libraries, i created a ...
2
votes
1
answer
87
views
Return an array of objects from a C function? [duplicate]
I'd like to know how to return an array of objects from a C function.
Here's an example:
SDL_Vertex initTriangle (struct Point2D point1, struct Point2D point2, struct Point2D point3) {
SDL_Vertex ...
0
votes
1
answer
33
views
ImGui + SDL2 - SIGILL error on ImGui initialization
I'm writing a simple emulator for the NES. I'm trying to use SDL2 for the graphics, with ImGui (SDL renderer, not necessarily limited to it).
It all worked with the corresponding example on github, ...
1
vote
0
answers
46
views
Memory leak anxiety for SDL_ttf functions
I'm using SDL2 and SDL2_ttf libs in the code below. It runs OK for now but I'm anxious for leaking memory. Do I need to uncomment the commented lines and free the surface & texture pointers each ...
1
vote
1
answer
45
views
SDL2: what determines single vs double buffering?
I am trying to revive an old cross-platform graphics library that I wrote for my students over 20 years ago. After Apple pulled the plug on Carbon, I reimplemented the Mac side on top of SDL2, which ...
0
votes
0
answers
51
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
25
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
31
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
61
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
63
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
47
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 ...