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
2
votes
2 answers

stb image write issue

I am trying to write a simple image file to disk using stb_image_write. I use the simplest test case : a 128 by 128 pixels RGB image. I found this example online, and the guy seems to say that it works fine, plus it looks exactly like what I have…
gui2one
  • 160
  • 1
  • 1
  • 14
2
votes
2 answers

stbi_load doesn't return any value

I'm trying to load some images with stb_image to an unsigned char*. The code goes like this: #define STB_IMAGE_IMPLEMENTATION #include namespace rhino { Texture::Texture(const std::string& file) { …
Moritz Seppelt
  • 51
  • 1
  • 10
1
vote
1 answer

Why is no data getting written to image?

I'm trying to create procedural textures, and for that, I'm generating noise, and then writing that data to an image file, to be displayed. So far I generated the noise, and now I'm trying to write that to an image file, to display the noise. I…
Chillzy
  • 89
  • 8
1
vote
1 answer

How to use GL_TEXTURE_2D_ARRAY with stb_image

I'm trying to create sprite animation with texture array. Right now I have follow code: int width, height, depth; stbi_set_flip_vertically_on_load(true); byte_t* buffer = stbi_load(R"(.\fire.jpg)", &width, &height,…
oiushder
  • 11
  • 1
1
vote
0 answers

stbi memory leak with stbi_load

so im getting a memory leak from this constructor TEXTURE::TEXTURE(std::string path) { // load and create a texture // ------------------------- glGenTextures(1, &ID); glBindTexture(GL_TEXTURE_2D, ID); // all upcoming GL_TEXTURE_2D…
1
vote
1 answer

Encoding QR data as PNG using C and stb_image_write

im trying to render QR to image (png, svg) using QR-Code-generator-1.8.0 and stb_image_write, i follow the example on demo example and generate the QR correctly but very small and i dont know how to scale it, i suppose must be at image writing, but…
anewb33
  • 81
  • 7
1
vote
0 answers

How can I use less ram? Texture and model loading

So I am following the opengl tutorial at https://learnopengl.com/Model-Loading/Model and when I run the application it is using a little more than half a gigabyte for textures and models! But when I check the size on disk of all the textures and the…
JohnJameson
  • 81
  • 1
  • 12
1
vote
1 answer

Access violation in nvoglv64.dll when using OpenGL

My code is giving me this error: Exception thrown at 0x00007FFCF428A6CF (nvoglv64.dll) in program.exe: 0xC0000005: Access violation reading location 0x000001D6B603F000. In the debug output window of Visual Studio I also see pdb not loaded for the…
Jakkkub
  • 55
  • 6
1
vote
1 answer

Error when compiling source file which includes stb_image.h

I get this particular error when compiling a C++ source file which includes stb_image.h. In file included from /home/zeux/Documents/Projects/cube-game/./lib/stb/stb_image.h:723, from…
Meth Munindradasa
  • 476
  • 2
  • 6
  • 14
1
vote
1 answer

Texture not loading opengl Arch linux C++

I am trying to show a texture here on opengl 2.1 using glsl 120 in linux.But it shows a error.my main.cpp #include "GL/glew.h" #include "GL/glu.h" #include "GLFW/glfw3.h" #include "stb_image/stb_image.h" #include unsigned char*…
anuj
  • 71
  • 5
1
vote
1 answer

How to check if image should be flipped vertically before loading using stb_image

I'm writing a project using OpenGL, and loading the textures using stb_image. Some of the textures are loaded flipped upside down (regarding the y-axis) so I use "stbi flip image vertically on load" to load them properly. The problem is that some of…
hannak
  • 11
  • 1
1
vote
0 answers

how to change stb_image order RGBA to ARGB?

i am using stb_image to read image data, i have a trouble about image data channel ordering. As is see in this library, they have define enum like below, but never use. enum { STBI_ORDER_RGB, STBI_ORDER_BGR }; By default, all output data…
Lý Hoài
  • 129
  • 6
1
vote
1 answer

How do I make this a relative path?

I am working on some OpenGL stuff and when loading textures I am using an absolute path which is bad for obvious reasons. My problem is that I cannot find recourses on how to convert paths like these into relative paths. This is the code where the…
1
vote
1 answer

C++ OpenGL stb_image.h errors

I am following an OpenGL tutorial from https://learnopengl.com/ (specifically https://learnopengl.com/Advanced-OpenGL/Depth-testing) and I have many errors to do with stbi. Error Log image here (Below I have also attached the complete Output tab). I…
Caleb Sadler
  • 109
  • 1
  • 12
1
vote
1 answer

Losing data when passing uint8_t* to void* parameter function?

I wrote this function to generate a texture in OpenGL. It correctly generates the texture I want which is a wooden box. // This works bool GenerateTextureFromFile(const int32_t mipMapLevel) { int32_t width, height, channels; uint8_t* data =…
Fate
  • 117
  • 1
  • 1
  • 4