spartanj / soil2 Goto Github PK
View Code? Open in Web Editor NEWSOIL2 is a tiny C library used primarily for uploading textures into OpenGL.
License: MIT No Attribution
SOIL2 is a tiny C library used primarily for uploading textures into OpenGL.
License: MIT No Attribution
Original report by Malte Haase (Bitbucket: a_teammate, ).
I'd love to give a pr for this but my hq capabilities are limited (and tbh im not really motivated in learning it)
so i mirrored the project to github (its really really easy: "import code" .. url_from_bitbucket and done)
and made a commit there: a-teammate/SOIL2-fork@b48a330
You really have some neat libs, id love to see them somewhere they get attention ( i know im repeating myself here ^^)
(they have issue migration to github too)
Unable to use "convert_image_to_DXT5" without extern "C".
Original report by Johannes P. (Bitbucket: [Johannes P.](https://bitbucket.org/Johannes P.), ).
When attempting to build this repository's premake gmake file with gcc 4.8.4 and SDL 2.0.3 on mac OS 10.10.2 I noticed that the makefiles for the tests fail to compile due to the error:
#!shell
g++ -MMD -MP -DNDEBUG -O2 -o "../../obj/macosx/release/soil2-test/test_SOIL2.o" -MF ../../obj/macosx/release/soil2-test/test_SOIL2.d -c "../../src/test/test_SOIL2.cpp"
../../src/test/test_SOIL2.cpp:12:11: fatal error: 'SDL2/SDL.h' file not found
#include <SDL2/SDL.h>
This seems to be because the -F flag, and corresponding path to the Frameworks directory is required in both the compile, as well as the link step.
Here is a quick example illustrating the problem in detail with a super simple SDL2 program:
https://bitbucket.org/snippets/JohannesMP/BA5Bo
The premake4.lua file should be modified to accommodate this.
Note: this is my first time attempting to compile SOIL2, and I don't have a lot of experience with premake, so please let me know if there is some simple step that I am missing here.
I am trying to compile SOIL2 with mingw64.
I have installed premake5 and used the following commands:
premake5 gmake
cd make/windows
mingw32-make
after which I get the following error:
mingw32-make
==== Building soil2-static-lib (debug_x86_64) ====
Creating ../../obj/windows/x86_64/debug/soil2-static-lib
mkdir: cannot create directory ‘..\..\obj\windows\x86_64\debug\soil2-static-lib’: No such file or directory
mingw32-make[1]: *** [soil2-static-lib.make:153: ../../obj/windows/x86_64/debug/soil2-static-lib] Error 1
mingw32-make: *** [makefile:45: soil2-static-lib] Error 2
Please help, as I do not want to use MSVC for my OpenGL projects.
Original report by Manuel Fischer (Bitbucket: mnlfischer, GitHub: mnlfischer).
MACOS: 10.13.15
XCODE: 9.4.1
I got this error when trying to use soil2:
Undefined symbols for architecture x86_64:
"_SOIL_free_image_data", referenced from:
init() in main.o
"_SOIL_load_image", referenced from:
init() in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Downloaded the repo and added Soil2 to my project.
Original report by John Gros (Bitbucket: JohnGros, GitHub: JohnGros).
I'm using SOIL2 in an Android NDK Project but it seems there is a probelm with the fopen command while using the function
#!c
SOIL_load_OGL_texture
When i check for an error during the load process with
#!c
if( 0 == tex_2d )
{
SDL_Log( "SOIL loading error: '%s'\n", SOIL_last_result());
}
I've got the following error
#!c
SOIL loading error: can t open
I tried to give the direct file path but nothing
#!c
/data/data/com.package.name/myfile.png
Is this because fopen can't access the asset dir ? or is there a workaround ?
Thank you
Hi,
Really nice to see initiative to continue development on the (actually widely used) SOIL library!
For the below function:
SOIL_load_OGL_HDR_texture
(
const char *filename,
int fake_HDR_format,
int rescale_to_max,
unsigned int reuse_texture_ID,
unsigned int flags
);
the parameter rescale_to_max
seems undocumented. Looking through the code it seems to be used for the formats that are alpha-premultipied (ie not RGBE). What I could find is this:
// image_helper.c
int RGBE_to_RGBdivA(...)
{
/* convert (note: no negative numbers, but 0.0 is possible) */
if( rescale_to_max )
{
scale = 255.0f / find_max_RGBE( image, width, height );
}
}
[...]
int RGBE_to_RGBdivA2(...)
{
/* convert (note: no negative numbers, but 0.0 is possible) */
if( rescale_to_max )
{
scale = 255.0f * 255.0f / find_max_RGBE( image, width, height );
}
}
I'm not really sure what it means, but it seems to me like rescale_to_max
is intended as a boolean flag to somehow rescale the image by its maximum luminance, or something different...
Would it be possible to give a clarification for this, and possible also some documentation to the SOIL_load_OGL_HDR_texture
interface?
Thanks! :)
Please add a LICENSE file with the license/copyright information
This way it can be detected easier automatically and it is easier to copy these information for packaging purposes
I am new to openGL. I have been trying for days to use SOIL and just realized there is a SOIL2 version. That will explain why I cannot find the libSOIL.a file for SOIL.
Now for my problem.
What are the steps to install and incorporate SOIL2 into my project, so I can load .jpg files?
I am using CLion
Please help
Original report by Anonymous.
SOIL2 does not set the internal format to GL_SRGB8 or GL_SRGB8_ALPHA8 when loading an sRGB texture, so the texture is treated as linear by opengl and gives in-corrected colors when rendered.
any idea when this will be added?
thanks.
stbi_pkm_c.h: In function ‘int stbi__pkm_info(stbi__context*, int*, int*, int*)’:
stbi_pkm_c.h:85:25: warning: ‘int strcmp(const char*, const char*)’ of a string of length 6 and an array of size 6 evaluates to nonzero [-Wstring-compare]
85 | if ( 0 != strcmp( header.aName, "PKM 10" ) ) {
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
should most likely be strncmp
https://github.com/richgel999/rg-etc1 (as commented in #32)
as it is zlib licensed, less restrictive than apache2, and closer to public domain in spirit
Original report by Krzysiek Siewiorek (Bitbucket: Krzysiek, GitHub: Krzysiek).
It's just a step away for making SOIL2 fully OpenGL 3+ compatible, there's just a bit of stuff that is deprecated. It would be nice to achive that. What you thing?
Original report by Anonymous.
Visual Studio 2015 is telling me that the "soil2-debug.lib" I generated with the command "premake4.exe vs2012" is 32-bit. My system, however, is 64-bit and I'm building a 64-bit project.
It might be the source of other errors I have when I try to build my program so I want to correct that. How can I get a 64-bit library for SOIL2 ?
Thanks in advance.
Could you define SOIL2_VERSION_MAJOR, SOIL2_VERSION_MINOR, and SOIL2_VERSION_PATCH?
Or provide a const char* SOIL_version();
function, or whatever?
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.
Original report by Anonymous.
After I updated the OS, it keeps saying
#!-bash: ./premake4: Bad CPU type in executable
I tried premake5 too, but I guess this library is for premake4. It doesn't work.
There are DDS files in the wild that don't specify a complete mip chain with mipmaps all the way down to 1x1. When loading such files with SOIL2, the resulting texture isn't mipmap-complete, and OpenGL implementations don't have to display it as expected (e.g. modern AMD hardware with their proprietary Windows drivers samples everything as opaque black), but there's no indication of this to the programmer.
As I'm not currently hitting this with production code, just a quick test application, I can just add a glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 3)
call after loading the offending texture, but it would be better if SOIL2 either gave some way of querying which mip levels the file actually contained, or set the correct max level automatically. I imagine that the flag to enable a glGenerateMipmap
call would fix the symptom, too, but it isn't ideal if there's custom mip data as it overwrites all levels other than the base level.
Original report by Anonymous.
Hi,
I've tried to use SOIL2 for my x64 project but I've got a linking error. Apparently there is a missing obj file, soil2-debug.obj. I've compiled the project in vs17 but got no obj file like that. Any suggestions? Also if my vs version is the issiue, I would be obliged if you could send me this missing obj file.
Original report by Petr Štětka (Bitbucket: stety, GitHub: stety).
Hi guys,
how can I compile soil2 library for Android?
Original report by David Amador (Bitbucket: DJ_Link, ).
I'm having a weird issue. Same images with same loading code appear all white in iOS but fine on Mac.
I've tried with both "Compress png images" on and off on build settings. The source images are png. All images have square power of 2 sizes.
This is the code I'm using
#!c++
int width, height, channels;
unsigned char* data =
SOIL_load_image((const char*)filename.c_str(),&width,&height,&channels,SOIL_LOAD_AUTO);
GLuint textureid;
glGenTextures(1, &textureid);
glBindTexture(GL_TEXTURE_2D, textureid);
GLint min_filter = filter_to_glint(GFX->get_image_min_filter());
GLint mag_filter = filter_to_glint(GFX->get_image_mag_filter());
GLenum format = GL_RGBA;
if (channels == 4) // contains an alpha channel
{
format = GL_RGBA;
}
else if (channels == 3) // no alpha channel
{
format = GL_RGB;
}
glTexImage2D( GL_TEXTURE_2D, 0, channels, width, height, 0,
format, GL_UNSIGNED_BYTE, data );
SOIL_free_image_data( data );
Original report by RoestVrijStaal (Bitbucket: RoestVrijStaal, GitHub: RoestVrijStaal).
Hello,
I try to compile SOIL2 but my attempts with standalone MinGW-w64 with its own command line and Code::Blocks inclusive MinGW-64 failed.
The most successful result was with Code::Blocks after adding -msse2 as extra compiler flag.
However, test_perf_SOIL2.cpp SIGSEGs in SSE2 instructions again.
Which compiler + flags (and IDE) do you use?
Update function args:
Int width, height;
UnsignedInt flags = SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_DDS_LOAD_DIRECT;
glId = SOIL_load_OGL_texture_from_memory(
(unsigned char *)&blobData.front(), blobData.size(),
SOIL_LOAD_RGBA, SOIL_CREATE_NEW_ID, flags, &width, &height);
Original report by Anonymous.
Hi!
I've been trying to generate my .lib using x64 and just can't seem to get it too work. Heres the cmd input I'm doing:
premake4 vs2012 --platform=x64
This may be incorrect, it's just what I've seen for other research. Please let me know the correct way to generate, if at all possible.
Thanks! :)
Original report by Anonymous.
Linking soil2-static-lib
ar: no archive members specified
usage: ar -d [-TLsv] archive file ...
ar -m [-TLsv] archive file ...
ar -m [-abiTLsv] position archive file ...
ar -p [-TLsv] archive [file ...]
ar -q [-cTLsv] archive file ...
ar -r [-cuTLsv] archive file ...
ar -r [-abciuTLsv] position archive file ...
ar -t [-TLsv] archive [file ...]
ar -x [-ouTLsv] archive [file ...]
make[1]: *** [../../lib/macosx/libsoil2-debug.a] Error 1
make: *** [soil2-static-lib] Error 2
I downloaded premake4, and moved .exe to 'SpartanJ-soil2'.
And I moved to the directory on Terminal.
I typed " ./premake4 gmake", "cd make/macosx", and "make"
Then it showed me the errors above.
Original report by subdivider (Bitbucket: subdivider, GitHub: subdivider).
Hello, the section of code on lines (1578 - 1591) have semantic error:
#!c
unsigned char *resampled;
int reduce_block_x = 1, reduce_block_y = 1;
int new_width, new_height;
if( iwidth > max_supported_size )
{
reduce_block_x = iwidth / max_supported_size;
}
if( iheight > max_supported_size )
{
reduce_block_y = iheight / max_supported_size;
}
new_width = iwidth / reduce_block_x;
new_height = iheight / reduce_block_y;
resampled = (unsigned char*)malloc( channels*new_width*new_height );
let's say
So resampled image's new_width will be still greater than max_supported_size. Same applies to* new_height* if iheight > max_supported_size ...
Original report by Dominic Bowden (Bitbucket: clump, GitHub: clump).
Yo, this wonderful library tries to set a texture format of GL_LUMINANCE/GL_LUMINANCE_ALPHA at line 1613 of SOIL.c. OpenGL 4 completely removed those formats, they don't work anymore.
As far as I can tell the intended replacement is to use GL_RED/GL_RG instead, but these have different behaviour (GL_LUMINANCE feeds vec4(x, x, x, 1) to shaders, GL_RED feeds vec4(x, 0, 0, 1) to shaders).
Is it possible to load HDR textures (for example cubemaps) without conversion to LDR?
As I can see, SOIL2 always tries convert everything to LDR... It is reasonable choice for GLES2, but not for desktops and GLES3...
Currently, soil2
build failed with the following errors on uwp in vcpkg:
Can anyone help look into this?
Thanks in advance!
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(172): error C2146: syntax error: missing ')' before identifier 'target' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(172): error C2061: syntax error: identifier 'target' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(172): error C2059: syntax error: ';' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(172): error C2059: syntax error: ',' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(172): error C2059: syntax error: ')' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(173): error C2061: syntax error: identifier 'soilGlCompressedTexImage2D' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(173): error C2059: syntax error: ';' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(173): error C2513: ' ': no variable declared before '=' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(175): error C2146: syntax error: missing ')' before identifier 'target' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(175): error C2061: syntax error: identifier 'target' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(175): error C2059: syntax error: ';' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(175): error C2059: syntax error: ')' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(176): error C2061: syntax error: identifier 'soilGlGenerateMipmap' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(176): error C2059: syntax error: ';' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(176): error C2513: ' ': no variable declared before '=' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(196): error C2143: syntax error: missing '{' before '*' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(197): error C2061: syntax error: identifier 'soilGlGetStringiFunc' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(197): error C2059: syntax error: ';' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(197): error C2513: ' ': no variable declared before '=' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(205): warning C4013: 'glGetString' undefined; assuming extern returning int [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(205): error C2065: 'GL_VERSION': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(205): warning C4312: 'type cast': conversion from 'int' to 'const char *' of greater size [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(260): warning C4013: 'LoadLibraryA' undefined; assuming extern returning int [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(260): warning C4047: '=': 'HMODULE' differs in levels of indirection from 'int' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(262): warning C4013: 'wglGetProcAddress' undefined; assuming extern returning int [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(262): warning C4047: '=': 'void *' differs in levels of indirection from 'int' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(324): error C2065: 'GLint': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(324): error C2146: syntax error: missing ';' before identifier 'num_exts' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(324): error C2065: 'num_exts': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(325): error C2065: 'GLint': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(325): error C2146: syntax error: missing ';' before identifier 'i' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(325): error C2065: 'i': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(327): error C2065: 'soilGlGetStringiFunc': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(327): warning C4047: '==': 'void *' differs in levels of indirection from 'int' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(329): error C2065: 'soilGlGetStringiFunc': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(329): warning C4047: '=': 'int' differs in levels of indirection from 'int *(__cdecl *)()' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(329): error C2146: syntax error: missing ';' before identifier 'SOIL_GL_GetProcAddress' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(331): error C2065: 'soilGlGetStringiFunc': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(331): warning C4047: '==': 'void *' differs in levels of indirection from 'int' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(340): warning C4013: 'glGetIntegerv' undefined; assuming extern returning int [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(340): error C2065: 'num_exts': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(341): error C2065: 'i': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(341): error C2065: 'num_exts': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(343): warning C4013: 'soilGlGetStringiFunc' undefined; assuming extern returning int [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(343): error C2065: 'GL_EXTENSIONS': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(343): error C2065: 'i': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(343): warning C4312: 'type cast': conversion from 'int' to 'const char *' of greater size [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(356): error C2065: 'GL_EXTENSIONS': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(356): warning C4312: 'type cast': conversion from 'int' to 'const char *' of greater size [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(466): error C2065: 'GL_TEXTURE_2D': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(467): error C2065: 'GL_MAX_TEXTURE_SIZE': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(524): error C2065: 'GL_TEXTURE_2D': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(525): error C2065: 'GL_MAX_TEXTURE_SIZE': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(607): error C2065: 'GL_TEXTURE_2D': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(608): error C2065: 'GL_MAX_TEXTURE_SIZE': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(1337): error C2065: 'GL_TEXTURE_2D': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(1338): error C2065: 'GL_MAX_TEXTURE_SIZE': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(1369): warning C4013: 'soilGlGenerateMipmap' undefined; assuming extern returning int [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(1405): warning C4013: 'soilGlCompressedTexImage2D' undefined; assuming extern returning int [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(1414): warning C4013: 'glTexImage2D' undefined; assuming extern returning int [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(1417): error C2065: 'GL_UNSIGNED_BYTE': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(1426): error C2065: 'GL_UNSIGNED_BYTE': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(1461): error C2065: 'GLint': undeclared identifier [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
4>F:\tool\vcpkg\buildtrees\soil2\src\32950893d1-0aea9e88c5\src\SOIL2\SOIL2.c(1461): error C2146: syntax error: missing ';' before identifier 'unpack_aligment' [F:\tool\vcpkg\buildtrees\soil2\x64-uwp-dbg\soil2.vcxproj]
The last release is from 2017
Now, where we have Premake5 support and a changed license, it would be good to have a new release 😄
I have used the below command.
.\premake5.exe --os=windows vs2022 --verbose
when I try to build in vs2022 release x64 it gives me below error
when I debug x64 it succeeds
Build started... 1>------ Build started: Project: soil2-static-lib, Configuration: release x64 ------ 1>cl : command line warning D9025: overriding '/TC' with '/TP' 1>SOIL2.c 1>image_DXT.c 1>image_helper.c 1>wfETC.c 1>Generating Code... 1>D:\c_drive_installs\OpenGL_files\soil2\SOIL2\src\SOIL2\SOIL2.c(2247): fatal error C1001: Internal compiler error. 1>(compiler file 'D:\a\_work\1\s\src\vctools\Compiler\Utc\src\p2\main.c', line 220) 1> To work around this problem, try simplifying or changing the program near the locations listed above. 1>If possible please provide a repro here: https://developercommunity.visualstudio.com 1>Please choose the Technical Support command on the Visual C++ 1> Help menu, or open the Technical Support help file for more information 1>Done building project "soil2-static-lib.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
any suggestions would be really helpful
Apologies if there is some issue with my code/machine that I should have noticed. I'm using SOIL2 on Ubuntu 20.04, using G++ to compile it. I am returning a null type for the SOIL_load_OGL_cubemap function every time. An example code is:
GLuint textureRef;
textureRef = SOIL_load_OGL_cubemap("xp.jpg", "xn.jpg", "yp.jpg", "yn.jpg", "zp.jpg", "zn.jpg", SOIL_LOAD_RGB, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS);
if (textureRef == 0) std::cout << "Yeah... this shouldn't print but it does" << std::endl;
(xp.jpg etc. are all JPEG image files in the same folder as the code is being run)
I would mention that the rest of the SOIL2 library appears to work fine (and is massively useful). For example I regularly use SOIL_load_OGL_texture to load in textures (I'm actually using it in the same code which I am trying to implement the cubemap function.
Original report by Anonymous.
Hello !
I'm an openSUSE maintainer and I've seen your project. Is there any luck you publish tarballs ?
Regards.
Benjamin
Hi I try to install SOIL2 on macOs
unfortunately when I try to make it I got:
../../src/test/test_SOIL2.cpp:12:11: fatal error: 'SDL.h' file not found
#include <SDL.h>
I have install SDL via home-brew
Original report by Anonymous.
Hi!
I'm having problems loading a DDS file from memory. Loading it via "SOIL_load_OGL_texture" works perfectly while "SOIL_load_OGL_texture_from_memory" only partially loads the image with a corrupted palette.
Here's the code I'm using, maybe I'm missing something obvious.
#!c++
std::ifstream stream("test.dds", std::ios::ate);
size_t size = stream.tellg();
stream.seekg(0, std::ios::beg);
char* buffer = new char[size];
stream.read(buffer, size);
unsigned int id = SOIL_load_OGL_texture_from_memory
(
reinterpret_cast<unsigned char*>(buffer), size,
0, 0, SOIL_LOAD_AUTO
);
I've attached the DDS file I'm testing on and comparisons between outside and inside of the application.
Cheers!
Original report by Anonymous.
Hey I am having trouble opening a certain DDS file with this.
It's uncompressed.
Original report by Scott Gordon (Bitbucket: scottgordon, GitHub: scottgordon).
Martin,
My sincere apologies for posting this here... it's not really an "issue", and I hope that you can just delete it after you read it. Despite my best efforts, I haven't been able to figure out how to contact you. I am writing because I am authoring a new textbook on graphics programming in OpenGL, and I am using SOIL2 extensively in it. The book is under contract with a major publisher, and likely to have worldwide sales. I thought we should connect, because there is every reason to believe that the existence of this book has the potential of expanding the SOIL2 usage, and also because I thought you might want the opportunity to have some input into how SOIL2 is described in the book. If any of this interests you, please contact me at [email protected].
thanks!
-Scott Gordon
Original report by Andy Adshead (Bitbucket: BaronKiko, GitHub: BaronKiko).
I am trying to compile this library for the switch under switchbrew/devkitpro so that I may load DDS files.
I get lots of undefined reference errors to opengl functions such as glTexImage2D
I have tried various changes to the include logic at the top of SOIL2.c with no luck, including removing all the ifdef's and just referencing opengl directly. I am able to reference these methods from my code without issue and the linker options are defined appropriately.
To replicate you can use this project https://github.com/BaronKiko/Ryujinx-OGL-Demos/tree/master/cubemap
Main still uses stbi which I am trying to upgrade from, an updated version that uses SOIL2 can be found here: https://gist.github.com/BaronKiko/6a77f0b84802feb9b4e14ca8f40578fb
You should only need devkitpro to compile it through msys2 using make. The output nro file can be loaded with yuzu or an actual switch. Ryujinx does technically work but there are issues I'm trying to fix, hence the creation of this demo.
Thank you for your time and help
I don't even know how to describe whats wrong cause I don't know
but I keep getting these errors
LNK2019 unresolved external symbol SOIL_free_image_data referenced in function "unsigned int __cdecl TextureFromFile(char const *,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,bool)" (?TextureFromFile@@YAIPEBDAEBV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@_N@Z)
LNK2019 unresolved external symbol SOIL_load_image referenced in function "unsigned int __cdecl TextureFromFile(char const *,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,bool)" (?TextureFromFile@@YAIPEBDAEBV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@_N@Z)
and they wont do away. I have googled the problem but didn't get an answer. I have google and made sure I set SOIL2 up properly I don't know what I did wrong or how to fix the problem.
I was tried to build project with CMake but it failed. The file jo_jpeg.h was removed in the latest commit, but CMakeLists.txt not updated.
Original report by Croydon (Bitbucket: Croydon, GitHub: Croydon).
Bitbucket will remove all Mercurial repositories on June 1, 2020
Please, at the very least migrate to git and stay on Bitbucket or, which I would recommend, move to another hoster, who doesn't decide to just remove mass data within such a small time window
https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket
https://community.atlassian.com/t5/Bitbucket-articles/What-to-do-with-your-Mercurial-repos-when-Bitbucket-sunsets/ba-p/1155380
Original report by Anonymous.
Hi, I use soil2,and I want soil2 can support a16r16g16b16 and a32r32g32b32 dds texture,both 2d texture and cubemap. if soil2 can also support 3d volume and dxt5_nm dds texture,that will be great. thanks for your great job!
Original report by Michael IV (Bitbucket: Krioboss, ).
Hi.Don't you think the following chunk that validates cubemap dimensions is wrong?I mean,what sort of texture size is that where the width must be 6 times bigger than height and height must be 6 times bigger than width?It doesn't make sense.
#!c
if( (width != 6*height) &&
(6*width != height) )
{
SOIL_free_image_data( img );
result_string_pointer = "Single cubemap image must have a 6:1 ratio";
return 0;
}
Original report by Vadim Melnicuk (Bitbucket: vadimmelnicuk, GitHub: vadimmelnicuk).
I am getting the list of following errors while linking static library on Windows using CMake:
#!c
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x10a0b): undefined reference to `wglGetProcAddress@4'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x10ab0): undefined reference to `glGetIntegerv@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x10f9b): undefined reference to `glReadPixels@28'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x11cd7): undefined reference to `glGetError@0'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x11e90): undefined reference to `glGetIntegerv@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x11eb2): undefined reference to `glPixelStorei@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x11fc5): undefined reference to `glGetError@0'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x1204f): undefined reference to `glGetError@0'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x12118): undefined reference to `glPixelStorei@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x12228): undefined reference to `glPixelStorei@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x12506): undefined reference to `glGetIntegerv@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x1280f): undefined reference to `glGetIntegerv@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x1282d): undefined reference to `glPixelStorei@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x12a8d): undefined reference to `glPixelStorei@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x12c93): undefined reference to `glGetIntegerv@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x12cb1): undefined reference to `glPixelStorei@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x1311d): undefined reference to `glGetIntegerv@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x14556): undefined reference to `glGetError@0'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x14590): undefined reference to `glGetIntegerv@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x145ae): undefined reference to `glPixelStorei@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x14621): undefined reference to `glGetError@0'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x14642): undefined reference to `glPixelStorei@8'
C:/.../lib/windows/libsoil2.a(SOIL2.o):SOIL2.c:(.text+0x14763): undefined reference to `glPixelStorei@8'
Original report by Anonymous.
Obviously following the README file you have provided. Running Debian Jessie with the premake4 executable (I would hope that the package of the same base version number would be compatible).
premake4 gmake, generates the expected hierarchy "make/linux/Makefile".
When running the makefile I run into the problem
"'for’ loop initial declarations are only allowed in C99 or C11 mode"
which appears to be the same/similar problem you were trying to avoid with VS with it's non support of C99. I've tried adding the relevant -std=c99 compiler flags to what 'appears' to be the correct location within the .lua premake file but to no avail. Any suggestions?
Original report by Anonymous.
The query* functions are using 'glGetString(GL_EXTENSIONS)' which has been deprecated in OpenGL 3.0 and removed in core profile 3.1
I am using visual studio 2019 and whenever I try to compile I get this error coming from some of the SOIL2 files
'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
how can I fix this I tried putting #define _CRT_SECURE_NO_DEPRECATE
at the beginning of the offending files but it completely messed everything up. what can I do to fix this?
Is SOIL2 threadsafe? Always?
I would love to use such a library to decode textures in parallel (OpenGL textures will be created in render context after)
jpg/png should be fine, I know stb_image have no problems with it. But what about dds and etc?
Original report by Tobias Dæ (Bitbucket: r-or, GitHub: r-or).
There's an issue with the platform symbols used in SOIL2.c, tested with gcc 4.9 arm:
When building for android, both ANDROID and linux are defined.
So we could replace line 24 in SOIL2.c:
#!c
#if defined ( linux ) || defined( __linux__ ) || defined( __FreeBSD__ ) || defined(__OpenBSD__) || defined( __NetBSD__ ) || defined( __DragonFly__ ) || defined( __SVR4 )
#define SOIL_X11_PLATFORM
#endif
with something like this:
#!c
#if ( defined ( linux ) || defined( __linux__ ) || defined( __FreeBSD__ ) || defined(__OpenBSD__) || defined( __NetBSD__ ) || defined( __DragonFly__ ) || defined( __SVR4 )) && ! defined( __ANDROID__ )
#define SOIL_X11_PLATFORM
#endif
this way it builds just fine.
Original report by Anonymous.
Hi,
I've found the glReadPixels call in the SOIL_save_screenshot function occasionally corrupts the heap (depending on odd screen dimensions).
I believe its due to the GL_PACK_ALIGNMENT not being set. My fix is to surround the glReadPixels call with the following:
GLuint nOrgAlignment = 0;
glGetIntegerv(GL_PACK_ALIGNMENT, &nOrgAlignment);
// Ensure proper alignment
if(nOrgAlignment != 1)
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixel_data);
// Restore original alignment
if (nOrgAlignment != 1)
glPixelStorei(GL_PACK_ALIGNMENT, nOrgAlignment);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.