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

C++ LoadTGA函数代码示例

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

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



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

示例1: MeshPlayer

void GameModel::Init()
{
    Model::Init();

    MeshPlayer();
    ModelSwitch = 0;

    m_gameState = GAME_STATE::IDLE;

    tile = MeshBuilder::GenerateText("tiles", 32, 32);
    tile->textureID[0] = LoadTGA("Image//tile.tga");

    winMesh = MeshBuilder::GenerateText("tiles", 1, 1);
    winMesh->textureID[0] = LoadTGA("Image//win.tga");

    lose = MeshBuilder::GenerateText("tiles", 1, 1);
    lose->textureID[0] = LoadTGA("Image//lose.tga");

    commands = new bool[NUM_COMMANDS];
    for (int count = 0; count < NUM_COMMANDS; ++count)
        commands[count] = false;

    m_mapOffset_x = 0;
    m_mapOffset_y = 0;

    Text = MeshBuilder::GenerateText("text", 16, 16);
    Text->textureID[0] = LoadTGA("Image//ArialBlack.tga");

    floorTiles.push_back(112);
    floorTiles.push_back(309);
    floorTiles.push_back(402);
    floorTiles.push_back(405);

    shadow = MeshBuilder::GenerateQuad("shadow", Color());
    shadow->textureID[0] = LoadTGA("Image//shadow.tga");

    inventory.Init();
    InvenTime = 0;

    PlaceItemState = false;

    AIList.clear();

    win = false;
    touchdoor = false;
    numKey = 0;
    //getKeys();

    goNext = false;

    died = false;

    steps = 0;

    MeshSpeech();

    speech.Textfile("SpeechText//CharacterFile.txt", true);
    speech.Textfile("SpeechText//HowToPlayFile.txt", false);

}
开发者ID:vincentlai97,项目名称:SP3-10,代码行数:60,代码来源:GameModel.cpp


示例2: LoadTGA

void StateCredits::Init()
{
	// Menu in 2D
	theView->LoadOrthoCamera();

	// Create Meshes
	Mesh * newMesh;
	newMesh = MeshBuilder::GenerateText("Source Font", 16, 16);
	newMesh->textureID = LoadTGA("Fonts//source.tga");
	newMesh->alpha = 0.f;
	m_meshList.push_back(newMesh);

	newMesh = MeshBuilder::GenerateQuad("AGDev Menu BG", Color(1.f, 1.f, 1.f), 1.f);
	//newMesh->alpha = 0.f;
	m_meshList.push_back(newMesh);

	newMesh = MeshBuilder::GenerateQuad("Project", Color(0.f, 0.f, 0.f), 1.f);
	newMesh->textureArray[0] = LoadTGA("Images//Project.tga");
	//newMesh->alpha = 0.f;
	m_meshList.push_back(newMesh);

	m_bStartFadeIn = true;
	m_bStartFadeOut = false;
	m_dFadeDelay = 0.0;
}
开发者ID:DarkPromise,项目名称:StudioProject4,代码行数:25,代码来源:StateCredits.cpp


示例3: LoadGLTextures

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

    // Load The Bitmap, Check For Errors.
    if (LoadTGA(&texture[0], "Data/Uncompressed.tga") &&
            LoadTGA(&texture[1], "Data/Compressed.tga"))
    {
        Status=TRUE;											// Set The Status To TRUE

        for (int loop=0; loop<2; loop++)						// Loop Through Both Textures
        {
            // Typical Texture Generation Using Data From The TGA ( CHANGE )
            glGenTextures(1, &texture[loop].texID);				// Create The Texture ( CHANGE )
            glBindTexture(GL_TEXTURE_2D, texture[loop].texID);
            glTexImage2D(GL_TEXTURE_2D, 0, texture[loop].bpp / 8, texture[loop].width, texture[loop].height, 0, texture[loop].type, GL_UNSIGNED_BYTE, texture[loop].imageData);
            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

            if (texture[loop].imageData)						// If Texture Image Exists ( CHANGE )
            {
                free(texture[loop].imageData);					// Free The Texture Image Memory ( CHANGE )
            }
        }
    }
    return Status;												// Return The Status
}
开发者ID:yangxt225,项目名称:OpenGL,代码行数:27,代码来源:Lesson33.cpp


示例4: fseek

