PDA

View Full Version : Texture mapping



Finnish believer
10-28-2016, 06:26 AM
Whats wrong with this code ??

where should i put name of the file to be used as texture ??


AUX_RGBImageRec *LoadBMP(char *Filename) // Loads a bitmap image
{
FILE *File = NULL; // File handle

if (!Filename) // Make sure a filename was given
{
return NULL; // If not return NULL
}

File = fopen(Filename,"r"); // Check to see if the file exists

if (File) // Does the file exist?
{
fclose(File); // Close the handle
return auxDIBImageLoad(Filename); // Load the bitmap and return a pointer
}

return NULL; // If load failed return NULL
}

Dark Photon
10-28-2016, 05:57 PM
Have you read the tutorial this comes from?:

* http://nehe.gamedev.net/tutorial/texture_mapping/12038/

This is really, really old tutorial code (12+ years old). Did you see the comment at the top of it:



Important: This way of loading textures is deprecated and does not work anymore with current versions of Visual Studio. The theory of this tutorial is still valid though. An update of the code which is responsible for loading the texture can be found here: http://nehe.gamedev.net/tutorial/lesson_06_texturing_update/47002/

See Also:

* http://cboard.cprogramming.com/game-programming/59494-opengl-loading-bmp-textures.html
* https://www.opengl.org/discussion_boards/showthread.php/177183-Loading-Bmp-file-problem

flyingpengiun
11-08-2016, 12:28 PM
Whats wrong with this code ??
where should i put name of the file to be used as texture ??

Sorry to sound rude - but do you really think it makes sence to start with OpenGL when lacking even basic understanding of the programming language used?