Texture.h
Go to the documentation of this file.00001 #ifndef _Texture_h
00002 #define _Texture_h
00003
00004 #include <stdlib.h>
00005 #include <iostream>
00006 #include <GL/glut.h>
00007 #include <cmath>
00008 #include <string>
00009 #include <errno.h>
00010 #include <string>
00011 #include <GL/glext.h>
00012 #include <stdio.h>
00013
00014 using namespace std;
00015
00016 #include <png.h>
00017 #include <jpeglib.h>
00018 #include <jerror.h>
00019
00020 #define MAX_SIZE_EXTENSION 15
00021
00022
00023 #define NO_FORMAT 0
00024 #define JPG_FORMAT 1
00025 #define PNG_FORMAT 2
00026
00027
00028
00029 class Texture
00030 {
00031 public:
00032 Texture();
00033 ~Texture();
00034
00035 int load_picture(const char* file_name);
00036 int export_ppm(const char* file_name);
00037
00038 int get_Nx();
00039 int get_Ny();
00040 int get_depth();
00041 unsigned char* get_data();
00042
00043 int get_nearest_texel(float s_1,float s_2,float *texel);
00044 int get_linear_texel(float s_1,float s_2,float *texel);
00045
00046 private:
00047 int load_png_picture(const char* file_name);
00048 int load_jpg_picture(const char* file_name);
00049
00050 int destroy();
00051
00052 int get_file_type(const char* filename);
00053
00054 int N_x,N_y;
00055 unsigned char *picture;
00056 int depth;
00057 };
00058
00059 #endif