//-------------------------------------------------------------
//- Load
//- Loads an image of any supported image type
//-------------------------------------------------------------
bool CImage::Load(char * szFilename, bool bMipMap)
{
    m_bMipMap = bMipMap;
    m_szFilename = szFilename;
    FILE * f;

    if(!(f = fopen(szFilename, "rb")))
    {
        APP->Log(COLOR_RED, "Could not open %s", szFilename);
        return false;
    }

    fseek(f, 0, SEEK_END);
    int iEnd = ftell(f);
    fseek(f, 0, SEEK_SET);
    int iStart = ftell(f);
    m_uiFileLen = iEnd - iStart;

    m_ucpBuffer = new unsigned char[m_uiFileLen];

    if(!m_ucpBuffer)
    {
        APP->Log(COLOR_RED, "Could not alloc memory for %s", szFilename);
        return false;
    }

    //get data
    if(fread(m_ucpBuffer, 1, m_uiFileLen, f) != m_uiFileLen)
    {
        APP->Log(COLOR_RED, "Could not read from %s", szFilename);
        if(m_ucpBuffer)
            delete [] m_ucpBuffer;
        return false;
    }

    //Check for a valid filetype
    //Windows Bitmap
    if(memcmp(m_ucpBuffer, BMP_HEADER, 2) == 0)
    {
        return LoadBMP();
    }
    //Uncompressed TGA
    if(memcmp(m_ucpBuffer, TGA_UHEADER, 12) == 0)
    {
        return LoadTGA(false);
    }
    //Compressed TGA
    if(memcmp(m_ucpBuffer, TGA_CHEADER, 12) == 0)
    {
        return LoadTGA(true);
    }
    //PCX
    if(m_ucpBuffer[0] == 10)
    {
        return LoadPCX();
    }
    APP->Log(COLOR_RED, "Could not load %s, Invalid filetype", szFilename);
    return false;
}
开发者ID:dumganhar,项目名称:FocusOn3DModels,代码行数:63,代码来源:image.cpp


示例5: land_create_texture

int land_create_texture(land_t *land,land_config_t *config) {
    int i,j,k,l,m,width,height,imagewidth,imageheight,offset;
    unsigned char *data,*image;
    land->material = glGenLists(1); // create material
    glNewList(land->material,GL_COMPILE);
    glMaterialfv(GL_FRONT,GL_AMBIENT,config->ambient);
    glMaterialfv(GL_FRONT,GL_DIFFUSE,config->diffuse);
    glMaterialfv(GL_FRONT,GL_SPECULAR,config->specular);
    glEndList();
    land->texture = (int*)malloc(sizeof(int) * config->num_base * config->num_base + 1);
    if(!land->texture) return 0;
    memset(land->texture,0,sizeof(int) * config->num_base * config->num_base + 1);    
    land->num_texture = config->num_base * config->num_base + 1;
    data = NULL;
    if(strstr(config->detail,".jpg")) data = LoadJPEG(config->detail,&width,&height);
    else if(strstr(config->detail,".tga")) data = LoadTGA(config->detail,&width,&height);
    if(data) {  // create detail texture
        glGenTextures(1,&land->texture[0]);
        glBindTexture(GL_TEXTURE_2D,land->texture[0]);
        glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,config->texture_mode);
        glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,config->texture_mode);
        glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
        glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
        gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA,width,height,GL_RGBA,GL_UNSIGNED_BYTE,data);
        free(data);
    }    
    data = NULL;
    if(strstr(config->base,".jpg")) data = LoadJPEG(config->base,&width,&height);
    else if(strstr(config->base,".tga")) data = LoadTGA(config->base,&width,&height);
    if(data) {
        imagewidth = width / config->num_base;
        imageheight = height / config->num_base;
        image = (unsigned char*)malloc(imagewidth * imageheight * 4);
        if(!image) return 0;
        for(j = 0; j < config->num_base; j++)   // create base textures
            for(i = 0; i < config->num_base; i++) {
                for(l = 0, m = 0; l < imageheight; l++) {
                    offset = (width * (imageheight * j + l) + imagewidth * i) * 4;
                    for(k = 0; k < imagewidth * 4; k += 4, m += 4) {
                        image[m + 0] = data[offset + k + 0];
                        image[m + 1] = data[offset + k + 1];
                        image[m + 2] = data[offset + k + 2];
                        image[m + 3] = data[offset + k + 3];
                    }
                }
                glGenTextures(1,&land->texture[config->num_base * j + i + 1]);
                glBindTexture(GL_TEXTURE_2D,land->texture[config->num_base * j + i + 1]);
                glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,config->texture_mode);
                glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,config->texture_mode);
                glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
                glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
                gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA,imagewidth,imageheight,GL_RGBA,GL_UNSIGNED_BYTE,image);
            }
        free(image);
        free(data);
    }
    return 1;
}
开发者ID:kasicass,项目名称:frustum,代码行数:58,代码来源:land.c


