1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
#include <windows.h> // Header File For Windows
#include <stdio.h> // Header File For Standard Input / Output
#include <stdarg.h> // Header File For Variable Argument Routines
#include <stdafx.h> // Header File For Variable Argument Routines
#include <gl\gl.h> // Header File For The OpenGL32 Library
#include <gl\glu.h> // Header File For The GLu32 Library
#include <gl\glaux.h> // Header File For The Glaux Library
using namespace System;
typedef struct tagMAPDATA
{
char Route[128];
char Name[20];
char Image[128];
char Description[100];
GLuint ImageData;
}MAPDATA;
typedef struct tagMAP
{
MAPDATA* MapData;
}MAP;
MAP Map1;
int LoadImage(char* image, int loopy) // Load Bitmaps And Convert To Textures
{
int Status=FALSE; // Status Indicator
AUX_RGBImageRec *RegSystemImage[1]; // Create Storage Space For The Textures
memset(RegSystemImage,0,sizeof(void *)*1); // Set The Pointer To NULL
if ((RegSystemImage[0]=LoadBMP(image))) // Load The Font
{
Status=TRUE; // Set The Status To TRUE
glGenTextures(1, &Map1.MapData[loopy].ImageData); // Create The Texture
// Typical Texture Generation Using Data From The Bitmap
glBindTexture(GL_TEXTURE_2D, Map1.MapData[loopy].ImageData);
glTexImage2D(GL_TEXTURE_2D, 0, 3, RegSystemImage[0]->sizeX, RegSystemImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, RegSystemImage[0]->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}
if (RegSystemImage[0]) // If Texture Exists
{
if (RegSystemImage[0]->data) // If Texture Image Exists
{
free(RegSystemImage[0]->data); // Free The Texture Image Memory
}
free(RegSystemImage[0]); // Free The Image Structure
}
return Status; // Return The Status
}
int main(array<System::String ^> ^args)
{
bool done = false;
Console::WriteLine(L"Preparing for tests");
while(!done)
{
Console::ReadLine();
int limit = 10;
int counter = 0;
Map1.MapData = new MAPDATA[limit];
while(counter < limit)
{
strcpy(Map1.MapData[counter].Description,"A simple but a little long lenght description, sorry by my bad english");
strcpy(Map1.MapData[counter].Name,"Alpha Test is called");
strcpy(Map1.MapData[counter].Image,"This is supposed to be a route like Images/Something/idk.bmp");
strcpy(Map1.MapData[counter].Route,"This is supposed to be a route like Files/Something/idk.txt");
Map1.MapData[counter].ImageData = 500;
LoadImage(Map1.MapData[counter].Image,counter);
counter++;
}
Console::ReadLine();
delete[] Map1.MapData;
counter = 0;
}
return 0;
}
|