Question

I can load 725x483 jpg texture but not 725x544

the code:

texId = SOIL_load_OGL_texture(fileName, SOIL_LOAD_AUTO, 
                              SOIL_CREATE_NEW_ID, 0);

I got error: Access violation reading location 0x06851002 - VS2012 express

I debugged SOIL a bit and it seems that the error comes just after we call glTexImage2D (in the SOIL library).

When I add SOIL_FLAG_MIPMAP to the loading code it works fine.

This error was on AMD (5570) and Intel (HD 4000) as well.

Was it helpful?

Solution

Solved, but I think it is worth to mention the solution:

  • use proper GL_UNPACK_ALIGNMENT, by default it is 4, but when I changed it to 1 it worked!
  • or change data format from SOIL_LOAD_AUTO to SOIL_RGBA. AUTO means original texture format and for jpg images it is RGB, so it can be problematic when unpack alignment is 4.

with SOIL_FLAG_MIPMAP soil actually rescales image to POT and that way there are no problems with unpack alignment size.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top