示例6: szFullFilePath

/************************************************
 *	CCharacterImage Constructor.
 ************************************************/
CCharacterImage::CCharacterImage(void)
{
	FBString		szFullFilePath( mSystem.ApplicationPath, CHARACTER_CTRL_IMAGE );
	FBString		szRegionDropPath( mSystem.ApplicationPath, FINGER_CTRL_IMAGE );
	FBString		szRegionSelPath( mSystem.ApplicationPath, SELECTED_CTRL_IMAGE );

	mCharacterId = LoadTGA( szFullFilePath );
	mRegionDropId = LoadTGA( szRegionDropPath );
	mRegionSelectedId = LoadTGA( szRegionSelPath );
}
开发者ID:Neill3d,项目名称:MoBu,代码行数:13,代码来源:HandsImage.cpp


示例7: glClearColor

void SceneWin::Init()
{
	sound.playMusic("Music//Win.mp3");

	// Set background color to dark blue
	glClearColor(0.0f, 0.0f, 0.4f, 0.0f);

	//Enable depth buffer and depth testing
	glEnable(GL_DEPTH_TEST);

	//Default to fill mode
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

	// Generate a default VAO for now
	glGenVertexArrays(1, &m_vertexArrayID);
	glBindVertexArray(m_vertexArrayID);

	m_programID = LoadShaders("Shader//Texture.vertexshader", "Shader//Text.fragmentshader");

	m_parameters[U_MVP] = glGetUniformLocation(m_programID, "MVP");
	m_parameters[U_MODELVIEW] = glGetUniformLocation(m_programID, "MV");
	m_parameters[U_MODELVIEW_INVERSE_TRANSPOSE] = glGetUniformLocation(m_programID, "MV_inverse_transpose");
	m_parameters[U_MATERIAL_AMBIENT] = glGetUniformLocation(m_programID, "material.kAmbient");
	m_parameters[U_MATERIAL_DIFFUSE] = glGetUniformLocation(m_programID, "material.kDiffuse");
	m_parameters[U_MATERIAL_SPECULAR] = glGetUniformLocation(m_programID, "material.kSpecular");
	m_parameters[U_MATERIAL_SHININESS] = glGetUniformLocation(m_programID, "material.kShininess");

	// Get a handle for our "colorTexture" uniform
	m_parameters[U_COLOR_TEXTURE_ENABLED] = glGetUniformLocation(m_programID, "colorTextureEnabled");
	m_parameters[U_COLOR_TEXTURE] = glGetUniformLocation(m_programID, "colorTexture");
	// Get a handle for our "textColor" uniform
	m_parameters[U_TEXT_ENABLED] = glGetUniformLocation(m_programID, "textEnabled");
	m_parameters[U_TEXT_COLOR] = glGetUniformLocation(m_programID, "textColor");

	//Enable blending
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	glUseProgram(m_programID);

	//Initialize camera settings
	camera.Init(Vector3(-300, -10, 0), Vector3(0, 0, 0), Vector3(0, 1, 0));

	meshList[GEO_PATH] = MeshBuilder::GenerateQuad("land", Color(1, 1, 1), 14, 13);
	meshList[GEO_PATH]->textureID = LoadTGA("Image//Win_Escape.tga");

	meshList[GEO_TEXT] = MeshBuilder::GenerateText("text", 16, 16);
	meshList[GEO_TEXT]->textureID = LoadTGA("Image//_Font.tga");

	Mtx44 projection;
	projection.SetToPerspective(45.0f, 16.0f / 9.0f, 0.1f, 10000.0f);
	projectionStack.LoadMatrix(projection);
}
开发者ID:Larkie11,项目名称:Sp2-16,代码行数:53,代码来源:SceneWin.cpp


示例8: LoadTGA

