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

What does #define STB_IMAGE_IMPLEMENTATION do in stb_image

I am trying to use stb_image to load image files as textures in an OpenGL program, the documentation of the header file stb_image.h states the following: "Do this: #define STB_IMAGE_IMPLEMENTATION before you include this file in one C or C++ file…
A. Khaled
  • 168
  • 1
  • 10
0
votes
1 answer

OpenGL 4.1 and lower Black Texture, Mac and Windows

I had this problem when compiling my OpenGL code on lower-end PC's that don't support OpenGL 4.5 and macs. In my regular code, I would use functions like glCreateTextures and glTextureStorage2D, but they are not supported in other versions so I went…
0
votes
0 answers

STB Image doesn't load image

I am loading large PNG image with stb image library. Following code works with other images, so I'm quite sure the code around is correct. int width = 0, height = 0, nrChannels = 0; unsigned char* data = stbi_load(file_name, &width, &height,…
Ecto
  • 1,125
  • 1
  • 7
  • 13
0
votes
0 answers

Using precompiled header in a project that's already using header-only libraries?

I'm building a project and I wanted to make a precompiled header to boost performance. The issue is that I'm also using stbi_image headers in my project, which means I would have to include my header on all the stbi files in my project AND make sure…
Julk
  • 169
  • 7
0
votes
1 answer

Loading image with stb_image library as float outputs wrong values

When I load an image as float using STB_Image the values seem to be off. I created an image to test it . (The used RGB code here is [127, 255, 32]) When I load this image as unsigned char using stbi_load() I get the correct values. But when I load…
DJSchaffner
  • 562
  • 7
  • 22
0
votes
1 answer

C++ GLFW setWindowIcon

So with created a window in C ++ using the GLFW library which also creates an OpenGL context. And after that I decided to add an icon to this window. There were 2 options, use either STB or SOIL to load the icon. I chose STB Image. I downloaded it…
0
votes
2 answers

I can't correctly read the picture by OpenGL and stb_load()

I can't load the following picture correctly enter image description here Here is my loading result. enter image description here Here is my code. I use stb_load() and glTexImage2d() to read the picture and use GL_RGB format but the result is the…
Outro
  • 89
  • 6
0
votes
0 answers

Load a PNG image from a USB stick with stb_image

I'm asking here because the documentation concerning the aforementioned library is horribly lacking. As written in the title, I want to load a PNG image from a USB stick and then decode it using stb_image but I don't know how to go about it. To add…
Getter
  • 765
  • 2
  • 6
  • 15
0
votes
1 answer

stbi_load filename to const char*

I'm trying to load some an image with stbi_load functions like this: stbi_load(filename, parameter2, parameter3, parameter4, parameter5); The problem is I have the filename like this: stbi_load("example_filename",...); But the functions requires…
user11105005
0
votes
1 answer

how can I write pixel color data to a bmp image file with stb_image?

I've already opened the bmp file( one channel grayscale) and stored each pixel color in a new line as hex. after some doing processes on the data (not the point of this question), I need to export a bmp image from my data. how can I load the…
M12421K
  • 57
  • 1
  • 2
  • 13
0
votes
0 answers

How to fix "Image (loaded by stb_image) takes up too much memory"

I am currently learning cg, and I have to load some textures. I tried using stb_images and it works fine but when i load an image inside the memory it takes up too much space. I am using a small jpg(512*512, 154kb), but if I load it 10 times, it…
0
votes
0 answers

C2014 error when adding stb_image to visual studio project

I am planning on using the library stb_image by Sean Barrett to load images into a graphics application. Lib code at the repository below: https://github.com/nothings/stb/blob/master/stb_image.h Though its documentation is short and clear for me in…
ekremer
  • 311
  • 4
  • 23
0
votes
1 answer

Getting thumbnails from image files

I am working on an application where I would like to display a large # of images from which the user can select from to view in full-res. A subset of the images will be visible to the user at any point of time, the number of which is user-controlled…
aCuria
  • 6,935
  • 14
  • 53
  • 89
0
votes
0 answers

initialize 3D float array with return from stbi_loadf?

I'm a novice at C++., and I have a pretty simple program I'm working on and getting stuck. I'm using stb_image to load a png file from disk. And I want to lay it out in memory so that pixel (x,y) is located at p[y*width + x]. not sure how to…
0
votes
1 answer

OpenGL/Glew C++ Texture not applying

I am trying to apply a texture to a basic triangle in opengl. The problem is my texture doesn't works, it only applies a weird color onto the triangle... I already looked at the doc, and some youtube tutorials but I really can't make it work. Here…
user7392005
  • 117
  • 1
  • 8