Questions tagged [sdl-image]

SDL_image is an image file loading library. It loads images as SDL surfaces, and supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, WEBP, XCF, XPM, XV.

156 questions
4
votes
1 answer

How can I link with gcc and SDL_image library?

I have the following script: gcc -I /Library/Frameworks/SDL2.framework/Headers \ -F /Library/Frameworks/ -framework SDL2 test.c that successfully compiles the following source code: #include //#include "SDL_image.h" int init(); int…
Rubberduccky
  • 107
  • 3
  • 11
4
votes
3 answers

SDL_image/C++ OpenGL Program: IMG_Load() produces fuzzy images

I'm trying to load an image file and use it as a texture for a cube. I'm using SDL_image to do that. I used this image because I've found it in various file formats (tga, tif, jpg, png, bmp) The code : SDL_Surface * texture; //load an image to an…
Kami
  • 5,959
  • 8
  • 38
  • 51
4
votes
1 answer

Why do images loaded to texture with IMG_Load in SDL and OpenGL look bluish?

I'm loading a PNG texture with: void Sprite::setTexture(string f) { SDL_Surface *image = IMG_Load(f.c_str()); if (image == NULL) { this->texture = -1; return; } SDL_DisplayFormatAlpha(image); unsigned object(0); …
Shoe
  • 74,840
  • 36
  • 166
  • 272
3
votes
1 answer

How to load textures using SDL to a WebAssembly project using emscripten?

I'm trying to load a texture to my application using SDL. When building as a native application, it works as it should. But when I'm building it with Emscripten, the texture cannot be loaded. The width of the texture image is 64 pixels, which I can…
birgersp
  • 3,909
  • 8
  • 39
  • 79
3
votes
1 answer

C++ - SDL/OpenGL loaded image's colors are inverted

I'm trying to load an image into my game. It's being written in C++, with SDL and OpenGL, and the SDL_Image framework. I've gotten the image in, and have rotated/inverted it to my needs, but there are two main problems. Firstly, the image's colors…
Matt Reynolds
  • 787
  • 2
  • 9
  • 22
3
votes
1 answer

Texture Fading in SDL2 - Using SDL_image

I can load an image in (png) no problem using SDL_image and also display it perfectly. What I would like to do though is gradually fade the image in from fully transparent to fully opaque. I have seen some tutorials mentioning SDL_SetAlpha but this…
TPS
  • 2,067
  • 3
  • 23
  • 32
2
votes
0 answers

SDL with C - Blocks remains after being played

I have been working on a game that is a Stacker. Everything works fine, but after you have played and started over the blocks from the previous game still remain there. Could anyone help me with this problem? #include #include…
coralo1665
  • 21
  • 1
2
votes
1 answer

Open embedded BMP images with SDL?

I am trying to embed an image in a C++ program, but I can't open it with SDL. I already tried using xpm, xfc, tried to use SDL_LoadBMP_RW(), tried to convert the image into C code...nothing worked. I tried adding the image to the "resource files"…
2
votes
1 answer

SDL_image Can't load .png file with IMG_LoadTexture()

While trying to load a .png file with IMG_LoadTexture(renderer, "idle.png") SDL_GetError() says: "Couldn't open idle.png" There are no compiler errors, just a black window appears. This is my main.cpp #include #include…
Karol
  • 23
  • 4
2
votes
2 answers

C++ image loading with SDL2 and SDL_image

I have a question about image loading in SDL2 with the SDL_image libary. Unfortunatly i dont find any information about IMG_LoadTexture in the SDL_image documentation. So what is the difference between using IMG_LoadTexture to directly load an PNG…
Dentho
  • 55
  • 1
  • 1
  • 5
2
votes
0 answers

SDL2 and SDL_image, Redefinition and Conflicting Declaration When Compiling

I am trying to use the SDL_image library so I can display a .png file in a window made using SDL2 library. My problem is when ever I compile the code I get a lot of errors of about deceleration and stuff in the SDL header files. I'm using Eclipse on…
Bananas88
  • 23
  • 8
2
votes
0 answers

Cmake - freetype, sdl, sdl-image

I have the following cmake file: cmake_minimum_required(VERSION 2.8) include(ExternalProject) project(freetype_test) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") set(LIBS_DIR ${PROJECT_SOURCE_DIR}/libs) set(FREETYPE_VER…
Blank
  • 21
  • 1
2
votes
1 answer

Lispbuilder-SDL: turn surface and preserve color key (transparency)

Explanation I'm writing turtle graphics app in CL using SDL. I've created a drawing of a turtle and saved it in PNG. Snag No 1: SDL:LOAD-IMAGE didn't work well with actual transparency in the image. So, I've colored transparent parts with white…
mobiuseng
  • 2,326
  • 1
  • 16
  • 30
2
votes
1 answer

Android with SDL 2.0, setting a picture as background

I'm experimenting with android SDL 2.0, however I encountered a problem that I just can't solve. My problem is that I try to make a 1080*1920 picture as the background of my application. I create it in photoshop, but whenever I try to start the app…
Daniel
  • 21
  • 1
2
votes
1 answer

Building SDL2_image as a CMake external project

I've been trying to create a CMake-based build-system for a project that is supposed to use SDL2_image library. I do not want to force user to install any libraries to the system to be able to build the project, so I took advantage of the CMake's…
Sergey Nikitin
  • 444
  • 1
  • 7
  • 19
1
2
3
10 11