void SceneCredits::InitMesh()
{
	m_meshList[MESH_TEXT] = MeshBuilder::GenerateText("Calibri font", 16, 16);
	m_meshList[MESH_TEXT]->textureID[0] = LoadTGA("Image\\calibri.tga");

	// Menu
	m_meshList[MESH_RETURN_TO_MAIN_MENU_ON] = MeshBuilder::Generate2DMesh("New game on", Color(1, 1, 1), 0, 0, 1, 1);
	m_meshList[MESH_RETURN_TO_MAIN_MENU_ON]->textureID[0] = LoadTGA("Image\\Menu\\BackToMainMenu_On.tga");

	m_meshList[MESH_RETURN_TO_MAIN_MENU_OFF] = MeshBuilder::Generate2DMesh("New game off", Color(1,1,1), 0, 0, 1, 1);
	m_meshList[MESH_RETURN_TO_MAIN_MENU_OFF]->textureID[0] = LoadTGA("Image\\Menu\\BackToMainMenu_Off.tga");
}
开发者ID:NothingMuch123,项目名称:Adv-GDev,代码行数:12,代码来源:SceneCredits.cpp


示例9: LoadTGA

//Constructor
GameScene::GameScene() {

	mesh[FONT_CONSOLAS] = MeshBuilder::GenerateText("Text", 16, 16);
	mesh[FONT_CONSOLAS]->textureID = LoadTGA("Image//Fonts//Consolas.tga");

	for (GEOMETRY_TYPE i = SKYBOX_TOP; i < SKYBOX_RIGHT; i = static_cast<GEOMETRY_TYPE>(i + 1)) {
	
		mesh[i] = MeshBuilder::GenerateQuad("Skybox", Colour(1, 1, 1), 1.0f);
		mesh[i]->textureID = LoadTGA("Image//PlaceHolder//PlaceHolder.tga");

	}

}
开发者ID:AngryPants,项目名称:SP2_Team13,代码行数:14,代码来源:GameScene.cpp


示例10: LoadTGA

void StateAGDevMenu::Init()
{
	// Menu in 2D
	theView->LoadOrthoCamera();

	// Enable Mouse
	theView->getInputHandler()->setMouseEnabled(true);

	// Create Meshes
	Mesh * newMesh;
	newMesh = MeshBuilder::GenerateText("Source Font", 16, 16);
	newMesh->textureID = LoadTGA("Fonts//source.tga");
	newMesh->alpha = 0.f;
	m_meshList.push_back(newMesh);

	newMesh = MeshBuilder::GenerateQuad("AGDev Menu BG", Color(1.f, 1.f, 1.f), 1.f);
	newMesh->textureArray[0] = LoadTGA("Images//GameMenubg.tga");
	//newMesh->alpha = 0.f;
	m_meshList.push_back(newMesh);

	newMesh = MeshBuilder::GenerateQuad("Project", Color(0.f, 0.f, 0.f), 1.f);
	newMesh->textureArray[0] = LoadTGA("Images//Project.tga");
	//newMesh->alpha = 0.f;
	m_meshList.push_back(newMesh);

	// Create Gui Buttons
	Gui * newGui;
	newGui = new GuiButton("Start Button", "Start", 0.5f, 0.5f, 48.f);
	newGui->setMesh(MeshBuilder::GenerateBoundingBox("StartBB", newGui->getBoundingBox().Max, newGui->getBoundingBox().Min, Color(0.f, 0.f, 1.f)));
	m_guiList.push_back(newGui);

	newGui = new GuiButton("Instructions Button", "Instructions", 0.5f, 0.6f, 48.f);
	newGui->setMesh(MeshBuilder::GenerateBoundingBox("InstructionsBB", newGui->getBoundingBox().Max, newGui->getBoundingBox().Min, Color(0.f, 0.f, 1.f)));
	m_guiList.push_back(newGui);

	newGui = new GuiButton("Highscores Button", "Highscores", 0.5f, 0.7f, 48.f);
	newGui->setMesh(MeshBuilder::GenerateBoundingBox("HighscoreBB", newGui->getBoundingBox().Max, newGui->getBoundingBox().Min, Color(0.f, 0.f, 1.f)));
	m_guiList.push_back(newGui);

	newGui = new GuiButton("Options Button", "Options", 0.5f, 0.8f, 48.f);
	newGui->setMesh(MeshBuilder::GenerateBoundingBox("OptionsBB", newGui->getBoundingBox().Max, newGui->getBoundingBox().Min, Color(0.f, 0.f, 1.f)));
	m_guiList.push_back(newGui);

	newGui = new GuiButton("Credits Button", "Credits", 0.5f, 0.9f, 48.f);
	newGui->setMesh(MeshBuilder::GenerateBoundingBox("CreditsBB", newGui->getBoundingBox().Max, newGui->getBoundingBox().Min, Color(0.f, 0.f, 1.f)));
	m_guiList.push_back(newGui);

	m_bStartFadeIn = true;
	m_bStartFadeOut = false;
	m_dFadeDelay = 0.0;
}
开发者ID:DarkPromise,项目名称:StudioProject4,代码行数:51,代码来源:StateAGDevMenu.cpp


