Archived

This topic is now archived and is closed to further replies.

Loading 2-D textures

This topic is 5579 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

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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites