Jump to content
  • Advertisement
Sign in to follow this  
Peyman Tahghighi

Using soil crash

This topic is 2036 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i'm using Soil library to load textures,here is my function to do this:

GLuint LoadTexture(std::string file)
{
GLuint texture;
texture = SOIL_load_OGL_texture(
file.c_str(),
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_POWER_OF_TWO
| SOIL_FLAG_MIPMAPS
| SOIL_FLAG_MULTIPLY_ALPHA
| SOIL_FLAG_COMPRESS_TO_DXT
| SOIL_FLAG_DDS_LOAD_DIRECT
| SOIL_FLAG_INVERT_Y
);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
return texture;
}

and i use this as follows:

this->texture2DObj = vShader->LoadTexture("PlayerCar.jpg");
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, this->texture2DObj);

// Set the sampler texture unit to 0
glUniform1i(1, 0);
// Wrap texture coordinates by repeating
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

but it has an Unhandled exception in SOIL_load_OGL_texture! my first question is what's wrong with it? and the second one is after this what i have to do to show texture on screen?

 

 

Here is my error message: First-chance exception at 0x6E754A2D (msvcr120d.dll) in 06_Textures.exe: 0xC0000005: Access violation reading location 0x00000000.

Edited by PeymanKOP

Share this post


Link to post
Share on other sites
Advertisement
Where in your code does the stack trace point? (enable debugger intervention under debug->exceptions->win32_exceptions for access violations if you have not done so)

By the error i would guess you are trashing some memory or calling some std functions with null_ptr when an actual value was expected. Does not seem to be related to OpenGL.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!