示例11: chargerTextures

// structure pour gérer la texture
bool chargerTextures(int it, char* nom)
{
    // Charger le fichier image tga et mettre les infos dans la structure
    // Hauteur, Largeur, bits par pixel.
    if (LoadTGA(&aTexture[it], nom)) {
        // Créer la texture
        glGenTextures(1, &aTexture[it].texID);

        // Définir comme texture par défaut
        glBindTexture(GL_TEXTURE_2D, aTexture[it].texID);

        // Charger les données de l'image dans OpenGL et dans la mémoire de la carte vidéo
        glTexImage2D(GL_TEXTURE_2D, 0, aTexture[it].bpp / 8, aTexture[it].width, aTexture[it].height, 0, aTexture[it].type, GL_UNSIGNED_BYTE, aTexture[it].imageData);

        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

        if (aTexture[it].imageData) {
            // libérer la mémoire alloué par le chargeur
            free(aTexture[it].imageData);
        }
        return true;
    }
    else return false;
}
开发者ID:sekouzed,项目名称:echec3D,代码行数:26,代码来源:main.cpp


示例12: EntityGridObject

void EntityGridObject::addChildren(int y, int x, OBJECT_TYPE childType, GridMap * currMap)
{
	EntityGridObject * newChild = new EntityGridObject(childType);
	newChild->m_iIndexX = x;
	newChild->m_iIndexY = y;

	auto childGC = new GraphicsComponent();
	switch (childType)
	{
		case OBJECT_UNDEFINED:
			currMap->getGridMap()[y][x]->setremoveDoor(true);
			currMap->getGridMap()[y][x]->replaceTile(Grid::TILE_FLOOR, BACKGROUND_TILE);
		break;
		
		case OBJECT_BOX:
			break;
		
		case OBJECT_KEY:
			break;
		
		case OBJECT_SWITCH:
			break;
		
		case OBJECT_DOOR:
			newChild->setToggleable(true);
			childGC->addMesh(MeshBuilder::GenerateQuad("Door", Color(1.f, 0.f, 0.f), 32.f));
			childGC->getMesh()->textureArray[0] = LoadTGA("Images//Tiles//tile109.tga");
			newChild->addComponent(childGC);
			currMap->getGridMap()[y][x]->addGridEntity(newChild);
		break;
	}
	this->m_cChildren.push_back(newChild);
}
开发者ID:DarkPromise,项目名称:StudioProject4,代码行数:33,代码来源:EntityGridObject.cpp


示例13: switch

void EntityGridObject::toggleObject(GridMap * currMap)
{
	if (!m_bToggled)
	{
		m_bToggled = true;
	}
	else
	{
		m_bToggled = false;
	}

	auto graphicsComponent = this->getComponent<GraphicsComponent>();
	Mesh * newMesh;

	switch (this->m_eObjectType)
	{
	case OBJECT_BOX:
		break;
	case OBJECT_KEY:
		break;
	case OBJECT_SWITCH:
		delete graphicsComponent->getMesh();
		graphicsComponent->setMesh(MeshBuilder::GenerateQuad("Activated", Color(0.f, 0.f, 0.f), 16.f));
		graphicsComponent->getMesh()->textureArray[0] = LoadTGA("Images//Tiles//tile_switch_activate.tga");
		graphicsComponent->getMesh()->alpha = 1.f;
		break;
	case OBJECT_DOOR:
		SoundManager::playSound("Sounds//lever.wav", false);
		SoundManager::playSound("Sounds//opendoor.wav", false);
		currMap->getGridMap()[this->m_iIndexY][this->m_iIndexX]->setremoveDoor(true);
		currMap->getGridMap()[this->m_iIndexY][this->m_iIndexX]->replaceTile(Grid::TILE_FLOOR,BACKGROUND_TILE);
		currMap->getGridMap()[this->m_iIndexY][this->m_iIndexX]->deleteEntity();
		break;
	}
}
开发者ID:DarkPromise,项目名称:StudioProject4,代码行数:35,代码来源:EntityGridObject.cpp


