Hi,
I tried to texture a cube using FreeImage. However, each time I call glTexImage2D the program crashes.
I (up)load the Texture with the following code:
Code :GLuint TextureHandle = 0; FIBITMAP* Image = 0; int ImageWidth = 0; int ImageHeight = 0; FIBITMAP* tmp; FREE_IMAGE_FORMAT Format; const char *File = "~/Bilder/lavaPathTraceTest.png" FreeImage_Initialize(); Format= FreeImage_GetFileType(File,0); tmp = FreeImage_Load(Format,File); Image = FreeImage_ConvertTo32Bits(tmp); FreeImage_Unload(tmp); ImageWidth = FreeImage_GetWidth(Image); ImageHeight = FreeImage_GetHeight(Image); if(TextureHandle == 0){ glGenTextures(1,&TextureHandle); checkOpenGLErrors(); } //this works perfectly //FreeImage_Save(Format,Image,"/home/alex/Bilder/FreeImageSave",0); glBindTexture(GL_TEXTURE_2D,TextureHandle); checkOpenGLErrors(); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,getTextureFilter(MagFilter)); checkOpenGLErrors(); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,getTextureFilter(MinFilter)); checkOpenGLErrors(); //this crashes with SIGSEGV glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,ImageWidth,ImageHeight, 0,GL_BGRA,GL_UNSIGNED_BYTE,(GLvoid *) Image); checkOpenGLErrors();
Saving the image works perfectly and non of the checkOpenGLErrors calls reports an error.
The texture is a 4096x4096 png image.
glGetIntegerv(GL_MAX_TEXTURE_SIZE) reports 16384.
I'm using an OpenGL 4.0 forward compatible context with a GTS450 on Ubuntu 12.10.
Thanks in advance,
Apoptose



Reply With Quote

