Textures (Loading as resource or from file)
Hello to all,
I have a small program that has 4 256x256 raw files compiled in as a resource and the program loads them (as a resource) when ran and displays them on a cube.
I wanted to be able to choose (on the fly) a bitmap or another raw file by a button on a dialog that opens the GetOpenFileName dialog box and gets the bmp or raw file path+filename. If it is a bmp file I use the auxDIBImageLoad function and then create the texture using
glGenTextures(1, &texture[0]);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, CustTexture1[0]->sizeX, CustTexture1[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, CustTexture1[0]->data);
If is ia a raw file I use NeHe''s ReadTextureData to load the raw image and process the texture.
My problem/question is this...
If I have the raw file compiled in as a resource, It looks dark and rich on the cube. When I open the same raw file (or bmp) from a file, then it looks a lot lighter and kind of washed out. The light I have in the scene really seems bright on the texture when loaded from file even thought the light is the same all the time.
I can''t figure out why it looks so different. Whether the texture is loaded from resource or file, I basically create the texture the same way (see above). Can someone maybe enlighten me as to why it would look so different?
Thanks to all
NasMan
try it
instead of 3 as third parameter
" Do we need us? "
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, CustTexture1[0]->sizeX, CustTexture1[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, CustTexture1[0]->data);
instead of 3 as third parameter
" Do we need us? "
" Do we need us? "Ionware Productions - Games and Game Tools Development
Thanks,
That glTexImage2D call is basically what I''m doing.
I noticed something interesting though...I commented out the following line...
glGenTextures(1, &texture[0]);
that is called immediately before the glTexImage2D call.
This seems to have a very positive effect. The texture now looks more like it should.
I''m still looking...if anyone has any ideas, please post them.
Thanks
That glTexImage2D call is basically what I''m doing.
I noticed something interesting though...I commented out the following line...
glGenTextures(1, &texture[0]);
that is called immediately before the glTexImage2D call.
This seems to have a very positive effect. The texture now looks more like it should.
I''m still looking...if anyone has any ideas, please post them.
Thanks
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement