This compiles fine but crashes the program. If I use glfwLoadTexture2D() (which is not what I want :P) it doesn’t crash, so I guess the image i’m using is fine, right?
"pointer1" must be a valid memory area - glfwReadImage does not create the GLFWimage stuct for you, it simply fills out its fields. Also, do not forget to call glfwFreeImage once you are done with your image.
Ahhh cool it’s solved now. Thanks man! What a quick response Keep up the good work!
//here’s the code that works. Just added a line to allocate memory for the GLFWimage structure
GLFWimage *pointer1;
pointer1 = new GLFWimage;
const char name[] = “pointer1.tga”;
glfwReadImage ( name, pointer1, GLFW_NO_RESCALE_BIT );
Did you expect glfwReadImage() to allocate memory for you also? It doesn’t say that it does. It expects a pointer to a GLFWimage struct. It’s labeled as ‘in’ not ‘out’.