当前位置: 首页>>代码示例>>C++>>正文


C++ LoadBMP函数代码示例

本文整理汇总了C++中LoadBMP函数的典型用法代码示例。如果您正苦于以下问题:C++ LoadBMP函数的具体用法?C++ LoadBMP怎么用?C++ LoadBMP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LoadBMP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LoadGLTextures

int LoadGLTextures()                                    // Load Bitmaps And Convert To Textures
{
    int Status=FALSE;									// Status Indicator
    AUX_RGBImageRec *TextureImage[3];					// Create Storage Space For The Textures
    memset(TextureImage,0,sizeof(void *)*3);			// Set The Pointer To NULL
    if ((TextureImage[0]=LoadBMP("Data/EnvWall.bmp")) &&// Load The Floor Texture
        (TextureImage[1]=LoadBMP("Data/Ball.bmp")) &&	// Load the Light Texture
        (TextureImage[2]=LoadBMP("Data/EnvRoll.bmp")))	// Load the Wall Texture
	{   
		Status=TRUE;									// Set The Status To TRUE
		glGenTextures(3, &texture[0]);					// Create The Texture
		for (int loop=0; loop<3; loop++)				// Loop Through 5 Textures
		{
			glBindTexture(GL_TEXTURE_2D, texture[loop]);
			glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[loop]->sizeX, TextureImage[loop]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[loop]->data);
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
		}
		for (loop=0; loop<3; loop++)					// Loop Through 5 Textures
		{
			if (TextureImage[loop])						// If Texture Exists
			{
				if (TextureImage[loop]->data)			// If Texture Image Exists
				{
					free(TextureImage[loop]->data);		// Free The Texture Image Memory
				}
				free(TextureImage[loop]);				// Free The Image Structure 
			}
		}
	}
	return Status;										// Return The Status
}
开发者ID:xtmacbook,项目名称:OpenGL_NeHe,代码行数:32,代码来源:Lesson26.cpp

示例2: chargerTextures

void chargerTextures()
{	
    SImage* Image = NULL;

    if( Image = LoadBMP("textures/stonewalldiffuse.bmp" ) )
    {
        glGenTextures( 1, &Variable::texture0 );
        init2DTexture(Variable::texture0, Image->width, Image->height, Image->data );
        delete Image;
    }

    if( Image = LoadBMP( "textures/rust.bmp" ) )
    {
        glGenTextures( 1, &Variable::texture1 );
        init2DTexture(Variable::texture1, Image->width, Image->height, Image->data );
        delete Image;
    }

    if( Image = LoadBMP( "textures/3dlabs.bmp" ) )
    {
        glGenTextures( 1, &Variable::texture2 );
        init2DTexture(Variable::texture2, Image->width, Image->height, Image->data );
        delete Image;
    }
}
开发者ID:Eric-Morissette,项目名称:INF8702,代码行数:25,代码来源:main.cpp

示例3: LoadGLTextures

int LoadGLTextures()										// Load Bitmaps And Convert To Textures
{
        int Status=FALSE;									// Status Indicator
        AUX_RGBImageRec *TextureImage[2];					// Create Storage Space For The Textures
        memset(TextureImage,0,sizeof(void *)*2);			// Set The Pointer To NULL

        if ((TextureImage[0]=LoadBMP("Data/Font.bmp")) &&	// Load The Font
			(TextureImage[1]=LoadBMP("Data/Image.bmp")))	// Load Background Image
        {
			Status=TRUE;									// Set The Status To TRUE

			glGenTextures(2, &texture[0]);					// Create The Texture

			for (loop1=0; loop1<2; loop1++)					// Loop Through 2 Textures
			{
				glBindTexture(GL_TEXTURE_2D, texture[loop1]);
				glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[loop1]->sizeX, TextureImage[loop1]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[loop1]->data);
				glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
				glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
			}

			for (loop1=0; loop1<2; loop1++)					// Loop Through 2 Textures
			{
				if (TextureImage[loop1])					// If Texture Exists	
				{
					if (TextureImage[loop1]->data)			// If Texture Image Exists
					{
						free(TextureImage[loop1]->data);	// Free The Texture Image Memory
					}
					free(TextureImage[loop1]);				// Free The Image Structure
				}
			}
		}
	return Status;											// Return The Status
}
开发者ID:xtmacbook,项目名称:OpenGL_NeHe,代码行数:35,代码来源:Lesson21.cpp

