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
1
vote
1 answer

Append image in CIMG and save in stb_image_write not working

I am using stb_image stb_image_write and CImg with following code int width, height, bpp; img = stbi_load(imgPath, &width, &height, &bpp, 3); CImg cimg(img, width, height, 1, bpp); CImg wimg(width, 10,…
1
vote
1 answer

Loading image but nothing stored in its array (C++, stbi_load)

I want to display the values in the loaded 8 bit image for code analysis purpose and find that the loaded image has no values? I have the following primary lines to help me: #define CHANNEL_NUM 1 int width, height, bpp; uint8_t* image =…
nolimits
  • 43
  • 1
  • 3
  • 16
1
vote
1 answer

OpenGL texture rendering does not match original

I am trying to render a texture with OpenGL. The texture I am using as a test is a bunch of black rectangles on a white background, as follows: However, when rendering, the texture seem to be duplicated and overlayed multiple times on top of…
bvdhen
  • 45
  • 5
1
vote
1 answer

OpenGL loading rgb texture from stb image

I have a class for creating textures from a path but when i try to load in a texture with 3 channels (rgb) it gives me read access violation exception when running this line glTextureSubImage2D(m_RendererID, 0, 0, 0, m_Width, m_Height, m_DataFormat,…
RadiantMin3
  • 103
  • 1
  • 8
1
vote
1 answer

Issues freeing image data from stb_image in wrapper class

I am writing an Image class for a project using the raw data from stb_image. In the destructor for this class I am freeing the pointer to the image data to avoid memory leaks. However, when the destructor is called and the data is freed, I get an…
1
vote
0 answers

Cannot build C project with cmake when using stb_image library on MacOS

When I try to build my project using this cmake file: cmake_minimum_required(VERSION 3.17) project(C_Projects C) set(CMAKE_C_STANDARD…
1
vote
0 answers

Save image data to sqlite

I have a function which loads an image from file and successfully creates an opengl texture from it. /** * @brief Loads a texture from file and generates an OpenGL texture from it. * * @param filename Path to the image file. * @param…
チーズパン
  • 2,752
  • 8
  • 42
  • 63
1
vote
1 answer

Unresolved Error while using stbi_set_flip_vertically_on_load function

I get unresolved symbol error while using stbi_set_flip_vertically_on_load function. I have added the #include file as header , do i need to do something else also ? stb_image - v2.19 #include…
Summit
  • 2,112
  • 2
  • 12
  • 36
1
vote
2 answers

How to solve stbi_load error of "no SOI"?

I'm loading a picuture by stbi_load, but there was an error of no SOI. I had used the picture in another project and it was loaded successfully. So I think the path of picture and the picuture is valid. But I don't know why the error occured? Here…
luckintt
  • 63
  • 6
1
vote
0 answers

OpenGL Not loading texture data correctly

I have been trying to load a default texture for my materials when a texture isn't given. Due to some issues with the texture loader that I am using, I have decided to fill the image data array manually to then pass it to the OpenGL functions to be…
TheHoester
  • 31
  • 5
1
vote
1 answer

No texture if multiple textures in modern opengl

I'm using C++ and OpenGL 4.6 with SDL2 and glew. I have a class Texture: #include "stb_image/stb_image.h" class Texture { private: unsigned int m_RendererID; std::string m_FilePath; unsigned char *m_LocalBuffer; int m_Width,…
Tohomas
  • 13
  • 2
1
vote
1 answer

stb_image wont flip vertically when image loads for an opengl texture

The image I am trying to load is turned 90 degrees when rendered. I am using "stbi flip image vertically on load" but when the texture is rendered, the image is turned 90 degrees. I tried to change the index and tex coords, that didnt work. //Mesh…
user10692448
1
vote
1 answer

Failing to render model - (glfw / assimp)

I'm following the LearnOpenGL tutorials over at learnopengl.com to load in a model using assimp and render it with glfw. Unfortunately all I'm getting is an empty black window.... My code is identical to Joey's tutorial source…
BouncingCzech
  • 103
  • 1
  • 7
1
vote
1 answer

Unable to render skybox in openGL

I have been using this tutorial to create a skybox but sampling the texture returns black. If I use my texture coordinates as colour then I get sensible looking coloured skybox so I presume the problem is with the texture sampling! Could it be a…
user9540018
  • 507
  • 3
  • 11
1
vote
1 answer

Error when loading image with stb

I am attempting to load the following image: As a texture for the stanford Dragon. The result however is as follows: I have read that other people have had issues with this due to either not binding the textures correctly or using the wrong number…
Makogan
  • 8,208
  • 7
  • 44
  • 112