本文整理汇总了C++中GetRenderer函数的典型用法代码示例。如果您正苦于以下问题:C++ GetRenderer函数的具体用法?C++ GetRenderer怎么用?C++ GetRenderer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetRenderer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dc
void C3DView::OnPaint()
{
CPaintDC dc(this); // device context for painting
if (GetRenderer())
GetRenderer()->Redraw();
}
示例2: TTF_OpenFont
DisconnectedScreen::DisconnectedScreen() {
ConfigUtility& config = ConfigUtility::GetSingleton();
//setup the utility objects
//TODO: (1) resource tool, to prevent reloading like this
image.Load(GetRenderer(), config["dir.interface"] + "button_blue.png");
font = TTF_OpenFont(config["client.font"].c_str(), 12);
//check that the font loaded
if (!font) {
std::ostringstream msg;
msg << "Failed to load a font file; " << SDL_GetError();
throw(std::runtime_error(msg.str()));
}
//setup the button
backButton.SetBackgroundTexture(GetRenderer(), image.GetTexture());
backButton.SetText(GetRenderer(), font, WHITE, "Back");
//set the button positions
backButton.SetX(50);
backButton.SetY(50);
//set the disconnection message text
textLine.SetX(50);
textLine.SetY(30);
textLine.SetText(GetRenderer(), font, WHITE, config["client.disconnectMessage"]);
//full reset
UDPNetworkUtility::GetSingleton().Unbind(Channels::SERVER);
//auto return
startTick = std::chrono::steady_clock::now();
}
示例3: GetRenderer
vtkProp* RenderView3D::PickProp( int posX, int posY, double* pos_out )
{
vtkCellPicker* picker = vtkCellPicker::SafeDownCast( this->GetRenderWindow()->GetInteractor()->GetPicker() );
if ( !picker )
{
return NULL;
}
picker->InitializePickList();
vtkPropCollection* props = GetRenderer()->GetViewProps();
if ( props )
{
props->InitTraversal();
vtkProp* prop = props->GetNextProp();
while ( prop )
{
if ( vtkActor::SafeDownCast( prop ) )
{
picker->AddPickList( prop );
}
prop = props->GetNextProp();
}
}
picker->Pick( posX, rect().height() - posY, 0, GetRenderer() );
if ( pos_out )
{
picker->GetPickPosition( pos_out );
}
return picker->GetViewProp();
}
示例4: GetRenderer
// Touch event handler.
bool COGActorPlayer::OnTouch (const OGVec2& _vPos, IOGTouchParam _param)
{
if (_param != OG_TOUCH_DOWN)
return false;
if (m_bFinishLineFlight)
return false;
OGVec3 vP = GetRenderer()->UnprojectCoords((int)_vPos.x, (int)_vPos.y);
OGVec3 vCam = GetRenderer()->GetCamera()->GetPosition();
OGVec3 vDir = (vP - vCam).normalized();
OGVec3 vPoint = FindIntersectionWithPlane(
m_pPhysicalObject->GetPosition().y,
vCam,
vDir);
m_vTarget = vPoint;
m_OrientWorker.Reset();
m_OrientWorker.SetTarget(vPoint);
m_OrientWorker.Activate(true);
m_CoolDown = 0;
m_StraightenWorker.Activate(false);
return true;
}
示例5: DrawTitle
void DrawTitle()
{
GList *elem,*elem2;
Button *ref;
SDL_Rect src;
Editor_Panel* panel;
Label* label;
int n,i,j;
if(game->gameState == &StateTitle){
if(g_list_length(MainEditorPanels) != 0){
for(n = 0; n < g_list_length(MainEditorPanels);++n)
{
elem = g_list_nth(MainEditorPanels,n);
panel = (Editor_Panel*)elem->data;
for(i = 0; i < g_list_length(panel->buttons);++i)
{
elem2 = g_list_nth(panel->buttons,i);
ref = (Button*)elem2->data;
DrawSprite(ref->sprite,ref->rect.x,ref->rect.y,ref->frame,GetRenderer(),SDL_FLIP_NONE);
}
for(i = 0; i < g_list_length(panel->labels);++i)
{
elem2 = g_list_nth(panel->labels,i);
label = (Label*)elem2->data;
DrawSprite(label->sprite,label->rect.x,label->rect.y,0,GetRenderer(),SDL_FLIP_NONE);
}
}
}
}
}
示例6: GetTextureBuffer
bool SurfaceTextureBuffer::MakeCurrent(uint8 nFace)
{
// Check whether the data is valid and whether there's a texture buffer
if (m_cTextureBufferHandler.GetResource() && GetTextureBuffer()) {
// Set target face
if (GetTextureBuffer()->GetType() == PLRenderer::Resource::TypeTextureBufferCube)
m_nFace = nFace;
else
m_nFace = 0;
// Cleanup texture buffer handlers
for (uint32 i=0; i<m_lstTextureBufferHandler.GetNumOfElements(); i++)
delete m_lstTextureBufferHandler[i];
m_lstTextureBufferHandler.Clear();
// Add primary texture buffer handler
PLRenderer::ResourceHandler *pTextureBufferHandler = new PLRenderer::ResourceHandler();
pTextureBufferHandler->SetResource(m_cTextureBufferHandler.GetResource());
m_lstTextureBufferHandler.Add(pTextureBufferHandler);
// Frame buffer object used?
if (m_pFrameBufferObject && m_cTextureBufferHandler.GetResource()) {
m_pFrameBufferObject->SwitchTarget(static_cast<PLRenderer::TextureBuffer&>(*m_cTextureBufferHandler.GetResource()), 0, nFace);
m_pFrameBufferObject->Bind();
// Need rendering to depth only
PLRenderer::TextureBuffer::EPixelFormat nFormat = GetTextureBuffer()->GetFormat();
if (nFormat == PLRenderer::TextureBuffer::D16 || nFormat == PLRenderer::TextureBuffer::D24 || nFormat == PLRenderer::TextureBuffer::D32) {
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);
} else {
// Get extensions instance
const Extensions &cExtensions = static_cast<Renderer&>(GetRenderer()).GetContext().GetExtensions();
// Set draw buffers
static const GLuint db[16] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_COLOR_ATTACHMENT3_EXT,
GL_COLOR_ATTACHMENT4_EXT, GL_COLOR_ATTACHMENT5_EXT, GL_COLOR_ATTACHMENT6_EXT, GL_COLOR_ATTACHMENT7_EXT,
GL_COLOR_ATTACHMENT8_EXT, GL_COLOR_ATTACHMENT9_EXT, GL_COLOR_ATTACHMENT10_EXT, GL_COLOR_ATTACHMENT11_EXT,
GL_COLOR_ATTACHMENT12_EXT, GL_COLOR_ATTACHMENT13_EXT, GL_COLOR_ATTACHMENT14_EXT, GL_COLOR_ATTACHMENT15_EXT};
if (cExtensions.IsGL_ARB_draw_buffers())
glDrawBuffersARB(m_nMaxColorTargets, db);
else if (cExtensions.IsGL_ATI_draw_buffers())
glDrawBuffersATI(m_nMaxColorTargets, db);
}
// Else...
} // ... If there's no frame buffer, we can still 'render to texture' by only using glCopyTexSubImage2D() to
// copy the drawn stuff into a texture buffer. But this way, the current framebuffer content is 'overdrawn' and
// the texture buffer size we can render in is limited to the screen size.
// Enable/disable multisample - "shouldn't" have an effect when render to texture, but safe is safe :D
GetRenderer().SetRenderState(PLRenderer::RenderState::MultisampleEnable, !(GetFlags() & NoMultisampleAntialiasing));
// Done
return true;
}
// Error!
return false;
}
示例7: TTF_OpenFont
OptionsMenu::OptionsMenu() {
ConfigUtility& config = ConfigUtility::GetSingleton();
//setup the utility objects
buttonImage.Load(GetRenderer(), config["dir.interface"] + "button_blue.png");
font = TTF_OpenFont(config["client.font"].c_str(), 12);
//check that the font loaded
if (!font) {
std::ostringstream msg;
msg << "Failed to load a font file; " << SDL_GetError();
throw(std::runtime_error(msg.str()));
}
//setup the button
backButton.SetBackgroundTexture(GetRenderer(), buttonImage.GetTexture());
backButton.SetText(GetRenderer(), font, WHITE, "Back");
//set the button positions
backButton.SetX(50);
backButton.SetY(50);
//text line
textLine.SetX(50);
textLine.SetY(30);
textLine.SetText(GetRenderer(), font, WHITE, "Am I making any progress?");
}
示例8: switch
int FLmitkComfortWidget::handle(int event) {
switch(event) {
case FL_MOUSEWHEEL:
if (Fl::event_dy() > 0) {
sliceCtrl->GetSlice()->Next();
} else {
sliceCtrl->GetSlice()->Previous();
}
GetRenderer()->Render();
draw();
return 1;
break;
case FL_PUSH:
m_LastX = Fl::event_x();
m_LastY = Fl::event_y();
return 1;
break;
case FL_DRAG:
int dx = Fl::event_x() - m_LastX;
int dy = Fl::event_y() - m_LastY;
m_LastX = Fl::event_x();
m_LastY = Fl::event_y();
mitk::LevelWindow lvlWin;
if (m_Node.IsNotNull() && m_Node->GetLevelWindow(lvlWin,GetRenderer())) {
lvlWin.SetLevelWindow(lvlWin.GetLevel() + dy, lvlWin.GetWindow() + dx);
m_Node->SetLevelWindow(lvlWin,GetRenderer());
m_Node->SetLevelWindow(lvlWin,NULL);
GetRenderer()->Render();
draw();
}
return 1;
}
return FLmitkRenderWindow::handle(event);
}
示例9: GetRenderer
BacteroidsState::~BacteroidsState()
{
GetRenderer().GetGraphics()->DestroyShaderProgram(m_playerShader);
GetRenderer().GetGraphics()->DestroyShaderProgram(m_bacterShader);
GetRenderer().GetGraphics()->DestroyShaderProgram(m_projectileShader);
GetRenderer().GetGraphics()->DestroyShaderProgram(m_fontShader);
}
示例10: GetRenderer
void VCloudSkySystem::update(const float& timeSinceLastFrame)
{
if (!mCreated)
{
return;
}
GetRenderer()->setShader(mSkydomeShader);
if (mTimeMultiplier != 0)
{
float timemultiplied = timeSinceLastFrame * mTimeMultiplier;
mTimeOffset += timemultiplied;
mController->update(timemultiplied);
if (mStarfield)
{
GetApp()->getRenderer()->setShaderConstant1f("uTime", mTimeOffset*0.5f);
}
}
GetRenderer()->setShader(mSkydomeShader);
GetApp()->getRenderer()->setShaderConstant3f("uLightDir", mController->getSunDirection().ToFloatPtr());
mMoonManager->updateMoonPhase(mController->getMoonPhase());
mCloudsManager->update();
mVCloudsManager->update(timeSinceLastFrame);
}
示例11: GetRenderer
void CloudLayer::_updateInternalPassParameters()
{
GetRenderer()->setShader(mSkyX->mCloudShader);
GetRenderer()->setShaderConstant1f("uExposure", mSkyX->getAtmosphereManager()->getOptions().Exposure);
GetRenderer()->setShaderConstant1f("uTime", mSkyX->_getTimeOffset()*mOptions.TimeMultiplier);
float point = (mSkyX->getController()->getSunDirection().y + 1.0f) / 2.0f;
GetRenderer()->setShaderConstant3f("uSunColor", mSunGradient.getColor(point).ToFloatPtr());
GetRenderer()->setShaderConstant3f("uAmbientLuminosity", mAmbientGradient.getColor(point).ToFloatPtr());
//mCloudLayerPass->getFragmentProgramParameters()
// ->setNamedConstant("uExposure", mSkyX->getAtmosphereManager()->getOptions().Exposure);
//mCloudLayerPass->getFragmentProgramParameters()
// ->setNamedConstant("uTime", mSkyX->_getTimeOffset()*mOptions.TimeMultiplier);
/*
mCloudLayerPass->getFragmentProgramParameters()
->setNamedConstant("uSunPosition", -mSkyX->getAtmosphereManager()->getSunDirection()*mSkyX->getMeshManager()->getSkydomeRadius());
noVec3 AmbientColor = noVec3::ZERO;
noVec3 SunDir = -mSkyX->getAtmosphereManager()->getSunDirection();
float Ang = 0;
for (int k = 0; k < 3; k++)
{
noVec2 Coords = noVec2(noMath::Cos(Ang), noMath::Sin(Ang));
Ang += 2*noMath::PI/3;
AmbientColor += mSkyX->getAtmosphereManager()->getColorAt(noVec3(Coords.x, mOptions.Height/mSkyX->getMeshManager()->getSkydomeRadius(), Coords.y).normalisedCopy());
}
AmbientColor /= 3;
mCloudLayerPass->getFragmentProgramParameters()
->setNamedConstant("uAmbientLuminosity", AmbientColor*0.75f);
float Mult = 1.5f;
mCloudLayerPass->getFragmentProgramParameters()
->setNamedConstant("uSunColor", noVec3(
noMath::Clamp<float>(AmbientColor.x*Mult, 0, 1),
noMath::Clamp<float>(AmbientColor.y*Mult, 0, 1),
noMath::Clamp<float>(AmbientColor.z*Mult, 0, 1)));
*/
//noVec3 SunDir = mSkyX->getAtmosphereManager()->getSunDirection();
//if (SunDir.y > 0.15f)
//{
// SunDir = -SunDir;
//}
// mCloudLayerPass->getFragmentProgramParameters()
// ->setNamedConstant("uSunPosition", -SunDir*mSkyX->getMeshManager()->getSkydomeRadius());
//float point = (mSkyX->getController()->getSunDirection().y + 1.0f) / 2.0f;
/*mCloudLayerPass->getFragmentProgramParameters()
->setNamedConstant("uSunColor", mSunGradient.getColor(point));
mCloudLayerPass->getFragmentProgramParameters()
->setNamedConstant("uAmbientLuminosity", mAmbientGradient.getColor(point));*/
}
示例12: GetRenderer
void C3DView::OnMouseMove(UINT nFlags, CPoint point)
{
if (GetRenderer())
{
GetRenderer()->OnMouseMove(nFlags, point.x, point.y);
ChangeCursor();
}
CView::OnMouseMove(nFlags, point);
}
示例13: RenderFont
void RenderFont(char *message,SDL_Rect &rect,TTF_Font *f,SDL_Color *fg)
{
SDL_Surface * text;
SDL_Texture * texture;
text = TTF_RenderText_Solid(f, message , *fg);
texture = SDL_CreateTextureFromSurface(GetRenderer(),text);
SDL_QueryTexture(texture,NULL,NULL,&rect.w,&rect.h);
SDL_RenderCopy(GetRenderer(),texture,NULL,&rect);
}
示例14: GetTextureBuffer
bool SurfaceTextureBuffer::MakeCurrent(uint8 nFace)
{
// Check whether the data is valid and whether there's a texture buffer
if (m_cTextureBufferHandler.GetResource() && GetTextureBuffer()) {
// Set target face
if (GetTextureBuffer()->GetType() == PLRenderer::Resource::TypeTextureBufferCube)
m_nFace = nFace;
else
m_nFace = 0;
// Cleanup texture buffer handlers
for (uint32 i=0; i<m_lstTextureBufferHandler.GetNumOfElements(); i++)
delete m_lstTextureBufferHandler[i];
m_lstTextureBufferHandler.Clear();
// Add primary texture buffer handler
PLRenderer::ResourceHandler *pTextureBufferHandler = new PLRenderer::ResourceHandler();
pTextureBufferHandler->SetResource(m_cTextureBufferHandler.GetResource());
m_lstTextureBufferHandler.Add(pTextureBufferHandler);
// Frame buffer object used?
if (m_pFrameBufferObject && m_cTextureBufferHandler.GetResource()) {
m_pFrameBufferObject->SwitchTarget(static_cast<PLRenderer::TextureBuffer&>(*m_cTextureBufferHandler.GetResource()), 0, nFace);
m_pFrameBufferObject->Bind();
// Need rendering to depth only
PLRenderer::TextureBuffer::EPixelFormat nFormat = GetTextureBuffer()->GetFormat();
const Extensions &cExtensions = static_cast<Renderer&>(GetRenderer()).GetContext().GetExtensions();
if (nFormat == PLRenderer::TextureBuffer::D16 || nFormat == PLRenderer::TextureBuffer::D24 || nFormat == PLRenderer::TextureBuffer::D32) {
// "GL_NV_read_buffer"-extension available?
if (cExtensions.IsGL_NV_read_buffer())
glReadBufferNV(GL_NONE);
} else {
// "GL_ARB_draw_buffers" & "GL_NV_fbo_color_attachments" extensions available?
if (cExtensions.IsGL_ARB_draw_buffers() && cExtensions.IsGL_NV_fbo_color_attachments()) {
// Set draw buffers
static const GLenum db[16] = { GL_COLOR_ATTACHMENT0_NV, GL_COLOR_ATTACHMENT1_NV, GL_COLOR_ATTACHMENT2_NV, GL_COLOR_ATTACHMENT3_NV,
GL_COLOR_ATTACHMENT4_NV, GL_COLOR_ATTACHMENT5_NV, GL_COLOR_ATTACHMENT6_NV, GL_COLOR_ATTACHMENT7_NV,
GL_COLOR_ATTACHMENT8_NV, GL_COLOR_ATTACHMENT9_NV, GL_COLOR_ATTACHMENT10_NV, GL_COLOR_ATTACHMENT11_NV,
GL_COLOR_ATTACHMENT12_NV, GL_COLOR_ATTACHMENT13_NV, GL_COLOR_ATTACHMENT14_NV, GL_COLOR_ATTACHMENT15_NV};
glDrawBuffersARB(m_nMaxColorTargets, db);
}
}
}
// Enable/disable multisample - "shouldn't" have an effect when render to texture, but safe is safe :D
GetRenderer().SetRenderState(PLRenderer::RenderState::MultisampleEnable, !(GetFlags() & NoMultisampleAntialiasing));
// Done
return true;
}
// Error!
return false;
}
示例15:
//[-------------------------------------------------------]
//[ Private virtual PLRenderer::TextureBuffer functions ]
//[-------------------------------------------------------]
bool TextureBuffer2DArray::MakeCurrent(uint32 nStage)
{
// Check if there are renderer information
if (GetRenderer().GetTextureBuffer(nStage) != this) {
if (!GetRenderer().SetTextureBuffer(nStage, this))
return true; // Done
}
// Done
return true;
}