Loading 2-D textures

Started by
4 comments, last by g7tommyB 21 years, 7 months ago
Hi, I have a texture loading method LoadBMP in my TEXTURE class. It seems to fail right here in the code: glTexImage2D(GL_TEXTURE_2D, 0, bpp, width, height, 0, bpp, GL_UNSIGNED_BYTE, data); It does work for certain textures (the ones that I download of the web for my MS3D models), however it especially does not like PhotoShop and everything that I create in PhotoShop craps out. All my textures I 256x256 picels, so I know that is not an issue for sure. Maybe some of you experienced a similiar problem and would be able to help. I am basically getting an illegal memory reference error in Windows, when the above function executes. Any help would be greatly appreciated. Thanks in advance. TommyB
g7tommyB
Advertisement
quote:Original post by g7tommyB
glTexImage2D(GL_TEXTURE_2D, 0, bpp, width, height, 0, bpp, GL_UNSIGNED_BYTE, data);


Try this


    char* errorCode;glTexImage2D(GL_TEXTURE_2D, 0, bpp, width, height, 0, bpp, GL_UNSIGNED_BYTE, data);errorCode = (char*)gluErrorString(glGetError());MessageBox(NULL, errorCode, "OpenGL Error", MB_OK);    


If openGL doesn't like what your doing, it'll give you an error that you can check with that function. It will probably return 'invalid enumerator' or 'invalid value' if there is a problem.

Hope that helps






"With my feet upon the ground I lose myself between the sounds and open wide to suck it in, I feel it move across my skin. I'm reaching up and reaching out. I'm reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one's been. We'll ride the spiral to the end and may just go where no one's been." - Maynard James Keenan [TheBlackJester ]
[Wildfire Studios ]

[edited by - TheBlackJester on September 1, 2002 3:30:05 PM]

"With my feet upon the ground I lose myself between the sounds and open wide to suck it in, I feel it move across my skin. I'm reaching up and reaching out. I'm reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one's been. We'll ride the spiral to the end and may just go where no one's been." - Maynard James Keenan Name: [email=darkswordtbj@hotmail.com]TheBlackJester[/email]Team: Wildfire Games
Projects O A.D.The Last Alliance

Thanks for the help.
It''s weird, because the glTexImage2D function returns ''invalid inumerator'' on the "good" textures (textures that do not cause the memory fault). However, the memory fault (seg fault if you will) is caused prior to the completion of this function, therefore the function never returns and thus the error code can not be captured
But thanks anyways, now at least I know how to capure gl error codes and display them on the screen. Thank you for that.
The original problem still exists, however

=tommyB=

TommyB
g7tommyB
Thanks for the help.
It''s weird, because the glTexImage2D function returns ''invalid inumerator'' on the "good" textures (textures that do not cause the memory fault). However, the memory fault (seg fault if you will) is caused prior to the completion of this function, therefore the function never returns and thus the error code can not be captured
But thanks anyways, now at least I know how to capure gl error codes and display them on the screen. Thank you for that.
The original problem still exists, however

=tommyB=

TommyB
g7tommyB
Try changing it to this:


  glTexImage2D(GL_TEXTURE_2D, 0, 3, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);  
-----For I have seen the face of evil and it will not soon be forgotten.
I rewrote the texture loading routine and made it much simpler and now everything works as expected. Thanks for the help guys.
g7tommyB

This topic is closed to new replies.

Advertisement