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].

Simple DirectMedia Layer 2.0 (SDL2) is the second generation of a popular open source cross-platform library that provides a simple interface to graphics, sound, and input devices. The new version comes with lots of new features such as full 3D hardware acceleration and the less restrictive zlib license.

Resources:

2910 questions
1
vote
1 answer

How to create and initialize a SDL 2.0 window to support 3D rendering with OpenGL 3.0+?

I am fairly new to SDL and I am trying to only use version 2.0. I believe that in previouse versions of SDL (1.2 and 1.3) creating a window was done with SDL_SetVideoMode, however that has since been droped source. So how do you create a window for…
zzelman
  • 425
  • 5
  • 14
1
vote
1 answer

How to play a video inside a UIView with ffmpeg/sdl

I'm trying to make a video player that can play various video format with ffmpeg and sdl2, and I need to display video frames inside a UIView. After looking into SDL api and its samples i couldnt find a way to do it. SDL use SDL_Renderer to render…
jAckOdE
  • 2,402
  • 8
  • 37
  • 67
1
vote
1 answer

SDL window management with OpenGL and DirectX

I'm porting a small graphics engine from DirectX 9 to OpenGL. The engine uses SDL (now ported to 2.0) to manage input and window creation. I want to know how to correctly handle window events for both OpenGL and DirectX. I'm interested in these for…
DarthMike
  • 3,471
  • 1
  • 22
  • 18
0
votes
0 answers

I am making a 3D Engine but even with the correct matrixes but it breaks when rotating

So, I have make a 3d engine and I am trying to make the camera orbit around the player (in this case a cube), I have code for orbiting, 3D Projection, etc. but even with the correct matrixes the camera with stop displaying the cube from 1.57079 to…
0
votes
0 answers

Bazel linking .dll for SDL2 project

I was wondering how to properly set up the Bazel target for SDL2 with the Windows dynamic and static libraries. What can I change in my BUILD file to account for the .dll files for the Windows SDL2 library? Here is my Git repository for reference.…
0
votes
1 answer

Segmentation fault with pointer to SDL_Texture

I've been making a game in SDL, in order to minimize the amount of spaghetti-code present, i've been making my own functions to automate many SDL processes, one of which is a function to allocate a picture or font to a texture. Problem is that after…
0
votes
2 answers

Fastest way to load a texture in C++ with SDL2

I'm currently following Lets Make Games' tutorial series for making a game in C++ with SDL2. In the episode, he uses this method to create a texture: SDL_Renderer* renderer; SDL_Texture* tex; SDL_Surface* tmpSurface = IMG_LOAD("name") tex =…
0
votes
0 answers

"undefined reference to symbol" with SDL?

I am using c, sdl2 and raycasting to create a maze from a 2d array: // input.c #include #include "main.h" #include void move(double dirX, double dirY, double planeX, double planeY, double posX, double posY, double time,…
Ornelle
  • 1
  • 1
0
votes
1 answer

How to change the background color of an image in SDL2?

Context In my SDL2 app, I am trying to load a png image(transparent). I want to give a background color to this image with SDL2 because I want to reuse the image somewhere else in the program and I do not want to have multiple version of the same…
Meniev
  • 148
  • 1
  • 13
0
votes
0 answers

Merging Gtk and sdl screen in one window

I have to merge the gtk and sdl screen of guvcview in one window that is controls and streaming video would be in one window? I have tried to add but sdl window was adding and overriding the main gtk window and I can't able to add gtk widgets like…
Zlatan
  • 11
0
votes
0 answers

Macbook setup SDL2 with vscode but linker error

I want to setup sdl2 with vscode. However, when I run the main file, there is an error. Undefined symbols for architecture x86_64: "_SDL_CreateWindow", referenced from: _main in main-9eb1c9.o "_SDL_DestroyWindow", referenced from: …
kiki
  • 1
0
votes
0 answers

C++ std::chrono deltaTime doesn't works right

I want to build a small engine in SDL2 c++ and right now I'm in the process of calculating deltaTime so I've tried and researched a lot and this code should actually be the correct calculation but I must have done something wrong because the value…
Nagisa
  • 9
  • 1
0
votes
0 answers

Why doesn't my sdl2 linking work even though i specified all libraries?

I don't know why my code doesn't link. Gcc Command: g++.exe -g -std=c++17 main.cpp -ISDL2\include -o main.exe -LSDL2\lib -lmingw32 -lSDL2main -lSDL2 main.cpp: #define SDL_MAIN_HANDLED #include int main() { SDL_Delay(5000); …
0
votes
1 answer

Changing frequency of sine function without click-sound with SDL2 and C

With SDL2 I am trying to play a frequency that will be changed on a keydown event. There is a clicking sound when the frequency is changed, that i would like to get rid of. The wave with the new frequency is phase shifted and the values of…
marius627
  • 1
  • 1
0
votes
0 answers

How to avoid blinking in an ImGui application using Rust, SDL and OpenGL?

I'm developing an application using the imgui-rs library in Rust with SDL2 and OpenGL. However, I'm experiencing an issue where the UI elements are constantly blinking during the application's execution. I've tried various approaches, but the…
totta
  • 1
  • 3