Add texture bitmap loading dans simple exemple display on open gl

This commit is contained in:
Edouard Dupin 2011-10-28 18:19:04 +02:00
parent bcfffb599f
commit e6848d2d39
16 changed files with 579 additions and 14 deletions

View File

@ -168,6 +168,7 @@ CXXFILES += etk/etkDebug.cpp \
CXXFILES += ewol.cpp \
ewolDebug.cpp \
ewolOObject.cpp \
ewolTexture.cpp \
ewolWidget.cpp \
ewolWindows.cpp

View File

@ -74,11 +74,12 @@ void TOOLS_DisplayTime(void);
std::cout << "[" << info << "] " << data; \
std::cout << ETK_BASH_COLOR_NORMAL <<std::endl; \
}while(0)
#define ETK_CRITICAL(libName, data) ETK_DBG_COMMON(libName, ETK_BASH_COLOR_BOLD_RED, "CC", data)
#define ETK_WARNING(libName, data) ETK_DBG_COMMON(libName, ETK_BASH_COLOR_MAGENTA, "WW", data)
#define ETK_ERROR(libName, data) ETK_DBG_COMMON(libName, ETK_BASH_COLOR_BOLD_RED, "EE", data)
#define ETK_INFO(libName, data) ETK_DBG_COMMON(libName, ETK_BASH_COLOR_CYAN, "II", data)
#define ETK_DEBUG(libName, data) ETK_DBG_COMMON(libName, ETK_BASH_COLOR_YELLOW, "DD", data)
#define ETK_CRITICAL(libName, data) ETK_DBG_COMMON(libName, ETK_BASH_COLOR_BOLD_RED, 'C', data)
#define ETK_WARNING(libName, data) ETK_DBG_COMMON(libName, ETK_BASH_COLOR_MAGENTA, 'W', data)
#define ETK_ERROR(libName, data) ETK_DBG_COMMON(libName, ETK_BASH_COLOR_BOLD_RED, 'E', data)
#define ETK_INFO(libName, data) ETK_DBG_COMMON(libName, ETK_BASH_COLOR_CYAN, 'I', data)
#define ETK_DEBUG(libName, data) ETK_DBG_COMMON(libName, ETK_BASH_COLOR_YELLOW, 'D', data)
#define ETK_VERBOSE(libName, data) ETK_DBG_COMMON(libName, ETK_BASH_COLOR_WHITE, 'V', data)
#define ETK_ASSERT(libName, cond, data) do { \
if (!(cond)) { \
ETK_CRITICAL(libName, data); \

View File

@ -51,6 +51,12 @@ extern const char * etkLibName;
# define TK_DEBUG(data) do {}while(0)
#endif
#if ETK_DEBUG_LEVEL > 3
# define TK_VERBOSE(data) ETK_VERBOSE(etkLibName, data)
#else
# define TK_VERBOSE(data) do {}while(0)
#endif
#define TK_ASSERT(cond, data) ETK_ASSERT(etkLibName, cond, data)
#if ETK_DEBUG_LEVEL > 1

View File

@ -24,6 +24,7 @@
#include <etkTypes.h>
#include <etkDebugInternal.h>
#include <etkFile.h>
@ -144,14 +145,14 @@ void etk::File::SetCompleateName(etk::String &newFilename)
m_folder = "";
m_shortFilename = "";
m_lineNumberOpen = 0;
TK_DEBUG("1 :Set Name : " << newFilename );
TK_VERBOSE("1 :Set Name : " << newFilename );
etk::String destFilename;
if (newFilename.Size() == 0) {
destFilename = "no-name";
} else {
destFilename = newFilename;
}
TK_DEBUG("2 : Get file Name : " << destFilename );
TK_VERBOSE("2 : Get file Name : " << destFilename );
if ('/' != *destFilename.c_str()) {
// Get the command came from the running of the program :
char cCurrentPath[FILENAME_MAX];
@ -164,7 +165,7 @@ void etk::File::SetCompleateName(etk::String &newFilename)
destFilename += '/';
destFilename += tmpFilename;
}
TK_DEBUG("3 : Get file Name : " << destFilename );
TK_VERBOSE("3 : Get file Name : " << destFilename );
// Get the real Path of the current File
ok = realpath(destFilename.c_str(), buf);
@ -174,10 +175,10 @@ void etk::File::SetCompleateName(etk::String &newFilename)
// Get the FileName
etk::String tmpFilename = destFilename.Extract(lastPos+1);
destFilename.Remove(lastPos, destFilename.Size() - lastPos);
TK_DEBUG("try to find :\"" << destFilename << "\" / \"" << tmpFilename << "\" ");
TK_VERBOSE("try to find :\"" << destFilename << "\" / \"" << tmpFilename << "\" ");
ok = realpath(destFilename.c_str(), buf);
if (!ok) {
TK_ERROR("Can not find real Path name of \"" << destFilename << "\"");
TK_VERBOSE("Can not find real Path name of \"" << destFilename << "\"");
m_shortFilename = tmpFilename;
m_folder = destFilename;
} else {
@ -202,7 +203,7 @@ void etk::File::SetCompleateName(etk::String &newFilename)
m_shortFilename = destFilename;
}
}
TK_DEBUG("Set FileName :\"" << m_folder << "\" / \"" << m_shortFilename << "\" ");
TK_VERBOSE("Set FileName :\"" << m_folder << "\" / \"" << m_shortFilename << "\" ");
}
int32_t etk::File::GetLineNumber(void)
@ -242,3 +243,35 @@ etk::String etk::File::GetExtention(void)
}
return tmpExt;
}
int32_t etk::File::Size(void)
{
FILE *myFile=NULL;
etk::String myCompleateName = GetCompleateName();
myFile=fopen(myCompleateName.c_str(),"rb");
if(NULL == myFile) {
//EWOL_ERROR("Can not find the file name=\"" << m_folder << "\" / \"" << m_shortFilename << "\"");
return -1;
}
int32_t size = 0;
fseek(myFile, 0, SEEK_END);
size = ftell(myFile);
fseek(myFile, 0, SEEK_SET);
fclose(myFile);
return size;
}
bool etk::File::Exist(void)
{
FILE *myFile=NULL;
etk::String myCompleateName = GetCompleateName();
myFile=fopen(myCompleateName.c_str(),"rb");
if(NULL == myFile) {
return false;
}
fclose(myFile);
return true;
}

