您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CreateTexture函数代码示例

51自学网 2021-06-01 20:15:14
  C++
这篇教程C++ CreateTexture函数代码示例写得很实用,希望能帮到您。

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

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

示例1: CreateTexture

/** Laed die Bilder Der Image Mask*/void GraphicPipeline::InitMask() {	CreateTexture(g_Texture, "CrossHairMask.bmp", 0);	// Load the cross hair mask used for transparency	CreateTexture(g_Texture, "CrossHair.bmp", 1);	//hier Bilder laden ,ich weiss ist nicht perfect aber erstmal eine Loesung}
开发者ID:BackupTheBerlios,项目名称:aigine,代码行数:8,


示例2: MakeGlyphImpl

FTGlyph* FTTextureFontImpl::MakeGlyphImpl(FT_GlyphSlot ftGlyph){    glyphHeight = static_cast<int>(charSize.Height() + 0.5);    glyphWidth = static_cast<int>(charSize.Width() + 0.5);    if(glyphHeight < 1) glyphHeight = 1;    if(glyphWidth < 1) glyphWidth = 1;    if(textureIDList.empty())    {        textureIDList.push_back(CreateTexture());        xOffset = yOffset = padding;    }    if(xOffset > (textureWidth - glyphWidth))    {        xOffset = padding;        yOffset += glyphHeight;        if(yOffset > (textureHeight - glyphHeight))        {            textureIDList.push_back(CreateTexture());            yOffset = padding;        }    }    FTTextureGlyph* tempGlyph = new FTTextureGlyph(ftGlyph, textureIDList[textureIDList.size() - 1],                                                    xOffset, yOffset, textureWidth, textureHeight);    xOffset += static_cast<int>(tempGlyph->BBox().Upper().X() - tempGlyph->BBox().Lower().X() + padding + 0.5);    --remGlyphs;    return tempGlyph;}
开发者ID:UIKit0,项目名称:ftgles,代码行数:34,


示例3: CreateTexture

void FTextureManager::AddGroup(int wadnum, int ns, int usetype){	int firsttx = Wads.GetFirstLump(wadnum);	int lasttx = Wads.GetLastLump(wadnum);	char name[9];	name[8] = 0;	// Go from first to last so that ANIMDEFS work as expected. However,	// to avoid duplicates (and to keep earlier entries from overriding	// later ones), the texture is only inserted if it is the one returned	// by doing a check by name in the list of wads.	for (; firsttx <= lasttx; ++firsttx)	{		if (Wads.GetLumpNamespace(firsttx) == ns)		{			Wads.GetLumpName (name, firsttx);			if (Wads.CheckNumForName (name, ns) == firsttx)			{				CreateTexture (firsttx, usetype);			}			//StartScreen->Progress();		}		else if (ns == ns_flats && Wads.GetLumpFlags(firsttx) & LUMPF_MAYBEFLAT)		{			if (Wads.CheckNumForName (name, ns) < firsttx)			{				CreateTexture (firsttx, usetype);			}			//StartScreen->Progress();		}	}}
开发者ID:JohnnyonFlame,项目名称:ecwolf,代码行数:35,


示例4: MakeGlyph

FTGlyph* FTGLTextureFont::MakeGlyph (unsigned int glyphIndex) {	FT_GlyphSlot ftGlyph = face.Glyph (glyphIndex, FT_LOAD_NO_HINTING);		if (ftGlyph) {		glyphHeight = static_cast<int> (charSize.Height());		glyphWidth = static_cast<int> (charSize.Width());		if (textureIDList.empty()) {			textureIDList.push_back (CreateTexture());			xOffset = yOffset = padding;		}		if (xOffset >  (textureWidth - glyphWidth)) {			xOffset = padding;			yOffset += glyphHeight;			if (yOffset >  (textureHeight - glyphHeight)) {				textureIDList.push_back (CreateTexture());				yOffset = padding;			}		}		FTTextureGlyph* tempGlyph =				new FTTextureGlyph (ftGlyph, textureIDList[textureIDList.size() - 1],				xOffset, yOffset, textureWidth, textureHeight);		xOffset += static_cast<int> (tempGlyph->BBox().upperX - tempGlyph->BBox().lowerX + padding);		--remGlyphs;		return tempGlyph;	}	err = face.Error();	return NULL;}
开发者ID:pseuudonym404,项目名称:tuxracer-touch,代码行数:32,


示例5: CreateFrameBuffer

	// Inheritance exigences	void TGBufferCanvas::Init()	{		// Drawable data		m_output.width = m_width; 		m_output.height = m_height; 		// Creating the main frame buffer		m_frameBuffer = CreateFrameBuffer();		BindFrameBuffer(m_frameBuffer);		// Creating the textures		// Memory allocation		m_output.buffers.resize(5);		// The abledo buffer		TTextureInfo& albedo = m_output.buffers[0];		albedo.name = "albedo";		albedo.type = TTextureNature::COLOR;		albedo.offset = 0;		CreateTexture(albedo, m_width, m_height); 		BindToFrameBuffer(albedo); 		// The normal buffer		TTextureInfo& normal = m_output.buffers[1];		normal.name = "normal";		normal.type = TTextureNature::COLOR;		normal.offset = 1;		CreateTexture(normal, m_width, m_height); 		BindToFrameBuffer(normal); 		// The specular buffer		TTextureInfo& specular = m_output.buffers[2];		specular.name = "specular";		specular.type = TTextureNature::COLOR;		specular.offset = 2;		CreateTexture(specular, m_width, m_height); 		BindToFrameBuffer(specular); 		// Position Buffer		TTextureInfo& position = m_output.buffers[3];		position.name = "position";		position.type = TTextureNature::COLOR;		position.offset = 3;		CreateTexture(position, m_width, m_height); 		BindToFrameBuffer(position); 		// Depth buffer		TTextureInfo& depth = m_output.buffers[4];		depth.name = "depth";		depth.type = TTextureNature::DEPTH;		depth.offset = 4;		CreateTexture(depth, m_width, m_height); 		BindToFrameBuffer(depth); 		// Making sure everything is OK 		CheckFrameBuffer(); 		UnBindFrameBuffer();	}
开发者ID:dreamsxin,项目名称:Donut,代码行数:57,


示例6: Reflectivity

// initialize initializes the general display design coordinator, creates the // primitive sets, textures, objects, lights, sounds, cameras, and text items//void Design::initialize() {       // general display design    //   Reflectivity redish = Reflectivity(red);   Reflectivity greenish = Reflectivity(green);   Reflectivity bluish = Reflectivity(blue);   Reflectivity whitish = Reflectivity(white);   setProjection(0.9f, 1.0f, 1000.0f);   setAmbientLight(1, 1, 1);   // camera at a distance - in lhs coordinates    // camera at a distance - in lhs coordinates   iCamera* camera = CreateCamera();   camera->translate(0, 190,-500);   camera->setRadius(17.8f);       lastUpdate = now;	    hud = CreateHUD(0.72f, 0.01f, 0.27f, 0.99f, CreateTexture(HUD_IMAGE));    // cameras ----------------------------------------------------------------   velocitytxt_=CreateText(Rectf(0.05f,0.27f,0.95f,0.37f),hud,L"",TEXT_HEIGHT,TEXT_TYPEFACE,TEXT_LEFT);   deltatxt_=CreateText(Rectf(0.05f,0.17f,0.95f,0.27f),hud,L"",TEXT_HEIGHT,TEXT_TYPEFACE,TEXT_LEFT);   positiontxt_=CreateText(Rectf(0.05f,0.38f,0.95f,0.48f),hud,L"",TEXT_HEIGHT,TEXT_TYPEFACE,TEXT_LEFT);   lasttextupdate=now;   // game ----------------------------------------------------------------------   setBackground(CreateTexture(L"farm.png"));   catcher = CreatePhysicsBox(-40, -5, 0, 40, 5, 0, &bluish, 1, PHYS_Floating, true);   iAPIWindow* win = getWindow();   catcher->translate(0, -70, 0);   truck = CreatePhysicsBox(-100, -2, 0, 100, 2, 0, &redish, 1, PHYS_Floating, true);   truck->translate(300, -50, 0);   Reflectivity yellowish = Reflectivity(yellow);   iPhysics* fallingBox = CreatePhysicsBox(-10, -10, -10, 10, 10, 10, &yellowish, 1, PHYS_Falling, true);   fallingBox->translate(-350, 350, 0);   fallingBox->setVelocity(Vector(5, 20, 0));   fallingBox->addBodyForce(Vector(0, -10, 0));   fallingBox->setCollision(CreateCSphere(fallingBox, 5));   objects.insert(objects.end(), fallingBox);   wchar_t str[MAX_DESC + 1];   StringCbPrintfW(str, MAX_DESC, L"Score: 0");   velocitytxt_->set(str);   StringCbPrintfW(str, MAX_DESC, L"Life left: 5");    deltatxt_->set(str);}
开发者ID:gbatumbya,项目名称:physics,代码行数:55,


示例7: glGenTextures

void KPboardView::InitializeTextures(const std::string &TextureDirectory,                                     const std::string &TextureName,                                     unsigned int TextureSize /*=1*/,                                     bool         Nearest /*=true*/,                                     bool         always /*=true*/){    // Read Textures from PNG files    if (TextureSize == 0)    {        throw std::invalid_argument("TextureSize must not be zero.");    }    if (textureIds[0] == 0)    {        glGenTextures(textureIds.size(), textureIds.data());    }    for (decltype(textureIds.size()) idx = 0; idx < textureIds.size(); ++idx)    {        auto file = TextureDirectory + TextureName +                    PATHSEPARATORSTRING + textureFiles[idx];        if (!always && file == textureSources[idx])        {            continue;        }        if (!CreateTexture(TextureSize, file, Nearest, &textureIds[idx]))        {            file = TextureDirectory + textureFiles[idx];            if (!always && file == textureSources[idx])            {                continue;            }            if (!CreateTexture(TextureSize, file, Nearest, &textureIds[idx]))            {                std::stringstream message;                message << "*** Error creating texture from image file '"                        << file << "'";                throw std::runtime_error(message.str());            }        }        textureSources[idx] = file;    }}
开发者ID:aladur,项目名称:khunphan,代码行数:49,


示例8: Init

void Init(HWND hWnd){    g_hWnd = hWnd;										// Assign the window handle to a global window handle    GetClientRect(g_hWnd, &g_rRect);					// Assign the windows rectangle to a global RECT    InitializeOpenGL(g_rRect.right, g_rRect.bottom);	// Init OpenGL with the global rect/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *    CreateTexture(g_Texture[0], "Sun.bmp");				// Load "Sun.bmp" into openGL as a texture for the Sun    CreateTexture(g_Texture[1], "Earth.bmp");			// Load "Earth.bmp" into openGL as a texture for the Earth    CreateTexture(g_Texture[2], "Pluto.bmp");			// Load "Pluto.bmp" into openGL as a texture for Pluto/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *}
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:15,


示例9: if

boost::shared_ptr<tTextureCacheItem> tBillboardTextureCache::GetCacheItem(const QPair<long, long>& imageID, bool wantTexture){    boost::shared_ptr<tTextureCacheItem> xItem;    if (imageID == QPair<long, long>(-1, -1))    {    }    else if( m_Textures.contains(imageID))    {        xItem = m_Textures.value(imageID);        if ( wantTexture == true )        {            if(xItem->xTexture == 0)            {                if(xItem->image.isNull() == false)                {                    CreateTexture( xItem );                }            }        }    }    else    {        QImage image;        QSize imagePixelOffset(0, 0);        QPair<QSize, QImage> results = m_GetImage(imageID);        imagePixelOffset = results.first;        image = results.second;        if(image.isNull() == false)        {            xItem.reset( new tTextureCacheItem() );            xItem->image = image;            xItem->imagePixelOffset = imagePixelOffset;            if( wantTexture == true )            {                CreateTexture( xItem );            }            m_Textures.insert(imageID, xItem);        }    }    return xItem;}
开发者ID:dulton,项目名称:53_hero,代码行数:48,


示例10: CreateTexture

FTGlyph* FTGLTextureFont::MakeGlyph( unsigned int g){  FT_Glyph* ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING);    if( ftGlyph)  {    // Estimate the glyph size size - global bbox    glyphHeight = ( charSize.Height());    glyphWidth = ( charSize.Width());        // Is there a current texture    if( numTextures == 0)    {      glTextureID[0] = CreateTexture();      xOffset = yOffset = padding;      ++numTextures;    }        // will it fit in the current texture    if( xOffset > ( textureWidth - glyphWidth))    {      xOffset = padding;      yOffset += glyphHeight;            if( yOffset > ( textureHeight - glyphHeight))      {        // no - make a new texture        glTextureID[numTextures] = CreateTexture();        yOffset = padding;        ++numTextures;      }    }        // yes - load the glyph    FTTextureGlyph* tempGlyph = new FTTextureGlyph( *ftGlyph, glTextureID[numTextures - 1],                              xOffset, yOffset, textureWidth, textureHeight);        // FIXME ceiling                xOffset += (int)(tempGlyph->BBox().x2 - tempGlyph->BBox().x1 + padding);        --remGlyphs;    return tempGlyph;  }    err = face.Error();  return NULL;}
开发者ID:unidevop,项目名称:sjtu-project-pipe,代码行数:48,


示例11: NS_ASSERTION

voidCanvasLayerD3D9::Initialize(const Data& aData){  NS_ASSERTION(mSurface == nullptr, "BasicCanvasLayer::Initialize called twice!");  if (aData.mDrawTarget) {    mDrawTarget = aData.mDrawTarget;    mSurface = gfxPlatform::GetPlatform()->GetThebesSurfaceForDrawTarget(mDrawTarget);    mNeedsYFlip = false;    mDataIsPremultiplied = true;  } else if (aData.mSurface) {    mSurface = aData.mSurface;    NS_ASSERTION(aData.mGLContext == nullptr,                 "CanvasLayer can't have both surface and WebGLContext");    mNeedsYFlip = false;    mDataIsPremultiplied = true;  } else if (aData.mGLContext) {    mGLContext = aData.mGLContext;    NS_ASSERTION(mGLContext->IsOffscreen(), "Canvas GLContext must be offscreen.");    mDataIsPremultiplied = aData.mIsGLAlphaPremult;    mNeedsYFlip = true;  } else {    NS_ERROR("CanvasLayer created without mSurface, mGLContext or mDrawTarget?");  }  mBounds.SetRect(0, 0, aData.mSize.width, aData.mSize.height);  CreateTexture();}
开发者ID:JaminLiu,项目名称:gecko-dev,代码行数:29,


示例12: Destroy

void DeviceVector2::Resize(unsigned int fSize){	Destroy();	height = fSize / width + 1;	size = fSize;	CreateTexture();}
开发者ID:roliver,项目名称:glVectorCompute,代码行数:7,


示例13: CreateVB

void JRenderServer::RecreateDefaultRes(){    m_pDevice->ResourceManagerDiscardBytes( 0 );    m_pDevice->GetBackBuffer( 0, D3DBACKBUFFER_TYPE_MONO, &m_pBackBuffer );    m_pDevice->GetDepthStencilSurface( &m_pDepthStencil );    for (int i = 0; i < m_VBuffers.size(); i++)     {        VBInstance& vb = m_VBuffers[i];        CreateVB( vb.m_Name.c_str(), vb.m_Size, !vb.m_bDynamic );    }    for (int i = 0; i < m_IBuffers.size(); i++)     {        IBInstance& ib = m_IBuffers[i];        CreateIB( ib.m_Name.c_str(), ib.m_Size, !ib.m_bDynamic );    }    for (int i = 0; i < m_Textures.size(); i++)     {        TextureFile& tex = m_Textures[i];        if (tex.m_Prop.m_PoolType == PoolType_Video)        {            CreateTexture( tex.m_Prop );        }    }    CreateQuadIB();} // JRenderServer::RecreateDefaultRes
开发者ID:skopp,项目名称:rush,代码行数:29,


示例14: SAFE_RELEASE

bool CD3DTextTexture::Create(LOGFONT * pLogFont,int Width,int Height,int MipLevels,D3DCOLOR FontColor){	//HRESULT hr;	if(pLogFont)	{			if(!SetFont(pLogFont))			return false;			}	SAFE_RELEASE(m_pTexture);		if(!CreateTexture(Width,Height,D3DFMT_DXT5,D3DUSAGE_RENDERTARGET,D3DPOOL_DEFAULT,MipLevels))		return false;		if(m_pFX==NULL)		m_pFX=m_pManager->GetDevice()->GetFXManager()->LoadFXFromMemory(_T("TEXT_TEXTURE_FX_NT"),(VOID *)TEXT_TEXTURE_FX_NT,(int)strlen(TEXT_TEXTURE_FX_NT));	m_Width=Width;	m_Height=Height;	m_Color=FontColor;	m_MipLevels=MipLevels;	m_WantUpdate=true;	if(m_pManager)	{		m_pManager->AddAniTexture(this);	}	//UpdateTexture();	return true;}
开发者ID:EnoroF,项目名称:easygamelibs,代码行数:31,


示例15: Init

static void Init(){    GLenum result = glewInit();    assert(result == GLEW_OK);    auto version = ::glGetString(GL_VERSION);    PRINTF("GL Version(%s)/n", version);    CALL_GL_API(::glClipControl(        GL_LOWER_LEFT,        GL_ZERO_TO_ONE));    CALL_GL_API(::glFrontFace(GL_CCW));    CALL_GL_API(::glViewport(0, 0, WIDTH, HEIGHT));    CALL_GL_API(::glDepthRangef(0.0f, 1.0f));    g_vs = CreateShader("shader/vs.glsl", GL_VERTEX_SHADER);    g_fs = CreateShader("shader/fs.glsl", GL_FRAGMENT_SHADER);    g_program = CreateShaderProgram(g_vs, g_fs);    g_tex = CreateTexture();}
开发者ID:nakdai,项目名称:samples,代码行数:25,


示例16: Item

void Item(int i, const char* model, const char* icon, bool equip, int delay, int ammo, int clip, int reloadrate, float damage, float range, int split, float inacc){	g_lastItem = i;	CItemType* t = &g_itemType[i];    	t->model = LoadModel(model, CVector3(1, 1, 1));	if(equip)	{		if(ammo == PRIMARYAMMO)			t->front = ModelFront(t->model, ANIM_SHOTSHOULDER_S, ANIM_SHOTSHOULDER_S+4);		else if(ammo == SECONDARYAMMO)			t->front = ModelFront(t->model, ANIM_SHOTGUNSHOT_S, ANIM_SHOTGUNSHOT_S+4);		else if(ammo == TERTAMMO)			t->front = ModelFront(t->model, ANIM_PISTOLSHOT_S, ANIM_PISTOLSHOT_S+4);	}	t->equip = equip;	t->icon = CreateTexture(icon);	t->delay = delay;	t->ammo = ammo;	t->clip = clip;	t->reloadrate = reloadrate;	t->damage = damage;	t->range = range;	t->split = split;	t->inacc = inacc;}
开发者ID:zhaozw,项目名称:pathogenandroid,代码行数:26,


示例17:

wiRenderer::TextureView wiTextureHelper::wiTextureHelperInstance::getRandom64x64(){	if (helperTextures[HELPERTEXTURE_RANDOM64X64] != nullptr)	{		return helperTextures[HELPERTEXTURE_RANDOM64X64];	}	static const int dataLength = 64 * 64 * 4;	unsigned char* data = new unsigned char[dataLength];	for (int i = 0; i < dataLength; i += 4)	{		data[i] = wiRandom::getRandom(0, 255);		data[i + 1] = wiRandom::getRandom(0, 255);		data[i + 2] = wiRandom::getRandom(0, 255);		data[i + 3] = 255;	}	if (FAILED(CreateTexture(helperTextures[HELPERTEXTURE_RANDOM64X64], data, 64, 64, 4)))	{		delete[] data;		return nullptr;	}	delete[] data;	return helperTextures[HELPERTEXTURE_RANDOM64X64];}
开发者ID:zonedoutspace,项目名称:WickedEngine,代码行数:27,


示例18: CreateTexture

SharedSurface_Basic*SharedSurface_Basic::Create(GLContext* gl,                            const GLFormats& formats,                            const IntSize& size,                            bool hasAlpha){    gl->MakeCurrent();    GLuint tex = CreateTexture(gl, formats.color_texInternalFormat,                               formats.color_texFormat,                               formats.color_texType,                               size);    SurfaceFormat format = SurfaceFormat::B8G8R8X8;    switch (formats.color_texInternalFormat) {    case LOCAL_GL_RGB:    case LOCAL_GL_RGB8:        if (formats.color_texType == LOCAL_GL_UNSIGNED_SHORT_5_6_5)            format = SurfaceFormat::R5G6B5;        else            format = SurfaceFormat::B8G8R8X8;        break;    case LOCAL_GL_RGBA:    case LOCAL_GL_RGBA8:        format = SurfaceFormat::B8G8R8A8;        break;    default:        MOZ_CRASH("Unhandled Tex format.");    }    return new SharedSurface_Basic(gl, size, hasAlpha, format, tex);}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:30,


示例19: CreateWaveMesh

/** * Creates a wave mesh of the desired world size and number of vertices wide. */void CreateWaveMesh(float scale, unsigned int vertexDim){	DestroyWaveMesh();	if (scale < 1)	{		scale = 1;	}	if (vertexDim < 2)	{		vertexDim = 2;	}	gWorldSize = scale;	gVertexDim = vertexDim;	gNumVertices = gVertexDim*gVertexDim;	bool success;	success = CreateVertexBuffer( scale, vertexDim );	if ( success == false )		return;	success = CreateIndexBuffer( vertexDim );	if ( success == false )		return;	success = CreateTexture();	if ( success == false )		return;	gWaveStartTime = static_cast<float>(GetSystemTimeMs());}
开发者ID:shawnh310,项目名称:sdk-dist,代码行数:36,


示例20: SetupGraphics

static int SetupGraphics(void){    glClearColor (0.0f, 0.0f, 0.0f, 0.0f);    CreateTexture(Width, Height);    glDisable(GL_DEPTH_TEST);    glActiveTexture(GL_TEXTURE0);        glViewport(0, 0, Width, Height);    glMatrixMode(GL_MODELVIEW);    glLoadIdentity();    glMatrixMode(GL_PROJECTION);    glLoadIdentity();    TexCoords[3][0] = 0.0f;    TexCoords[3][1] = 0.0f;    TexCoords[2][0] = Width;    TexCoords[2][1] = 0.0f;    TexCoords[1][0] = Width;    TexCoords[1][1] = Height;    TexCoords[0][0] = 0.0f;    TexCoords[0][1] = Height;    glEnableClientState(GL_VERTEX_ARRAY);    glEnableClientState(GL_TEXTURE_COORD_ARRAY);    glVertexPointer(2, GL_FLOAT, 0, VertexPos);    glClientActiveTexture(GL_TEXTURE0);    glTexCoordPointer(2, GL_FLOAT, 0, TexCoords);    return GL_NO_ERROR;}
开发者ID:voxels,项目名称:Daytum,代码行数:32,


示例21: NS_ASSERTION

voidCanvasLayerD3D9::Initialize(const Data& aData){  NS_ASSERTION(mSurface == nsnull, "BasicCanvasLayer::Initialize called twice!");  if (aData.mDrawTarget) {    mDrawTarget = aData.mDrawTarget;    mNeedsYFlip = false;    mDataIsPremultiplied = true;  } else if (aData.mSurface) {    mSurface = aData.mSurface;    NS_ASSERTION(aData.mGLContext == nsnull,                 "CanvasLayer can't have both surface and GLContext");    mNeedsYFlip = false;    mDataIsPremultiplied = true;  } else if (aData.mGLContext) {    NS_ASSERTION(aData.mGLContext->IsOffscreen(), "canvas gl context isn't offscreen");    mGLContext = aData.mGLContext;    mCanvasFramebuffer = mGLContext->GetOffscreenFBO();    mDataIsPremultiplied = aData.mGLBufferIsPremultiplied;    mNeedsYFlip = true;  } else {    NS_ERROR("CanvasLayer created without mSurface, mGLContext or mDrawTarget?");  }  mBounds.SetRect(0, 0, aData.mSize.width, aData.mSize.height);  CreateTexture();}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:29,


示例22: Init

void Init(HWND hWnd){	g_hWnd = hWnd;										// Assign the window handle to a global window handle	GetClientRect(g_hWnd, &g_rRect);					// Assign the windows rectangle to a global RECT	InitializeOpenGL(g_rRect.right, g_rRect.bottom);	// Init OpenGL with the global rect	g_Load3ds.Import3DS(&g_3DModel, FILE_NAME);			// Load our .3DS file into our model structure	// Go through all the materials	for(int i = 0; i < g_3DModel.numOfMaterials; i++)	{		// Check to see if there is a file name to load in this material		if(strlen(g_3DModel.pMaterials[i].strFile) > 0)		{			// Use the name of the texture file to load the bitmap, with a texture ID (i).			// We pass in our global texture array, the name of the texture, and an ID to reference it.				CreateTexture(g_Texture, g_3DModel.pMaterials[i].strFile, i);					}		// Set the texture ID for this material		g_3DModel.pMaterials[i].texureId = i;	}	glEnable(GL_LIGHT0);								// Turn on a light with defaults set	glEnable(GL_LIGHTING);								// Turn on lighting	glEnable(GL_COLOR_MATERIAL);						// Allow color}
开发者ID:twinklingstar20,项目名称:Programming-Tutorials,代码行数:27,


示例23: GetTexture

int JResourceManager::CreateQuad(const string &quadName, const string &textureName, float x, float y, float width, float height){	map<string, int>::iterator itr = mQuadMap.find(quadName);	if (itr == mQuadMap.end())	{		JTexture *tex = GetTexture(textureName);			if (tex == NULL)		{			int texId = CreateTexture(textureName);		// load texture if necessary			tex = GetTexture(texId);		}		if (tex == NULL)								// no texture, no quad...			return INVALID_ID;		printf("creating quad:%s/n", quadName.c_str());		int id = mQuadList.size();		mQuadList.push_back(new JQuad(tex, x, y, width, height));		mQuadMap[quadName] = id;				return id;	}	else		return itr->second;}
开发者ID:Leajian,项目名称:cspsp-nightly,代码行数:29,


示例24: GetFactorForPercentage

void CDlgCreateSpecularTexture::DoDataExchange(CDataExchange* pDX){	CDialog::DoDataExchange(pDX);  if( !pDX->m_bSaveAndValidate)  {    INDEX iExponent = DEFAULT_EXPONENT_POS;    if( IsWindow( m_sliderSpecularExponent.m_hWnd))    {      iExponent = m_sliderSpecularExponent.GetPos();    }    CTString strNumericalExponent;    strNumericalExponent.PrintF( "Value: %.1f", GetFactorForPercentage(iExponent));    m_strNumericalExponent = strNumericalExponent;  }	  //{{AFX_DATA_MAP(CDlgCreateSpecularTexture)	DDX_Control(pDX, IDC_SPECULAR_EXPONENT, m_sliderSpecularExponent);	DDX_Control(pDX, IDC_SPECULAR_COLOR, m_colorSpecular);	DDX_Control(pDX, IDC_SIZE_IN_PIXELS, m_comboSizeInPixels);	DDX_Control(pDX, IDC_LIGHT_COLOR, m_colorLight);	DDX_Control(pDX, IDC_AMBIENT_COLOR, m_colorAmbient);	DDX_Text(pDX, IDC_NUMERIC_EXPONENT_T, m_strNumericalExponent);	DDX_Check(pDX, IDC_AUTO_ROTATE, m_bAutoRotate);	//}}AFX_DATA_MAP    if( (pDX->m_bSaveAndValidate) && IsWindow( m_sliderSpecularExponent.m_hWnd) )  {                        INDEX iSlider = m_sliderSpecularExponent.GetPos();    CreateTexture( CTString("temp//SpecularTemp.tex"), GetFactorForPercentage( iSlider));    CTextureData *pTD = (CTextureData *) m_moModel.mo_toSpecular.GetData();    if( pTD != NULL) pTD->Reload();    Invalidate( FALSE);  }}
开发者ID:0-T-0,项目名称:Serious-Engine,代码行数:35,


示例25: CreateTexture

void Texture::SetTextureData2D(ImageData &ImgInfo, bool Reassign){	if (Reassign) Destroy();	CreateTexture(); // Make sure our texture exists.	if (ImgInfo.Data.size() == 0 && !Reassign)	{		return;	}	auto img = ImgInfo.TempData ? ImgInfo.TempData : ImgInfo.Data.data();	if (!TextureAssigned || Reassign) // We haven't set any data to this texture yet, or we want to regenerate storage	{		TextureAssigned = true;		auto Dir = ImgInfo.Filename.filename().string();		glPixelStorei(GL_UNPACK_ALIGNMENT, ImgInfo.Alignment);		Renderer::SetTextureParameters(Dir);		//glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, ImgInfo.Width, ImgInfo.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, ImgInfo.Data.data());		glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, ImgInfo.Width, ImgInfo.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, img);	}	else // We did, so let's update instead.	{		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, ImgInfo.Width, ImgInfo.Height, GL_RGBA, GL_UNSIGNED_BYTE, img);	}	w = ImgInfo.Width;	h = ImgInfo.Height;	fname = ImgInfo.Filename;}
开发者ID:zardoru,项目名称:raindrop,代码行数:33,


示例26: Test28

void Test28(){	InitWindow();	static Bitmap bm;	bm.w = bm.h = 256; bm.form = BMFORMAT_B8G8R8A8; bm.pal = 0;	bm.pix = (uchar*)malloc(bm.w * bm.h * 4);	memset(bm.pix, 127, bm.w * bm.h * 4);	static int px = 61, py = 89, vx = 2, vy = -3;	*(uint*)(bm.pix + (py*bm.w + px) * 4) = -1;	static texture t = CreateTexture(&bm, 1);	while(!appexit)	{		px += vx; if(px < 0 || px >= 256) {px -= vx; vx = -vx;}		py += vy; if(py < 0 || py >= 256) {py -= vy; vy = -vy;}		*(uint*)(bm.pix + (py*bm.w + px) * 4) = -1;		renderer->UpdateTexture(t, &bm);		BeginDrawing();		InitRectDrawing();		SetTexture(0, t);		DrawRect(0, 0, 256, 256, -1);		EndDrawing();		HandleWindow();	}}
开发者ID:AdrienTD,项目名称:wkbre,代码行数:27,


示例27: J2dTraceLn

HRESULTD3DResourceManager::GetCachedDestTexture(D3DFORMAT format,                                         D3DResource **ppTextureResource){    J2dTraceLn(J2D_TRACE_INFO, "D3DRM::GetCachedDestTexture");    RETURN_STATUS_IF_NULL(pCtx, E_FAIL);    RETURN_STATUS_IF_NULL(ppTextureResource, E_FAIL);    HRESULT res =        GetStockTextureResource(D3DTR_CACHED_DEST_WIDTH,                                D3DTR_CACHED_DEST_HEIGHT,                                TRUE/*isRTT*/, FALSE/*isOpaque*/,                                &format, 0, &pCachedDestTexture);    if (SUCCEEDED(res)) {        D3DSURFACE_DESC *pDesc = pCachedDestTexture->GetDesc();        D3DCAPS9 *pDevCaps = pCtx->GetDeviceCaps();        if ((format == pDesc->Format ||             SUCCEEDED(pCtx->Get3DObject()->CheckDeviceFormatConversion(                           pDevCaps->AdapterOrdinal,                           pDevCaps->DeviceType, format, pDesc->Format))))        {            *ppTextureResource = pCachedDestTexture;            return res;        }        // current texture doesn't fit, release and allocate a new one        ReleaseResource(pCachedDestTexture);        pCachedDestTexture = NULL;    }    res = CreateTexture(D3DTR_CACHED_DEST_WIDTH, D3DTR_CACHED_DEST_HEIGHT,                        TRUE, FALSE, &format, 0,                        &pCachedDestTexture);    *ppTextureResource = pCachedDestTexture;    return res;}
开发者ID:ChenYao,项目名称:jdk7u-jdk,代码行数:35,


示例28: Destroy

void DeviceVector::Resize(unsigned int fSize){	Destroy();	height = (fSize + (width - 1)) / width;	size = fSize;	CreateTexture();}
开发者ID:ReubenJCarter,项目名称:glVectorCompute,代码行数:7,



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


C++ CreateThread函数代码示例
C++ CreateTestTable函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。