示例4: LoadGLTextures

int LoadGLTextures()
{
	int Status=FALSE;

	AUX_RGBImageRec *TextureImage[1];

	memset(TextureImage,0,sizeof(void *)*1);

	if (TextureImage[0]=LoadBMP("Data/Font.bmp"))
	{
		Status=TRUE;

		glGenTextures(1, &texture[0]);

		glBindTexture(GL_TEXTURE_2D, texture[0]);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
		gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
	}

	if (TextureImage[0]=LoadBMP("Data/Floor.bmp"))
	{
		Status=TRUE;

		glGenTextures(1, &texture[1]);

		glBindTexture(GL_TEXTURE_2D, texture[1]);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
		gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
	}

	if (TextureImage[0]=LoadBMP("Data/Smoke.bmp"))
	{
		Status=TRUE;

		glGenTextures(1, &texture[2]);

		glBindTexture(GL_TEXTURE_2D, texture[2]);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
		gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
	}

	if (TextureImage[0])
	{
		if (TextureImage[0]->data)
		{
			free(TextureImage[0]->data);
		}

		free(TextureImage[0]);
	}

	return Status;
}
开发者ID:Fraczheira,项目名称:Tugas-Besar-Mobil-3D,代码行数:56,代码来源:Main.cpp

示例5: LoadGLTextures

static void LoadGLTextures()     //Bitmaps laden und in Texturen umwandeln
{
	myRGBImage *textureImage[NUM_TEXTURES];
	int i;
	for (i = 0; i<NUM_TEXTURES; i++) {
		textureImage[i] = (myRGBImage *)malloc(sizeof(myRGBImage));
		if (textureImage[i] == NULL) {
			printf("Fehler bei der Speicherreservierung fuer die Bilddaten");
			exit(0);
		}
	}
	//memset(textureImage,0,sizeof(void *)*1); //sicherheitshalber den Inhalt loeschen
	if (
		LoadBMP("waldboden.bmp", textureImage[0]) && LoadBMP("himmel.bmp", textureImage[1]) && LoadBMP("baum.bmp", textureImage[2])
		&& LoadBMP("himmel2.bmp", textureImage[3]) && LoadBMP("himmel3.bmp", textureImage[4]) && LoadBMP("himmel4.bmp", textureImage[5]))  {

		for (i = 0; i < NUM_TEXTURES; i++) {
			glGenTextures(1, &texture[i]);  //Textur erzeugen
			// Textur Erstellung mit Daten vom Bitmap
			glBindTexture(GL_TEXTURE_2D, texture[i]);
			glTexImage2D(GL_TEXTURE_2D,            //target (Gibt an, welche Texture erreicht werden soll)
				0,                          //level (Grad der Mipmap-Reduzierung, 0 ist das Basisbild)
				3,                          //components (1 fuer R, 2 fuer R+A, 3 fuer RGB, 4 fuer RGBA)
				textureImage[i]->sizeX,     //width (Bildbreite in Pixeln)
				textureImage[i]->sizeY,     //height (Bildhoehe in Pixeln)
				0,                          //border (Rand: 0 oder 1)
				GL_RGB,                     //format (z.B. GL_COLOR_INDEX, GL_RGBA, GL_LUMINANCE, ...)
				GL_UNSIGNED_BYTE,           //type (Typ der Daten; z.B. GL_BYTE, GL_INT, GL_FLOAT, ...)
				textureImage[i]->data);     //pixels (eigentlichen Bilddaten)
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filterMode);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filterMode);

			//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
		}
		//Aufraeumen
		for (i = 0; i<NUM_TEXTURES; i++) {
			if (textureImage[i]) {              //falls existiert
				if (textureImage[i]->data) {     //falls Daten existieren
					free(textureImage[i]->data);  //Datenbereich freigeben
				}
				free(textureImage[i]);          //Bitmap-Struktur freigeben
			}
		}
	}
	else{
		textureLoaded = false;		
	}

}
开发者ID:bahlo-practices,项目名称:gdv,代码行数:51,代码来源:mySwing-SoSe14-Bahlo,Wahl.cpp

示例6: LoadGLTextures

int LoadGLTextures()									// Load Bitmaps And Convert To Textures
{
	int Status=FALSE;									// Status Indicator

	AUX_RGBImageRec *TextureImage[2];					// Create Storage Space For The Texture

	memset(TextureImage,0,sizeof(void *)*2);           	// Set The Pointer To NULL

	// Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit
	if ((TextureImage[0]=LoadBMP("Data/BG.bmp")) &&
		(TextureImage[1]=LoadBMP("Data/Reflect.bmp")))
	{
		Status=TRUE;									// Set The Status To TRUE

		glGenTextures(6, &texture[0]);					// Create Three Textures (For Two Images)

		for (int loop=0; loop<2; loop++)
		{
		// Create Nearest Filtered Texture
			glBindTexture(GL_TEXTURE_2D, texture[loop]);	// Gen Tex 0 and 1
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
			glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[loop]->sizeX, TextureImage[loop]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[loop]->data);

			// Create Linear Filtered Texture
			glBindTexture(GL_TEXTURE_2D, texture[loop+2]);	// Gen Tex 2 and 3 4
			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, 3, TextureImage[loop]->sizeX, TextureImage[loop]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[loop]->data);

			// Create MipMapped Texture
			glBindTexture(GL_TEXTURE_2D, texture[loop+4]);	// Gen Tex 4 and 5
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
			gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[loop]->sizeX, TextureImage[loop]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[loop]->data);
		}
		for (loop=0; loop<2; loop++)
		{
	        if (TextureImage[loop])							// If Texture Exists
		    {
			        if (TextureImage[loop]->data)			// If Texture Image Exists
				    {
					        free(TextureImage[loop]->data);	// Free The Texture Image Memory
					}
					free(TextureImage[loop]);				// Free The Image Structure
			}
		}
	}

	return Status;										// Return The Status
}
开发者ID:asion0,项目名称:AsionGitCodes,代码行数:51,代码来源:Lesson23.cpp

示例7: InitTexture

//Inicializar texturas
void InitTexture(){
	//determinação dos ficheiros a carregar que vão servir de texturas
	glEnable(GL_TEXTURE_2D);
	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
	glGenTextures(11, texture_id);

	glBindTexture(GL_TEXTURE_2D, texture_id[0]);
	LoadBMP("aquario.bmp", 0);
	glBindTexture(GL_TEXTURE_2D, texture_id[1]);
	LoadBMP("aquariomask.bmp", 1);
	glBindTexture(GL_TEXTURE_2D, texture_id[2]);
	LoadBMP("Clown_fish.bmp", 2);
	glBindTexture(GL_TEXTURE_2D, texture_id[3]);
	LoadBMP("Clown_fishmask.bmp", 3);
}
开发者ID:brunorafael223,项目名称:CG_TP2_Rep,代码行数:16,代码来源:textures.cpp

示例8: strncmp

//Load - load a texture from a file
bool IMAGE::Load(char * filename)
{
	//Clear the data if already used
	if(data)
		delete [] data;
	data=NULL;
	bpp=0;
	width=0;
	height=0;
	format=0;

	int filenameLength=strlen(filename);

	if(	strncmp((filename+filenameLength-3), "BMP", 3)==0 ||
		strncmp((filename+filenameLength-3), "bmp", 3)==0)
		return LoadBMP(filename);
	
	if(	strncmp((filename+filenameLength-3), "PCX", 3)==0 ||
		strncmp((filename+filenameLength-3), "pcx", 3)==0)
		return LoadPCX(filename);
	
	if(	strncmp((filename+filenameLength-3), "TGA", 3)==0 ||
		strncmp((filename+filenameLength-3), "tga", 3)==0)
		return LoadTGA(filename);

	errorLog.OutputError("%s does not end in \".tga\", \".bmp\" or \"pcx\"", filename);
	return false;
}
开发者ID:Distrotech,项目名称:mesa-demos,代码行数:29,代码来源:image.cpp

示例9: LoadGLTextures

int LoadGLTextures()									// Load Bitmap And Convert To A Texture
{
        int Status=FALSE;								// Status Indicator
        AUX_RGBImageRec *TextureImage[1];				// Create Storage Space For The Textures
        memset(TextureImage,0,sizeof(void *)*1);		// Set The Pointer To NULL

        if (TextureImage[0]=LoadBMP("Data/Particle.bmp"))	// Load Particle Texture
        {
			Status=TRUE;								// Set The Status To TRUE
			glGenTextures(1, &texture[0]);				// Create One Texture

			glBindTexture(GL_TEXTURE_2D, texture[0]);
			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, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
        }

        if (TextureImage[0])							// If Texture Exists
		{
			if (TextureImage[0]->data)					// If Texture Image Exists
			{
				free(TextureImage[0]->data);			// Free The Texture Image Memory
			}
			free(TextureImage[0]);						// Free The Image Structure
		}
        return Status;									// Return The Status
}
开发者ID:arch-jslin,项目名称:mysandbox,代码行数:27,代码来源:Lesson19.cpp

示例10: LoadGLTextures

int LoadGLTextures()									// Load Bitmaps And Convert To Textures
{
	int Status=FALSE;									// Status Indicator

	AUX_RGBImageRec *TextureImage[1];					// Create Storage Space For The Texture

	memset(TextureImage,0,sizeof(void *)*1);           	// Set The Pointer To NULL

	// Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit
	if (TextureImage[0]=LoadBMP("Data/NeHe.bmp"))
	{
		Status=TRUE;									// Set The Status To TRUE

		glGenTextures(1, &texture[0]);					// Create The Texture

		// Typical Texture Generation Using Data From The Bitmap
		glBindTexture(GL_TEXTURE_2D, texture[0]);
		glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
	}

	if (TextureImage[0])									// If Texture Exists
	{
		if (TextureImage[0]->data)							// If Texture Image Exists
		{
			free(TextureImage[0]->data);					// Free The Texture Image Memory
		}

		free(TextureImage[0]);								// Free The Image Structure
	}

	return Status;										// Return The Status
}
开发者ID:CGTP,项目名称:ComputerGraphicsTermProject,代码行数:34,代码来源:Lesson6+example.cpp

示例11: LoadGLTextures

int LoadGLTextures()
{
	int status = false;

	AUX_RGBImageRec * TextureImage[1];
	memset(TextureImage, 0, sizeof(void*)* 1);

	if (TextureImage[0] = LoadBMP("loc"))
		status = true;
	glGenTextures(1, &texture[0]);
	glBindTexture(GL_TEXTURE_2D, texture[0]);
	if (status)
	{
		glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY,
			0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
	}
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);	// 线形滤波
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);	// 线形滤波
	
	if (TextureImage[0])
	{
		if (TextureImage[0]->data)
			free(TextureImage[0]->data);
		free(TextureImage[0]);
	}

	return status;
}
开发者ID:xianyun2014,项目名称:Opengl-road,代码行数:28,代码来源:源.cpp

示例12: LoadGLTexture

int LoadGLTexture()
{
	int Status = FALSE;
	std::string tab[3] = { "pliki/tex.bmp", "pliki/tex2.bmp","pliki/tex3.bmp"};
	AUX_RGBImageRec *TextureImage[3];//rezerwujemy miejsce na teksture
	memset(TextureImage, 0, sizeof(void*) * 1); //ustawiamy na 0
	for (int i = 0; i < 3; i++)
	{
		if (TextureImage[i] = LoadBMP(tab[i]))
		{
			Status = true;
			glGenTextures(3, &texture[i]);
			glBindTexture(GL_TEXTURE_2D, texture[i]);
			gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, TextureImage[i]->sizeX, TextureImage[i]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[i]->data);//przypisawanie teksturze danych obrazowych
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);//filtrowanie liniowe
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);//filtrowanie liniowe
		}
		if (TextureImage[i])
		{
			if (TextureImage[i]->data)
			{
				free(TextureImage[i]->data);//zwolnij pamiec tekstury obrazu
			}
			free(TextureImage[i]);//zwolnij pamiec struktury obrazu
		}
	}
	return Status;
}
开发者ID:manixq,项目名称:Pingiel3D,代码行数:28,代码来源:Pingiel.cpp

