• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ LoadBMP函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Load

//载入位图文件并创建纹理
bool BMPLoad::Load(const char *filename)
{
	if(!LoadBMP(filename))
	{
		MessageBox(NULL, TEXT("载入位图文件失败"),TEXT("错误"), MB_OK);
		exit(0);
	}
	//生成纹理对象名称
	glGenTextures(1, &ID);
	//创建纹理对象
	glBindTexture(GL_TEXTURE_2D, ID);

	//控制滤波,纹理过滤与环绕,  控制纹理参数 
	/*==============================
	*这里改动会比较多做个记号
	*/
	//==================================
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);

	//创建纹理mip贴图
	gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, imageWidth, imageHeight, GL_RGB, GL_UNSIGNED_BYTE, image);

	return true;
}
开发者ID:bookanddog,项目名称:FPScamera,代码行数:28,代码来源:ImageLoad.cpp


示例17: LoadBMP

bool Texture::LoadFromBMP( const char* Filename )
{
    unsigned int width, height;
    
    unsigned char* data = LoadBMP(Filename, width, height);
    if(data==NULL)
        return false;
    
    if( m_pImage )
        delete m_pImage;
    
    m_pImage = createImage(data, width, height);
    
    glGenTextures(1, &m_TextureID);
    
    glBindTexture(GL_TEXTURE_2D, m_TextureID);
    glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
    glGenerateMipmap(GL_TEXTURE_2D);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
    glBindTexture(GL_TEXTURE_2D, 0);
   
    return true;
}
开发者ID:Cluster7ck,项目名称:CompGraphics,代码行数:26,代码来源:Texture.cpp


示例18: m_Width

Surface::Surface( const IDataStream& Stream, ESurfaceFileType FileType )
    :	m_Width( 0 )
    ,	m_Height( 0 )
    ,	m_Stride( 0 )
    ,	m_Padding( 0 )
#if BUILD_WINDOWS_NO_SDL
    ,	m_hDC( NULL )
    ,	m_BMP( NULL )
    ,	m_OldBMP( NULL )
#endif
    ,	m_pPixels( NULL )
    ,	m_BitmapInfo()
    ,	m_ViewportLeft( 0 )
    ,	m_ViewportTop( 0 )
    ,	m_ViewportRight( 0 )
    ,	m_ViewportBottom( 0 )
{
    // Load depending on extension
    if( FileType == ESFT_BMP )
    {
        LoadBMP( Stream );
    }
    else if( FileType == ESFT_TGA )
    {
        LoadTGA( Stream );
    }
    else
    {
        WARNDESC( "Unknown file type constructing Surface." );
    }
}
开发者ID:Johnicholas,项目名称:EldritchCopy,代码行数:31,代码来源:surface.cpp


示例19: strncmp

//Load an image from a file
bool IMAGE::Load(char * filename)
{
	//Clear the member variables if already used
	bpp=0;
	width=height=0;
	stride=0;
	format=0;

	if(data)
		delete []  data;
	data=NULL;

	paletted=false;
	paletteBpp=0;
	paletteFormat=0;
	if(palette)
		delete [] palette;
	palette=NULL;

	//Call the correct loading function based on the filename
	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, "TGA", 3)==0 ||
		strncmp(filename+filenameLength-3, "tga", 3)==0)
		return LoadTGA(filename);

	LOG::Instance()->OutputError("%s does not end with \"bmp\" or \"tga\"", filename);
	return false;
}
开发者ID:iag,项目名称:MMOpenGLProject,代码行数:34,代码来源:IMAGE_Load.cpp


示例20: LoadGLTextures

int LoadGLTextures() {                                  // Загружаем битмап и преобразуем в текстуру
    int Status = FALSE;                                 // Индикатор состояния

    AUX_RGBImageRec* TextureImage[1];                   // Создаем пространство для хранения текстуры

    memset(TextureImage, 0, sizeof(void*) * 1);         // Устанавливаем указатель в NULL

    // Загружаем изображение, проверяем ошибки, если изображение не найдено, то выходим.
    if (TextureImage[0] = LoadBMP("Data/Cube.bmp")) {
        Status = TRUE;                                  // Устанавливаем состояние в TRUE

        glGenTextures(1, &texture[0]);                  // Создаем текстуру

        // Генерация типичной текстуры с использованием данных из битовых карт (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 (TextureImage[0]->data) {                        // Если текстурное изображение существует
            free(TextureImage[0]->data);                    // Освобождаем память изображения текстуры
        }

        free(TextureImage[0]);                              // Освобождаем структуру изображения
    }

    return Status;                                      // Возвращаем состояние
}
开发者ID:stden,项目名称:comp_graph,代码行数:30,代码来源:nehe-ogl12.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LoadBitmap函数代码示例发布时间:2022-05-30
下一篇:
C++ Load函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap