Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
TEXTURE.H
Package: openglsystem.rar [view]
Upload User: nthssl
Upload Date: 2022-04-05
Package Size: 25357k
Code Size: 2k
Category:
OpenCV
Development Platform:
Visual C++
- #ifndef __TEXTURE_H
- #define __TEXTURE_H
- #define WIN32_LEAN_AND_MEAN
- #define WIN32_EXTRA_LEAN
- #include <windows.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <gl/gl.h>
- #include <gl/glu.h>
- #define BITMAP_ID 0x4D42 // the universal bitmap ID
- enum texTypes_t
- {
- PCX,
- BMP,
- TGA
- };
- // only partial pcx file header
- typedef struct
- {
- unsigned char manufacturer;
- unsigned char version;
- unsigned char encoding;
- unsigned char bits;
- unsigned char xMin;
- unsigned char yMin;
- unsigned char xMax;
- unsigned char yMax;
- unsigned char *palette;
- } PCXHEADER;
- typedef struct
- {
- unsigned char imageTypeCode;
- short int imageWidth;
- short int imageHeight;
- unsigned char bitCount;
- } TGAHEADER;
- class CTexture
- {
- private:
- long int scaledWidth;
- long int scaledHeight;
- unsigned char *palette;
- unsigned char *LoadBitmapFile(char *filename, BITMAPINFOHEADER *bitmapInfoHeader);
- unsigned char *LoadBitmapFileWithAlpha(char *filename, BITMAPINFOHEADER *bitmapInfoHeader);
- unsigned char *LoadPCXFile(char *filename, PCXHEADER *pcxHeader);
- unsigned char *LoadTGAFile(char *filename, TGAHEADER *tgaHeader);
- void LoadPCXTexture(char *filename);
- void LoadBMPTexture(char *filename);
- void LoadTGATexture(char *filename);
- public:
- texTypes_t textureType;
- unsigned char tgaImageCode; // 0 = not TGA image, 2 = color, 3 = greyscale
- int width;
- int height;
- int bitDepth;
- unsigned int texID;
- unsigned char *data;
- CTexture() { data = NULL; palette = NULL; }
- ~CTexture() { Unload(); }
- void LoadTexture(char *filename);
- void Unload()
- {
- glDeleteTextures(1, &texID);
- if (data != NULL)
- free(data);
- if (palette != NULL)
- free(palette);
- data = NULL;
- palette = NULL;
- }
- };
- #endif