Questions tagged [stb-image]

Single-file public domain (or MIT licensed) library for image loading/decoding from file/memory. Implemented for C/C++ by Sean Barrett.

Single-file public domain (or MIT licensed) library for image loading/decoding from file/memory. Implemented for C/C++ by Sean Barrett.

Resources:

101 questions
0
votes
0 answers

Loading texture with STB into OpenGL displays incorrect alpha values

I'm trying to load an RGBA image into OpenGL using the stb image library. The bottom half of the image's transparent section is showing up with partial transparency, and not complete transparency. I think this may have something to do with the image…
0
votes
1 answer

Issues while rendering textures in OpenGL in C++

I am having issues rendering textures in OpenGL. My goal is to render transparent and non transparent textures but the code I am using seems to swap and mix the pixels of my files. I am mostly taking the code from this tutorial (learnopengl.com)…
LiteApplication
  • 177
  • 2
  • 13
0
votes
1 answer

stbi_load() returning empty string ""

I have the following function using stbi_load: void load_texture_from_file(const char *file, bool alpha, const char *name) { Texture *tex; tex = malloc(sizeof(Texture)); tex->name = name; int width, height, channels; unsigned…
Vitor Hugo
  • 1,106
  • 1
  • 15
  • 35
0
votes
1 answer

How to render image from cairo_image_surface_create_for_data with using stbi_load?

I am using Cairo to render an image, and I have an issue that the canvas always drawing with blank (no image was drawn). Please refer my code below: int width, height, channels; unsigned char* data = stbi_load(imagePath.c_str(), &width, &height,…
Lý Hoài
  • 129
  • 6
0
votes
2 answers

Why is this texture not showing up?

I am following the tutorial from learnopengl.com to make a game engine. I am using stb_image.h to load the textures, and my own header file to compile and link the shaders. I got to the part in Getting Started/Textures where the container.jpg…
0
votes
1 answer

Unable to use stb_image

I was working on a project and I was trying to get an image to load so I could use it as a texture, but I ran into an issue when I tried to include stb_image. I put stb_image.h in src/vendor/stb_image/ , made a cpp file named stb_image.cpp…
User-92
  • 374
  • 3
  • 13
0
votes
0 answers

How to save a 1 bit per pixel png using stbi?

I struggled for a long time devising bitmap problems for students in C++ that were easy. The problem is the libraries which are not easy to use. stbi, an include-only library completely solved this problem and now students can easily load and save…
Dov
  • 8,000
  • 8
  • 46
  • 75
0
votes
0 answers

Problem with writing rotated image as a jpeg file

In the main part, I rotated the image. Then I wrote a code for writing my image to in project file as a jpeg file. I couldn't do it. Here is my code: They are some definitions and libraries I used. (I also added standard libraries.) #define…
0
votes
0 answers

How do I resolve these compiler warnings from stb_image?

I'm using the stb_image library to help load images/textures, following "The Cherno"'s OpenGL tutorial playlist. While I'm able to successfully load and render the images, I get these compiler warnings whenever I build my project. How can I resolve…
spaL
  • 604
  • 7
  • 21
0
votes
3 answers

GCC produces errors on valid stb_image.h

Following shows two errors generated by GCC: In file included from /home/omar/Desktop/Lovelace/src/main.cpp:22: /home/omar/Desktop/Lovelace/include/stb/stb_image.h: In function ‘void* stbi__load_gif_main(stbi__context*, int**, int*, int*, …
0
votes
1 answer

How to save HD pictures by stbi_write_png

I am using OpenGL to simulate objects. And use stbi_write_png to save picture, but the size of the picture is only over 200K, and it is not very clear after zooming in. So I want to know if there are other ways to save high-definition pictures in…
luckintt
  • 63
  • 6
0
votes
1 answer

OpenGL Textures: how do I create an image path?

I'm stuck trying to upload textures here: // The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path. unsigned char *data =…
justaweeb
  • 29
  • 6
0
votes
1 answer

Any solution for TGA format loading in OpenCV4

There's no support TGA format for OpenCV currently. And I know there's a single header file library named stb_image that allow you to read/write TGA image. But the use case with OpenCV on the Internet are so few. (more often to see people use it…
0
votes
1 answer

Is it possible to use stbi_load on Android?

I am a newbie on openGLES, I just want to open an image serve my texture later. Since most tutorial on the internet for openGL is based on development on laptop, they simply open image like:unsigned char *data = stbi_load("pic.jpg", &width, &height,…
Michael
  • 1,313
  • 11
  • 25
0
votes
1 answer

Having issues rendering a 2D rectangle on a 3D plane in OpenGL

I'm having issues rendering a 2D object in the 3D space in OpenGL. Whenever I compile my code I get a purple background, which is what I set it to. However, I do not see the object that I should be able to see. I think it's something wrong with the…