Category : sdl

for the past couple of days I’ve been trying to get a decoded AVFrame* converted to an SDL_Surface. In order to do that, I need to get the pure RGBA data from the frame. Here is the code involved with copying. std::uint32_t numBytes = av_image_get_buffer_size(AV_PIX_FMT_BGR32, codecCtx->width, codecCtx->height, 32); /// … std::vector<std::uint8_t> nBuf(numBytes); auto e = ..

Read more

I would like to know how to connect a client TCPsocket to an server TCPscoket, but I couldn’t find anything showing how to do this in the documentation. Here’s how I created my server TCPsocket: const int my_port = 3946; IPaddress addr; SDLNet_ResolveHost(&addr, NULL, my_port);// error handling omitted TCPsocket server = SDLNet_TCP_Open(&addr);// error handling omitted ..

Read more

I’m trying to use Dear ImGui and OpenGL 3 with SDL and have setup everything correctly, but I keep getting an exception in imgui_impl_opengl3 and it’s specifically this line g_VertHandle = glCreateShader(GL_VERTEX_SHADER); which is called from the ImGui_ImplOpenGL3_NewFrame(); The exception is Exception thrown at 0x0000000000000000 in Henly.exe: 0xC0000005: Access violation executing location 0x0000000000000000. Here is ..

Read more

I’m trying to make a SDL window that responds to console input. I read this question, and the below is what I tried so far. /* g++ test.cpp -o test -lSDL2 */ #include <iostream> #include <string> #include <vector> #include <cstdlib> #include <ctime> #define SDL_MAIN_HANDLED #include <SDL2/SDL.h> #include <SDL2/SDL_render.h> using namespace std; const int width = ..

Read more