示例14: sprintf

bool CBomsSet::LoadBoms(int BomsNum)
{
	Texture LoadBomTexture;
	char BomsFileName[64]={0};
	sprintf(BomsFileName,"Data/Boms/Bom%d.tga",BomsNum);
	FILE	*m_Filefighter;
	if ((m_Filefighter=fopen(BomsFileName,"rb"))==NULL)
		return false;
	if (LoadTGA(&LoadBomTexture, BomsFileName))
	{
		glGenTextures(1, &LoadBomTexture.texID);
		glBindTexture(GL_TEXTURE_2D, LoadBomTexture.texID);
		glTexImage2D(GL_TEXTURE_2D, 0, LoadBomTexture.bpp / 8, LoadBomTexture.width, LoadBomTexture.height, 0, LoadBomTexture.type, GL_UNSIGNED_BYTE, LoadBomTexture.imageData);
		Pnum=LoadBomTexture.texID;
		if(m_IsSupportFBO)
		{
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
		}
		else
		{
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
		}
		if (LoadBomTexture.imageData)						// If Texture Image Exists ( CHANGE )
		{
			free(LoadBomTexture.imageData);					// Free The Texture Image Memory ( CHANGE )
		}
		return true;

	}
	return false;
}
开发者ID:SHIYUENING,项目名称:topace,代码行数:33,代码来源:BomsSet.cpp


示例15: LoadTGA

RawImage* ImageFactory::loadTGA(const char* filename)
{
	TextureInfo tex;
	LoadTGA(&tex, filename);
	
	return new RawImage(tex.width, tex.height, tex.type == GL_RGBA, tex.imageData);
}
开发者ID:nbaztec,项目名称:Blitz,代码行数:7,代码来源:ImageFactory.cpp


示例16: Load

 /**
  * ファイルロード[拡張子自動判別]
  * @param filepath  ファイルフルパス 
  * @retval true 成功
  * @retval false 失敗
  */
 bool Load(const char* filename)
 {
     bool result = false;
     m_image.Clear();
     std::string path(filename);
     std::string::size_type pos = path.rfind('.');
     if (pos != std::string::npos)
     {
         const std::string ext = make_lowercase(path.substr(pos+1));
         if (ext == "png")
         {
             result = LoadPNG(path);
         }
         else if (ext == "jpg" || ext == "jpeg")
         {
             result = LoadJPG(path);
         }
         else if (ext == "tga")
         {
             result = LoadTGA(path);
         }
         else if (ext == "hdr")
         {
             result = LoadHDR(path);
         }
         else if (ext == "exr" || ext == "EXR")
         {
             result = LoadEXR(path);
         }
     }
     return result;
 }
开发者ID:jorji,项目名称:HIVE,代码行数:38,代码来源:ImageLoader.cpp


示例17: 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


示例18: 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


示例19: R_LoadSkys

void R_LoadSkys (void)
{
    int     i;
    FILE    *f;
    char    name[64];

    for (i=0 ; i<6 ; i++)
    {
        GL_Bind (SKY_TEX + i);
        sprintf (name, "gfx/env/bkgtst%s.tga", suf[i]);
        COM_FOpenFile (name, &f);
        if (!f)
        {
            Con_Printf ("Couldn't load %s\n", name);
            continue;
        }
        LoadTGA (f);
//      LoadPCX (f);

        glTexImage2DHelper (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, targa_rgba);
//      glTexImage2DHelper (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, pcx_rgb);

        free (targa_rgba);
//      free (pcx_rgb);

        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    }
}
开发者ID:TeamNyx,项目名称:gdk,代码行数:29,代码来源:gl_warp.cpp


示例20: LoadTGA

SpriteAnimation* GameObject::generateSpriteMesh()
{
	SpriteAnimation *sa;
	sa = dynamic_cast<SpriteAnimation*>(MeshBuilder::GenerateSpriteAnimation(SpriteName, SpriteRow, SpriteCol, 1.f));
	sa->textureID[0] = LoadTGA(Sprite_texture_file_path);
	return sa;
}
开发者ID:FieryGazette,项目名称:2D-Game,代码行数:7,代码来源:GameObject.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ LoadTexture函数代码示例发布时间:2022-05-30
下一篇:
C++ LoadStringW函数代码示例发布时间: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