View File

@ -44,6 +44,8 @@ namespace etk
etk::String GetCompleateName(void) const;
bool HasExtention(void);
etk::String GetExtention(void);
int32_t Size(void);
bool Exist(void);
int32_t GetLineNumber(void);
void SetLineNumber(int32_t newline);
void SetCompleateName(etk::String &newFilename);

View File

@ -50,8 +50,8 @@ void ewol::OObject2DColored::Draw(void)
//EWOL_DEBUG("Draw ..." << m_coord.Size()/3 << " triangle(s)");
// Disable Pointers
glDisableClientState( GL_VERTEX_ARRAY );
glDisableClientState( GL_COLOR_ARRAY );
glDisableClientState( GL_VERTEX_ARRAY );
}

345
Sources/ewolTexture.cpp Normal file
View File

@ -0,0 +1,345 @@
/**
*******************************************************************************
* @file ewolTexture.cpp
* @brief ewol Texture loading system (sources)
* @author Edouard DUPIN
* @date 28/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewolTexture.h>
extern "C"
{
#pragma pack(push,1)
typedef struct
{
int16_t bfType;
int32_t bfSize;
int32_t bfReserved;
int32_t bfOffBits;
} bitmapFileHeader_ts;
typedef struct
{
int32_t biSize;
int32_t biWidth;
int32_t biHeight;
int16_t biPlanes;
int16_t biBitCount;
int32_t biCompression;
int32_t biSizeImage;
int32_t biXPelsPerMeter;
int32_t biYPelsPerMeter;
int32_t biClrUsed;
int32_t biClrImportant;
} bitmapInfoHeader_ts;
#pragma pack(pop)
typedef enum {
BITS_16_R5G6B5,
BITS_16_X1R5G5B5,
BITS_24_R8G8B8,
BITS_32_X8R8G8B8,
BITS_32_A8R8G8B8
} modeBitmap_te;
};
class Bitmap
{
private:
modeBitmap_te m_dataMode;
int32_t m_width;
int32_t m_height;
int32_t m_size;
uint8_t * m_data;
uint8_t * m_dataGenerate;
bitmapFileHeader_ts m_FileHeader;
bitmapInfoHeader_ts m_InfoHeader;
public:
Bitmap(etk::File & fileName) : m_data(NULL), m_dataGenerate(NULL)
{
m_dataMode = BITS_16_R5G6B5;
m_width = 0;
m_height = 0;
m_size = 0;
FILE *File=NULL;
// Get the fileSize ...
if (fileName.Size() < sizeof(bitmapFileHeader_ts) + sizeof(bitmapInfoHeader_ts) ) {
EWOL_ERROR("not enought data in the file named=\"" << fileName << "\"");
return;
}
unsigned int ImageIdx=0;
File=fopen(fileName.GetCompleateName().c_str(),"rb");
if(NULL == File) {
EWOL_ERROR("Can not find the file name=\"" << fileName << "\"");
return;
}
// get the data :
if (fread(&m_FileHeader,sizeof(bitmapFileHeader_ts),1,File) != 1) {
EWOL_ERROR("error loading file header");
fclose(File);
return;
}
if (fread(&m_InfoHeader,sizeof(bitmapInfoHeader_ts),1,File) != 1) {
EWOL_ERROR("error loading file header");
fclose(File);
return;
}
// TODO : do otherwise ...
fseek(File,m_FileHeader.bfOffBits,SEEK_SET);
if(ferror(File)) {
EWOL_ERROR("error with the 'bfOffBits' in the file named=\"" << fileName << "\"");
fclose(File);
return;
}
// Check the header error :
if (m_FileHeader.bfType != 0x4D42) {
EWOL_ERROR("the file=\"" << fileName << "\" is not a bitmap file ...");
fclose(File);
return;
}
if (m_FileHeader.bfReserved != 0x00000000) {
EWOL_ERROR("the bfReserved feald is not at 0 ==> not supported format ...");
fclose(File);
return;
}
if( m_InfoHeader.biBitCount == 16
&& m_InfoHeader.biCompression == 0)
{
m_dataMode = BITS_16_X1R5G5B5;
} else if( m_InfoHeader.biBitCount == 16
&& m_InfoHeader.biCompression == 3)
{
m_dataMode = BITS_16_R5G6B5;
} else if( m_InfoHeader.biBitCount == 24
&& m_InfoHeader.biCompression == 0)
{
m_dataMode = BITS_24_R8G8B8;
} else if( m_InfoHeader.biBitCount == 32
&& m_InfoHeader.biCompression == 3)
{
m_dataMode = BITS_32_X8R8G8B8;
} else if( m_InfoHeader.biBitCount == 32
&& m_InfoHeader.biCompression == 0)
{
m_dataMode = BITS_32_A8R8G8B8;
} else {
EWOL_ERROR("the biBitCount & biCompression fealds are unknow ==> not supported format ...");
fclose(File);
return;
}
m_width = m_InfoHeader.biWidth;
m_height = m_InfoHeader.biHeight;
if(0 != m_InfoHeader.biSizeImage)
{
m_data=new uint8_t[m_InfoHeader.biSizeImage];
fread(m_data,m_InfoHeader.biSizeImage,1,File);
// allocate the destination data ...
m_dataGenerate=new uint8_t[m_width*m_height*4];
}
fclose(File);
// need now to generate RGBA data ...
switch(m_dataMode)
{
case BITS_16_R5G6B5:
{
uint16_t * pointer = (uint16_t*)m_data;
uint8_t * pointerdst = m_dataGenerate;
for(int32_t yyy=0; yyy<m_height; yyy++) {
for(int32_t xxx=0; xxx<m_width; xxx++) {
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 0] = (int8_t)((*pointer & 0xF800) >> 8);
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 1] = (int8_t)((*pointer & 0x07E0) >> 3);
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 2] = (int8_t)(*pointer << 3);
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 3] = 0xFF;
pointer++;
}
}
}
break;
case BITS_16_X1R5G5B5:
{
uint16_t * pointer = (uint16_t*)m_data;
uint8_t * pointerdst = m_dataGenerate;
for(int32_t yyy=0; yyy<m_height; yyy++) {
for(int32_t xxx=0; xxx<m_width; xxx++) {
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 0] = (int8_t)((*pointer & 0x7C00) >> 7);
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 1] = (int8_t)((*pointer & 0x03E0) >> 2);
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 2] = (int8_t)(*pointer << 3);
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 3] = 0xFF;
pointer++;
}
}
}
break;
case BITS_24_R8G8B8:
{
uint8_t * pointer = m_data;
for(int32_t yyy=0; yyy<m_height; yyy++) {
for(int32_t xxx=0; xxx<m_width; xxx++) {
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 0] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 1] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 2] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 3] = 0xFF;
}
}
}
break;
case BITS_32_X8R8G8B8:
{
uint8_t * pointer = m_data;
for(int32_t yyy=0; yyy<m_height; yyy++) {
for(int32_t xxx=0; xxx<m_width; xxx++) {
pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 0] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 1] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 2] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 3] = 0xFF;
}
}
}
break;
case BITS_32_A8R8G8B8:
{
uint8_t * pointer = m_data;
for(int32_t yyy=0; yyy<m_height; yyy++) {
for(int32_t xxx=0; xxx<m_width; xxx++) {
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 0] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 1] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 2] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 3] = *pointer++;
}
}
}
break;
default:
EWOL_DEBUG(" mode = ERROR");
break;
}
}
~Bitmap(void)
{
if (NULL != m_data) {
delete(m_data);
}
if (NULL != m_dataGenerate) {
delete(m_dataGenerate);
}
}
bool LoadOK(void) { if (NULL != m_dataGenerate) { return true; } else { return false; } };
int32_t Width(void) { return m_width; };
int32_t Height(void) { return m_height; };
uint8_t * Data(void) { return m_dataGenerate; };
void Display(void)
{
if (NULL == m_data) {
EWOL_ERROR("Might loading error of this Bitmap ...");
return;
}
EWOL_DEBUG(" -----------------------------------------------------------");
if (true) {
EWOL_DEBUG("Display caracteristic of the bitmap : ");
EWOL_DEBUG(" Header of file :");
EWOL_DEBUG(" bfType =" << m_FileHeader.bfType << " 19778 : must always be set to 'BM' to declare that this is a .bmp-file.");
EWOL_DEBUG(" bfSize =" << m_FileHeader.bfSize << " specifies the size of the file in bytes.");
EWOL_DEBUG(" bfReserved=" << m_FileHeader.bfReserved << " must always be set to zero.");
EWOL_DEBUG(" bfOffBits =" << m_FileHeader.bfOffBits << " 1078 : specifies the offset from the beginning of the file to the bitmap data.");
EWOL_DEBUG(" info header of file :");
EWOL_DEBUG(" biSize =" << m_InfoHeader.biSize << " specifies the size of the BITMAPINFOHEADER structure, in bytes.");
EWOL_DEBUG(" biWidth =" << m_InfoHeader.biWidth << " specifies the width of the image, in pixels.");
EWOL_DEBUG(" biHeight =" << m_InfoHeader.biHeight << " specifies the height of the image, in pixels.");
EWOL_DEBUG(" biPlanes =" << m_InfoHeader.biPlanes << " specifies the number of planes of the target device, must be set to zero.");
EWOL_DEBUG(" biBitCount =" << m_InfoHeader.biBitCount << " specifies the number of bits per pixel.");
EWOL_DEBUG(" biCompression =" << m_InfoHeader.biCompression << " Specifies the type of compression, usually set to zero (no compression).");
EWOL_DEBUG(" biSizeImage =" << m_InfoHeader.biSizeImage << " specifies the size of the image data, in bytes. If there is no compression, it is valid to set this member to zero.");
EWOL_DEBUG(" biXPelsPerMeter=" << m_InfoHeader.biXPelsPerMeter << " specifies the the horizontal pixels per meter on the designated targer device, usually set to zero.");
EWOL_DEBUG(" biYPelsPerMeter=" << m_InfoHeader.biYPelsPerMeter << " specifies the the vertical pixels per meter on the designated targer device, usually set to zero.");
EWOL_DEBUG(" biClrUsed =" << m_InfoHeader.biClrUsed << " specifies the number of colors used in the bitmap, if set to zero the number of colors is calculated using the biBitCount member.");
EWOL_DEBUG(" biClrImportant =" << m_InfoHeader.biClrImportant << " specifies the number of color that are 'important' for the bitmap, if set to zero, all colors are important.");
}
EWOL_DEBUG("Bitmap : " << m_width << "x" << m_height);
switch(m_dataMode)
{
case BITS_16_R5G6B5:
EWOL_DEBUG(" mode = 16 bits R5G6B5");
break;
case BITS_16_X1R5G5B5:
EWOL_DEBUG(" mode = 16 bits X1R5G5B5");
break;
case BITS_24_R8G8B8:
EWOL_DEBUG(" mode = 24 bits R8G8B8");
break;
case BITS_32_X8R8G8B8:
EWOL_DEBUG(" mode = 32 bits X8R8G8B8");
break;
default:
EWOL_DEBUG(" mode = ERROR");
break;
}
}
};
#include <GL/gl.h>
#include <GL/glu.h>
int32_t ewol::LoadTexture(etk::File & fileName)
{
etk::String fileExtention = fileName.GetExtention();
if (fileExtention == "bmp") {
if (false == fileName.Exist()) {
EWOL_ERROR("File does not Exist ... " << fileName);
return -1;
}
Bitmap myBitmap(fileName);
myBitmap.Display();
if (myBitmap.LoadOK() == true) {
GLuint textureid;
glGenTextures(1, &textureid);
glBindTexture(GL_TEXTURE_2D, textureid);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//--- mode nearest
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//--- Mode linear
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, myBitmap.Width(), myBitmap.Height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, myBitmap.Data());
return textureid;
} else {
return -1;
}
} else {
EWOL_ERROR("Extention not manage " << fileName);
return -1;
}
}
void ewol::UnLoadTexture(int32_t textureID)
{
}

39
Sources/ewolTexture.h Normal file
View File

@ -0,0 +1,39 @@
/**
*******************************************************************************
* @file ewolTexture.h
* @brief ewol Texture loading system (header)
* @author Edouard DUPIN
* @date 28/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_TEXTURE_H__
#define __EWOL_TEXTURE_H__
#include <etkTypes.h>
#include <ewolDebug.h>
#include <etkFile.h>
namespace ewol
{
int32_t LoadTexture(etk::File & fileName);
void UnLoadTexture(int32_t textureID);
};
#endif

View File

@ -27,6 +27,7 @@
#include <ewolWidget.h>
#include <ewolWindows.h>
#include <ewolOObject.h>
#include <ewolTexture.h>
#include <GL/gl.h>
@ -58,6 +59,16 @@ bool ewol::Windows::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, d
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glx.h>
#include <GL/glut.h>
#if defined(EWOL_X11_MODE__XF86V)
# include <X11/extensions/xf86vmode.h>
#elif defined(EWOL_X11_MODE__XRENDER)
# include <X11/extensions/Xrender.h>
#endif
void ewol::Windows::SysDraw(void)
{
@ -84,6 +95,7 @@ void ewol::Windows::SysDraw(void)
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA);
//glBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR);
/*
@ -105,7 +117,12 @@ void ewol::Windows::SysDraw(void)
static ewol::OObject2DColored myOObject;
static bool isinit = false;
static int32_t texID1 = -1;
static int32_t texID2 = -1;
static int32_t texID3 = -1;
static int32_t texID4 = -1;
static int32_t texID5 = -1;
static int32_t texID6 = -1;
if (false == isinit) {
isinit=true;
@ -124,10 +141,131 @@ void ewol::Windows::SysDraw(void)
myOObject.Rectangle(50, 00, 300, 300, 0.2, 0.2, 0.2, 0.5);
//myOObject.Rectangle(-50, -50, 120, 120, 0.0, 1.0, 1.0, 0.5);
etk::File myFile("dataTest/test_16b_r5g6b5.bmp");
texID1 = LoadTexture(myFile);
myFile = "dataTest/test_16b_x1r5g5b5.bmp";
texID2 = LoadTexture(myFile);
myFile = "dataTest/test_24b_r8g8b8.bmp";
//texID3 = LoadTexture(myFile);
myFile = "dataTest/test_32b_x8r8g8b8.bmp";
//texID4 = LoadTexture(myFile);
myFile = "dataTest/test_16b_a1r5g5b5.bmp";
texID5 = LoadTexture(myFile);
myFile = "dataTest/test_32b_a8r8g8b8.bmp";
//texID6 = LoadTexture(myFile);
myOObject.Rectangle(300, 300, 50, 50, 1.0, 1.0, 1.0, 1.0);
myOObject.Rectangle(350, 350, 50, 50, 1.0, 0.0, 0.0, 1.0);
myOObject.Rectangle(400, 400, 50, 50, 0.0, 1.0, 0.0, 1.0);
myOObject.Rectangle(450, 450, 50, 50, 0.0, 0.0, 1.0, 1.0);
myOObject.Rectangle(500, 500, 50, 50, 0.0, 0.0, 0.0, 1.0);
}
myOObject.Draw();
if (texID3 > -1) {
glColor4f(1.0, 1.0, 1.0, 0.5);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texID3);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3f(300.0, 300.0, 0.0);
glTexCoord2f(1.0, 0.0);
glVertex3f(550.0, 300.0, 0.0);
glTexCoord2f(1.0, 1.0);
glVertex3f(550.0, 550.0, 0.0);
glTexCoord2f(0.0, 1.0);
glVertex3f(300.0, 550.0, 0.0);
glEnd();
glDisable(GL_TEXTURE_2D);
}
myOObject.Draw();
if (texID1 > -1) {
glColor4f(1.0, 1.0, 1.0, 1.0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texID1);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3f(300.0, 0.0, 0.0);
glTexCoord2f(1.0, 0.0);
glVertex3f(400.0, 0.0, 0.0);
glTexCoord2f(1.0, 1.0);
glVertex3f(400.0, 100.0, 0.0);
glTexCoord2f(0.0, 1.0);
glVertex3f(300.0, 100.0, 0.0);
glEnd();
glDisable(GL_TEXTURE_2D);
}
if (texID2 > -1) {
glColor4f(1.0, 1.0, 1.0, 1.0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texID2);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3f(300.0, 100.0, 0.0);
glTexCoord2f(1.0, 0.0);
glVertex3f(400.0, 100.0, 0.0);
glTexCoord2f(1.0, 1.0);
glVertex3f(400.0, 200.0, 0.0);
glTexCoord2f(0.0, 1.0);
glVertex3f(300.0, 200.0, 0.0);
glEnd();
glDisable(GL_TEXTURE_2D);
}
if (texID4 > -1) {
glColor4f(1.0, 1.0, 1.0, 1.0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texID4);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3f(300.0, 200.0, 0.0);
glTexCoord2f(1.0, 0.0);
glVertex3f(400.0, 200.0, 0.0);
glTexCoord2f(1.0, 1.0);
glVertex3f(400.0, 300.0, 0.0);
glTexCoord2f(0.0, 1.0);
glVertex3f(300.0, 300.0, 0.0);
glEnd();
glDisable(GL_TEXTURE_2D);
}
if (texID5 > -1) {
glColor4f(1.0, 1.0, 1.0, 1.0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texID5);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3f(400.0, 0.0, 0.0);
glTexCoord2f(1.0, 0.0);
glVertex3f(500.0, 0.0, 0.0);
glTexCoord2f(1.0, 1.0);
glVertex3f(500.0, 100.0, 0.0);
glTexCoord2f(0.0, 1.0);
glVertex3f(400.0, 100.0, 0.0);
glEnd();
glDisable(GL_TEXTURE_2D);
}
if (texID6 > -1) {
glColor4f(1.0, 1.0, 1.0, 1.0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texID6);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3f(400.0, 100.0, 0.0);
glTexCoord2f(1.0, 0.0);
glVertex3f(500.0, 100.0, 0.0);
glTexCoord2f(1.0, 1.0);
glVertex3f(500.0, 200.0, 0.0);
glTexCoord2f(0.0, 1.0);
glVertex3f(400.0, 200.0, 0.0);
glEnd();
glDisable(GL_TEXTURE_2D);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB