本文整理汇总了C++中LLPluginClassMedia::getTextureFormatType方法的典型用法代码示例。如果您正苦于以下问题:C++ LLPluginClassMedia::getTextureFormatType方法的具体用法?C++ LLPluginClassMedia::getTextureFormatType怎么用?C++ LLPluginClassMedia::getTextureFormatType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLPluginClassMedia
的用法示例。
在下文中一共展示了LLPluginClassMedia::getTextureFormatType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateBrowserTexture
bool LLWebBrowserTexture::updateBrowserTexture()
{
if (!adjustSize())
return false;
LLPluginClassMedia* media = mMediaSource->getMediaPlugin();
if(!media->textureValid())
return false;
if(mMediaSource->mNeedsNewTexture
|| media->getTextureWidth() != getFullWidth()
|| media->getTextureHeight() != getFullHeight() )
{
//releaseGLTexture();
mFullWidth = media->getTextureWidth();
mFullHeight = media->getTextureHeight();
mTextureCoordsOpenGL = media->getTextureCoordsOpenGL();
const LLColor4U fill_color(0,0,0,255);
// will create mWidth * mHeight sized texture, using the texture params specified by the media.
generateGLTexture(
media->getTextureFormatInternal(),
media->getTextureFormatPrimary(),
media->getTextureFormatType(),
media->getTextureFormatSwapBytes(),
&fill_color); //Initialize the texture to black.
mMediaSource->mNeedsNewTexture = false;
}
return true;
}
示例2: createTexture
void createTexture()
{
// create the texture used to display the browser data
if(mMediaSource->textureValid())
{
mAppTextureWidth = mMediaSource->getTextureWidth();
mAppTextureHeight = mMediaSource->getTextureHeight();
mAppTextureCoordsOpenGL = mMediaSource->getTextureCoordsOpenGL();
if(mAppTexture != 0)
{
glDeleteTextures( 1, &mAppTexture );
mAppTexture = 0;
}
glGenTextures( 1, &mAppTexture );
glBindTexture( GL_TEXTURE_2D, mAppTexture );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexImage2D( GL_TEXTURE_2D, 0,
mMediaSource->getTextureFormatInternal(),
mAppTextureWidth,
mAppTextureHeight,
0,
mMediaSource->getTextureFormatPrimary(),
mMediaSource->getTextureFormatType(),
NULL );
}
}
示例3: getMediaPlugin
/*LLViewerMediaTexture*/LLViewerTexture* LLViewerMediaImpl::updatePlaceholderImage()
{
if(mTextureId.isNull())
{
// The code that created this instance will read from the plugin's bits.
return NULL;
}
LLViewerMediaTexture* placeholder_image = (LLViewerMediaTexture*)LLViewerTextureManager::getFetchedTexture( mTextureId );
LLPluginClassMedia* plugin = getMediaPlugin();
placeholder_image->getLastReferencedTimer()->reset();
if (mNeedsNewTexture
|| placeholder_image->getUseMipMaps()
|| ! placeholder_image->mIsMediaTexture
|| (placeholder_image->getWidth() != plugin->getTextureWidth())
|| (placeholder_image->getHeight() != plugin->getTextureHeight())
|| (mTextureUsedWidth != plugin->getWidth())
|| (mTextureUsedHeight != plugin->getHeight())
)
{
llinfos << "initializing media placeholder" << llendl;
llinfos << "movie image id " << mTextureId << llendl;
int texture_width = plugin->getTextureWidth();
int texture_height = plugin->getTextureHeight();
int texture_depth = plugin->getTextureDepth();
// MEDIAOPT: check to see if size actually changed before doing work
placeholder_image->destroyGLTexture();
// MEDIAOPT: apparently just calling setUseMipMaps(FALSE) doesn't work?
placeholder_image->reinit(FALSE); // probably not needed
// MEDIAOPT: seems insane that we actually have to make an imageraw then
// immediately discard it
LLPointer<LLImageRaw> raw = new LLImageRaw(texture_width, texture_height, texture_depth);
raw->clear(0x0f, 0x0f, 0x0f, 0xff);
int discard_level = 0;
// ask media source for correct GL image format constants
placeholder_image->setExplicitFormat(plugin->getTextureFormatInternal(),
plugin->getTextureFormatPrimary(),
plugin->getTextureFormatType(),
plugin->getTextureFormatSwapBytes());
placeholder_image->createGLTexture(discard_level, raw);
// placeholder_image->setExplicitFormat()
placeholder_image->setUseMipMaps(FALSE);
// MEDIAOPT: set this dynamically on play/stop
placeholder_image->mIsMediaTexture = true;
mNeedsNewTexture = false;
// If the amount of the texture being drawn by the media goes down in either width or height,
// recreate the texture to avoid leaving parts of the old image behind.
mTextureUsedWidth = plugin->getWidth();
mTextureUsedHeight = plugin->getHeight();
}
return placeholder_image;
}
示例4: display
void display()
{
mMediaSource->idle();
// Check whether the texture needs to be recreated.
if(mMediaSource->textureValid())
{
if(
(mAppTextureWidth != mMediaSource->getTextureWidth() || mAppTextureHeight != mMediaSource->getTextureHeight()) &&
(mAppWindowWidth == mMediaSource->getWidth() && mAppWindowHeight == mMediaSource->getHeight())
)
{
// Attempt to (re)create the texture
createTexture();
}
}
// clear screen
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glLoadIdentity();
if(mAppTexture != 0)
{
// use the browser texture
glBindTexture( GL_TEXTURE_2D, mAppTexture );
// If dirty, update the texture.
LLRect dirtyRect;
if(!mMediaSource->textureValid())
{
// LL_DEBUGS("media_plugin_test") << "Resize in progress, skipping update..." << LL_ENDL;
}
else if(mAppWindowWidth != mMediaSource->getWidth() || mAppWindowHeight != mMediaSource->getHeight())
{
// A resize is in progress. Just wait for it...
}
else if(mMediaSource->getDirty(&dirtyRect))
{
// grab the page
const unsigned char* pixels = mMediaSource->getBitsData();
if ( pixels )
{
// write them into the texture
// Paranoia: intersect dirtyRect with (0, 0, mAppTextureWidth, mAppTextureHeight)?
int x_offset = dirtyRect.mLeft;
int y_offset = dirtyRect.mBottom;
int width = dirtyRect.mRight - dirtyRect.mLeft;
int height = dirtyRect.mTop - dirtyRect.mBottom;
LL_DEBUGS("media_plugin_test") << "Updating, dirty rect is ("
<< dirtyRect.mLeft << ", "
<< dirtyRect.mTop << ", "
<< dirtyRect.mRight << ", "
<< dirtyRect.mBottom << "), update params are: ("
<< x_offset << ", "
<< y_offset << ", "
<< width << ", "
<< height << ")"
<< LL_ENDL;
// Offset the pixels pointer properly
pixels += (y_offset * mMediaSource->getTextureDepth() * mMediaSource->getTextureWidth());
pixels += (x_offset * mMediaSource->getTextureDepth());
glPixelStorei(GL_UNPACK_ROW_LENGTH, mMediaSource->getTextureWidth());
glTexSubImage2D( GL_TEXTURE_2D, 0,
x_offset,
y_offset,
width,
height,
mMediaSource->getTextureFormatPrimary(),
mMediaSource->getTextureFormatType(),
pixels );
mMediaSource->resetDirty();
}
}
// scale the texture so that it fits the screen
GLdouble media_texture_x = mAppWindowWidth / (double)mAppTextureWidth;
GLdouble media_texture_y = mAppWindowHeight / (double)mAppTextureHeight;
// draw the single quad full screen (orthographic)
glEnable( GL_TEXTURE_2D );
glColor3f( 1.0f, 1.0f, 1.0f );
glBegin( GL_QUADS );
if(mAppTextureCoordsOpenGL)
{
// Render the texture as per opengl coords (where 0,0 is at the lower left)
glTexCoord2d( 0, 0 );
glVertex2d( 0, 0 );
glTexCoord2d( 0 , media_texture_y );
glVertex2d( 0, mAppWindowHeight);
//.........这里部分代码省略.........