00001 /*!@file GUI/Texture.H test opengl viewport */ 00002 00003 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2003 // 00004 // by the University of Southern California (USC) and the iLab at USC. // 00005 // See http://iLab.usc.edu for information about this project. // 00006 // //////////////////////////////////////////////////////////////////// // 00007 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00008 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00009 // in Visual Environments, and Applications'' by Christof Koch and // 00010 // Laurent Itti, California Institute of Technology, 2001 (patent // 00011 // pending; application number 09/912,225 filed July 23, 2001; see // 00012 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00013 // //////////////////////////////////////////////////////////////////// // 00014 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00015 // // 00016 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00017 // redistribute it and/or modify it under the terms of the GNU General // 00018 // Public License as published by the Free Software Foundation; either // 00019 // version 2 of the License, or (at your option) any later version. // 00020 // // 00021 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00022 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00023 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00024 // PURPOSE. See the GNU General Public License for more details. // 00025 // // 00026 // You should have received a copy of the GNU General Public License // 00027 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00028 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00029 // Boston, MA 02111-1307 USA. // 00030 // //////////////////////////////////////////////////////////////////// // 00031 // Primary maintainer for this file: Lior Elazary <elazary@usc.edu> 00032 // Originally obtained from ode 00033 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/GUI/Texture.H $ 00034 // $Id: Texture.H 12951 2010-03-05 19:06:12Z lior $ 00035 00036 #ifndef Texture_H 00037 #define Texture_H 00038 00039 #include <GL/gl.h> 00040 #include <GL/glu.h> 00041 #include <stdio.h> 00042 #include "Util/log.H" 00043 00044 #ifdef INVT_HAVE_LIBGLUT 00045 #include <GL/glu.h> 00046 #endif 00047 00048 //*************************************************************************** 00049 // PPM image object 00050 00051 typedef unsigned char byte; 00052 00053 class VPImage { 00054 int image_width,image_height; 00055 byte *image_data; 00056 public: 00057 VPImage (const char *filename); 00058 // load from PPM file 00059 ~VPImage(); 00060 int width() { return image_width; } 00061 int height() { return image_height; } 00062 byte *data() { return image_data; } 00063 void skipWhiteSpace (const char *filename, FILE *f); 00064 int readNumber (const char *filename, FILE *f); 00065 bool itsInitialized; 00066 00067 }; 00068 00069 //*************************************************************************** 00070 // Texture object. 00071 00072 class Texture { 00073 VPImage *image; 00074 GLuint name; 00075 public: 00076 Texture (const char *filename); 00077 ~Texture(); 00078 void bind (int modulate); 00079 bool initialized() { return itsInitialized; } 00080 GLuint getName() { return name; } 00081 bool itsInitialized; 00082 }; 00083 00084 #endif 00085