Need help reading in image for exam, C++\OpenGL

Associate
Joined
16 Nov 2011
Posts
966
Location
127.0.0.1
I have an exam coming up, it is a closed book lab based OpenGL exam in C++. I might have to read in an image for texturing, the only problem is that the code that I have access to in the exam is not compatible with the IDE (Visual Studio 2012), the guy that wrote it uses Linux and used fopen.

So, I need a good simple way to read in an image in C++, without fopen, that I can memories for the exam. Or perhaps a way to convert old fopen code to code that will work with Visual Studio by using fopen_s or otherwise.
 
Soldato
Joined
11 Nov 2003
Posts
2,960
Location
London
if you exam is for c++ then it might be a good idea to avoid fopen and use proper c++ instead, use std::fstream to create a file stream and read the data from the file

what format is the graphics file in first of all ?
as this will depend how you read the file.

creating the texture in opengl is pretty easy really, but do you need to create the whole opengl renderer, or just the code to create the texture ?
 
Soldato
Joined
1 Feb 2006
Posts
3,397
Hi,
Go to NeHe site and have a look at the texture example. At the bottom you can download for many different versions.

I just complied a program i did that used the tga loading code from that site and it works in visual studio 2012.
 
Back
Top Bottom