Есть исходное изображение bmp размера 960*495
Вот такое в программе
Вот код:
void FileReader::FileReader__(const char__ *filename,const char__ *state)
{
std::string ext="";
int__ l=strlen(filename);
while(--l>0&&filename[l]!='.')
ext+=filename[l];
if(strstr(ext.c_str(),"fnoc") || strstr(ext.c_str(),"lmx"))
{
ext_=true;
file=fopen(filename,state);
open_=true;
char__ ch;
while((ch=fgetc(file))!=-1)
{
if(ch==10)
strokoffile++;
countbyte++;
}
fclose(file);
file=fopen(filename,state);
}
else
{
life=open(filename,_A_ARCH);
ext_=false;
org=0;
}
}
void__ FileReader::ReadFile(int__ size_,void__ *buf)
{
lseek(life,0,org);
read(life,buf,size_);
org=1;
}
void__ Scene::EnableTexture(float__*texcoor, float__*vercoor)
{
glBegin(GL_QUADS);
glTexCoord2f(texcoor[0],texcoor[2]);
glVertex2f(vercoor[0],vercoor[2]);
glTexCoord2f(texcoor[1],texcoor[2]);
glVertex2f(vercoor[1],vercoor[2]);
glTexCoord2f(texcoor[1],texcoor[3]);
glVertex2f(vercoor[1],vercoor[3]);
glTexCoord2f(texcoor[0],texcoor[3]);
glVertex2f(vercoor[0],vercoor[3]);
glEnd();
}
NewData=new uchar__[4*960*495];
NewTexture=new uint__[1];
void__ Scene::ShowBackGround()
{
filereader->FileReader__("J:\\фукрпкявамчс\\content\\Загрузки\\table.bmp","r");
filereader->ReadFile(960*495*4,NewData);
for(float__ i=0;i<960*495;i++)
{
int__ index=i*4;
uchar__ R,G,B,A;
B=NewData[index];
G=NewData[index+1];//Green(B)
A=NewData[index+2];//Red(G)
R=NewData[index+3];//blue(R)
NewData[index]=R;
NewData[index+1]=G;//(G)
NewData[index+2]=B;//(B)
NewData[index+3]=A;//(R)
//GBR
//BGsR
}
glBindTexture(GL_TEXTURE_2D,NewTexture[0]);
gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA,960,495,GL_RGBA,GL_UNSIGNED_BYTE,NewData);
EnableTexture(GetTextureCoordinats(10),GetVertexCoordinats(0));
return;
}
В чем ошибка?