WhirlyGlobe  1.2
A 3D interactive globe toolkit for iOS
/Users/sjg/iPhone/WhirlyGlobe/WhirlyGlobeSrc/WhirlyGlobeLib/include/Texture.h
00001 /*
00002  *  Texture.h
00003  *  WhirlyGlobeLib
00004  *
00005  *  Created by Steve Gifford on 2/7/11.
00006  *  Copyright 2011 mousebird consulting
00007  *
00008  *  Licensed under the Apache License, Version 2.0 (the "License");
00009  *  you may not use this file except in compliance with the License.
00010  *  You may obtain a copy of the License at
00011  *  http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  *  Unless required by applicable law or agreed to in writing, software
00014  *  distributed under the License is distributed on an "AS IS" BASIS,
00015  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  *  See the License for the specific language governing permissions and
00017  *  limitations under the License.
00018  *
00019  */
00020 
00021 #import <UIKit/UIKit.h>
00022 #import <OpenGLES/ES1/gl.h>
00023 #import <OpenGLES/ES1/glext.h>
00024 #import <OpenGLES/ES2/gl.h>
00025 #import <OpenGLES/ES2/glext.h>
00026 
00027 #import "Identifiable.h"
00028 #import "WhirlyVector.h"
00029 
00030 namespace WhirlyGlobe
00031 {
00032 
00039 class Texture : public Identifiable
00040 {
00041 public:
00043         Texture();
00045         Texture(NSData *texData,bool isPVRTC);
00047         Texture(NSString *baseName,NSString *ext);
00049         Texture(UIImage *inImage);
00050         
00051         ~Texture();
00052         
00053         GLuint getGLId() const { return glId; }
00054         
00056         bool createInGL(bool releaseData=true);
00057         
00059         void destroyInGL();
00060 
00062     void setWidth(unsigned int newWidth) { width = newWidth; }
00064     void setHeight(unsigned int newHeight) { height = newHeight; }
00066     void setUsesMipmaps(bool use) { usesMipmaps = use; }
00067         
00068 protected:
00070         NSData *texData;
00072         bool isPVRTC;
00073         
00074         unsigned int width,height;
00075     bool usesMipmaps;
00076         
00079         GLuint glId;
00080 };
00081         
00082 }