Closed SpartanJ closed 5 years ago
Original comment by Michael Legner (Bitbucket: Sokar, GitHub: Sokar).
Hi Martin,
If created a small application with which I can reproduce it just fine: https://bitbucket.org/Sokar/soil_issue24/src/master/ Only cloning the repo somewhere and starting the solution file with VS2017 should be enough to compile. I tried it on a second computer and it works fine.
the image use ist "img_test.bmp" from the bin folder of SOIL2.
I also got a bit more information, the exception happens in Line 1618 of Soil2.c which reads
#!c++
new_width = iwidth / reduce_block_x;
with reduce_block_x being zero.
I hope it helps to reproduce the exception.
Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).
You must initialize an OpenGL context before trying to load any image. Your example will never work. It's crashing in that line because it's being unable to determine the max texture size, because there's no GL context to obtain it.
Regards
Original report by Michael Legner (Bitbucket: Sokar, GitHub: Sokar).
Hi,
I'm currently working with the Book "Computer Graphics Programming in OpenGL with C++" ( http://merclearning.com/titles/Computer_Graphics_Programming_in_OpenGL_with_C++.html ) which uses your library to load textures.
Unfortunatly, I encountered a problem with it: just calling SOIL_load_OGL_texture as described in the book results in division by zero exception.
Code: GLuint texId = SOIL_load_OGL_texture(texFilePath.c_str(), SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y);
texFilePath is a std::string and valid path, otherwise SOIL results in "unable to fopen" error. Loading with stb_image.h works. I'm on Windows 10 x64 in Visual Studio 2017 Community Edition Version 15.9.11.