示例13: Create_panel_from_bmp

int Create_panel_from_bmp(char* background_filename, char* name, Sint16 x_location, Sint16 y_location, Uint16 picture_width, Uint16 picture_height, control** control_toRet, char** error)
{
	SDL_Surface* Panel_Background;

	if ( -1 ==LoadBMP(background_filename, &Panel_Background, error))
	{
		*control_toRet = NULL;
		return -1;
	}

	SDL_Rect* Panel_Rect = malloc(sizeof(SDL_Rect));
	if (Panel_Rect == NULL) {
		SDL_FreeSurface(Panel_Background);
		Panel_Background = NULL;
		*control_toRet = NULL;
		*error = "ERROR: failed to allocate memory for SDL_Rect";
		return -1;
	}
	Panel_Rect->x = x_location;
	Panel_Rect->y = y_location;
	Panel_Rect->h = picture_height;
	Panel_Rect->w = picture_width;

	if (-1 == CreateControl(Panel_Background, NULL, Panel_Rect, name, NULL, WINDOWTYPE, control_toRet, error))
	{
		SDL_FreeSurface(Panel_Background);
		Panel_Background = NULL;
		free(Panel_Rect);
		Panel_Rect = NULL;
		return -1;
	}
	return 0;
}
开发者ID:EylonSaadon,项目名称:SoftProjShachMat,代码行数:33,代码来源:UIFrameWork.c

示例14: LoadDensityMap

void LoadDensityMap( const char* FileName )
{
	std::cout << "Loading density map " << FileName << std::endl;

	int W, H;
	unsigned char* Data = LoadBMP( FileName, &W, &H );

	std::cout << "Loaded ( " << W << " x " << H << " ) " << std::endl;

	if ( W != ImageSize || H != ImageSize )
	{
		std::cout << "ERROR: density map should be " << ImageSize << " x " << ImageSize << std::endl;		

		exit( 255 );
	}

	g_DensityMap = new float[ W * H ];

	for ( int y = 0; y != H; y++ )
	{
		for ( int x = 0; x != W; x++ )
		{
			g_DensityMap[ x + y * W ] = float( Data[ 3 * (x + y * W) ] ) / 255.0f;
		}
	}

	delete[]( Data );
}
开发者ID:yunfuliu,项目名称:poisson-disk-generator,代码行数:28,代码来源:Poisson.cpp

示例15: tekstur

void tekstur() {
   int i,size,j;
   char c[64];
   unsigned char t;
   unsigned char *p;
   /* allocate space for texture in graphics card */
   glGenTextures(7,texture);
   for(i=0;i<7;i++) {
      sprintf(c,"t%d.bmp",i+1);
/*      fprintf(debug,"%s\n",c);*/
      img[i]=LoadBMP(c);
      buf[i]=(unsigned char*)malloc(512*512*3);
      memcpy(buf[i],img[i]->pixels,512*512*3);
      p=buf[i];

/*      fprintf(debug,"bits: %d\n",(int)img[i]->format->BytesPerPixel);*/
      size=3*512*512;
      /* reverser */
      for(j=0;j<size/2;j++) {
         t=p[j]; p[j]=p[size-j-1]; p[size-j-1]=t;
      }
      loadtexture(&texture[i],512,512,buf[i]);
   }
   glEnable(GL_TEXTURE_2D);
}
开发者ID:manish05,项目名称:TCR,代码行数:25,代码来源:o6.c


注:本文中的LoadBMP函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。