INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

gltexture.h

00001 /*
00002 * Orca-Robotics Project: Components for robotics 
00003 *               http://orca-robotics.sf.net/
00004 * Copyright (c) 2007-2009 Tom Burdick <thomas.burdick@gmail.com>
00005 *
00006 * This copy of Orca is licensed to you under the terms described in
00007 * the LICENSE file included in this distribution.
00008 *
00009 */
00010 
00011 #ifndef HYDRO_GLU_GLTEXTURE_H
00012 #define HYDRO_GLU_GLTEXTURE_H
00013 
00014 #include "exceptions.h"
00015 
00016 #include <string>
00017 
00018 #include <GL/glew.h>
00019 #include <GL/gl.h>
00020 
00021 #include "glerrorutil.h"
00022 
00023 #include <IceUtil/Shared.h>
00024 #include <IceUtil/Handle.h>
00025 
00026 #include <hydroimage/structures.h>
00027 
00028 namespace hydroglu
00029 {
00030 class GLTexture;
00031 
00036 typedef IceUtil::Handle<GLTexture> GLTexturePtr;
00037 
00042 class GLTexture : public virtual IceUtil::Shared
00043 {
00044 public:
00045     GLTexture(std::string name, uint32_t width, uint32_t height, GLenum type=GL_TEXTURE_2D, GLenum format=GL_RGBA, bool dma=true); 
00046     
00047     ~GLTexture();
00048 
00049     void upload( const uint8_t* const buffer, size_t bufferSize, GLenum bufferFormat );
00050     void download( const uint8_t* buffer , GLenum bufferFormat );
00051 
00052     void bind() const;
00053     void unbind() const;
00054 
00055     void pushBind();
00056     void popBind();
00057 
00058     std::string name() const;
00059     GLuint handle() const;
00060     uint32_t width() const;
00061     uint32_t height() const;
00062     GLenum type() const;
00063     GLenum format() const;
00064     bool normalized() const;
00065 
00066     void setMinFilter(GLenum filter);
00067     void setMagFilter(GLenum filter);
00068     void setWrapS(GLenum wrapS);
00069     void setWrapT(GLenum wrapT);
00070 
00071 private:
00072     std::string name_;
00073     GLuint handle_;
00074     uint32_t width_;
00075     uint32_t height_;
00076     GLenum type_;
00077     GLenum format_;
00078     bool normalized_;
00079     bool dma_;
00080     GLuint pushedHandle_;
00081     GLuint buffer_;
00082 };
00083 
00084 #define TEXCOORD_BL(tex) 0.0, 0.0
00085 #define TEXCOORD_TL(tex) 0.0, tex->normalized() ? 1.0 : tex->height()
00086 #define TEXCOORD_BR(tex) tex->normalized() ? 1.0 : tex->width(), 0.0 
00087 #define TEXCOORD_TR(tex) tex->normalized() ? 1.0 : tex->width(), tex->normalized() ? 1.0 : tex->height()
00088 
00089 
00090 }
00091 
00092 #endif
00093 
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5