本文整理汇总了C++中CreateTexture函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateTexture函数的具体用法?C++ CreateTexture怎么用?C++ CreateTexture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateTexture函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例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;
}
示例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();
}
}
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
}
示例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 * /////// * /////////// * /////////// *
}
示例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;
}
示例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;
}
示例11: NS_ASSERTION
void
CanvasLayerD3D9::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();
}
示例12: Destroy
void DeviceVector2::Resize(unsigned int fSize)
{
Destroy();
height = fSize / width + 1;
size = fSize;
CreateTexture();
}
示例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
示例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;
}
示例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();
}