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

C++ setViewport函数代码示例

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

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



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

示例1: setViewport

void GLWidget::setMode(DISPLAY_MODE mode)
{
    m_displayMode = mode;

    setViewport();
    paintGL();
}
开发者ID:fieldOfView,项目名称:uv-mapper,代码行数:7,代码来源:glwidget.cpp


示例2: display_runners_view

void display_runners_view() {
	setViewport(0, 0, width, height);

	glPushMatrix();
	glLoadIdentity();

	Man* looker = runners[chosen_runner];

	double angle;
	if (looker -> turn_angle == 0) angle = 0;
	else if (looker -> turn_angle == 180.0) angle = -PI;
	else angle = -looker -> turn_angle * PI / 180.0;

	if (view_mode == RUNNERS_EYES) {
		gluLookAt(looker -> head_x, looker -> head_y, looker -> head_z, looker -> head_x + cos(angle), looker -> head_y, looker -> head_z + sin(angle), 0.0,  1.0,  0.0);
	} else {
		double behind_shift = 10.0;
		if (looker -> running_phase == FORWARD) {
			gluLookAt(looker -> head_x - behind_shift, looker -> head_y, looker -> head_z, looker -> head_x + cos(angle), looker -> head_y, looker -> head_z + sin(angle), 0.0,  1.0,  0.0);
		} else if (looker -> running_phase == FORWARD_TURN || looker -> running_phase == BACKWARD_TURN) {
			gluLookAt(looker -> head_x - behind_shift * cos(angle), looker -> head_y, looker -> head_z - behind_shift * sin(angle), looker -> head_x - cos(angle), looker -> head_y, looker -> head_z - sin(angle), 0.0,  1.0,  0.0);
		} else if (looker -> running_phase == BACKWARD) {
			gluLookAt(looker -> head_x + behind_shift, looker -> head_y, looker -> head_z, looker -> head_x + cos(angle), looker -> head_y, looker -> head_z + sin(angle), 0.0,  1.0,  0.0);
		}
	}
	draw_board_and_runners();
	glPopMatrix();
}
开发者ID:verq,项目名称:runners,代码行数:28,代码来源:board.c


示例3: copySurfaceToTexture

gl::Error Blit9::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
{
    IDirect3DTexture9 *texture = NULL;
    gl::Error error = copySurfaceToTexture(source, sourceRect, &texture);
    if (error.isError())
    {
        return error;
    }

    IDirect3DDevice9 *device = mRenderer->getDevice();

    saveState();

    device->SetTexture(0, texture);
    device->SetRenderTarget(0, dest);

    setViewport(sourceRect, xoffset, yoffset);

    setCommonBlitState();

    error = setFormatConvertShaders(destFormat);
    if (!error.isError())
    {
        render();
    }

    SafeRelease(texture);

    restoreState();

    return error;
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:32,代码来源:Blit9.cpp


示例4: glClear

void LfpDisplayCanvas::renderOpenGL()
{
	
	glClear(GL_COLOR_BUFFER_BIT); // clear buffers to preset values

	//drawTicks();

	updateScreenBuffer();

	for (int i = 0; i < nChans; i++)
	{
		bool isSelected = false;

		if (selectedChan == i)
			isSelected = true;

		if (checkBounds(i)) {
			setViewport(i);
			//drawBorder(isSelected);
			drawChannelInfo(i,isSelected);
			drawWaveform(i,isSelected);
		}	
	}
	drawScrollBars();

	//std::cout << "Render." << std::endl;
}
开发者ID:karlssonm,项目名称:GUI,代码行数:27,代码来源:LfpDisplayCanvas.cpp


示例5: mainInit

void mainInit()
{
    glClearColor(1.0,1.0,1.0,0.0);
	glColor3f(0.0f,0.0f,0.0f);
	setWindow();
	setViewport(0, windowWidth, 0, windowHeight);

	// habilita o z-buffer
	glEnable(GL_DEPTH_TEST);
    initTexture("Models\\Sea.bmp\0", &texture, &type);

    // inicializa todos os modelos 3D que serão multiplicados
    diglettModel = (GLMmodel*)malloc(sizeof(GLMmodel));
    scytherModel = (GLMmodel*)malloc(sizeof(GLMmodel));
    sharpedoModel = (GLMmodel*)malloc(sizeof(GLMmodel));
    snorlaxModel = (GLMmodel*)malloc(sizeof(GLMmodel));
    cube = (GLMmodel*)malloc(sizeof(GLMmodel));
    cube_hole = (GLMmodel*)malloc(sizeof(GLMmodel));
    cube_crack = (GLMmodel*)malloc(sizeof(GLMmodel));

    load_new_model("Models/Diglett.obj", &diglettModel);
    load_new_model("Models/Scyther.obj", &scytherModel);
    load_new_model("Models/Sharpedo.obj", &sharpedoModel);
    load_new_model("Models/Snorlax.obj", &snorlaxModel);
    load_new_model("Models/cube.obj", &cube);
    load_new_model("Models/cube_hole.obj", &cube_hole);
    load_new_model("Models/cube_crack.obj", &cube_crack);
}
开发者ID:lahagemann,项目名称:digdug,代码行数:28,代码来源:main.cpp


示例6: onWindowReshape

void onWindowReshape(int x, int y)
{
    windowWidth = x;
	windowHeight = y;
	setWindow();
	setViewport(0, windowWidth, 0, windowHeight);
}
开发者ID:lahagemann,项目名称:digdug,代码行数:7,代码来源:main.cpp


示例7: QGraphicsView

RCanvas::RCanvas(Context *context, QWidget *parent) : QGraphicsView(parent), context(context)
{
    // no frame, its ugly
    setFrameStyle(QFrame::NoFrame);

#ifdef Q_OS_LINUX // mac and windows both have issues. sigh.
    // Enabled on Linux depending on Open GL version
    if (QGLFormat::openGLVersionFlags().testFlag(QGLFormat::OpenGL_Version_2_0)) {
        setViewport(new QGLWidget( QGLFormat(QGL::SampleBuffers)));
        setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    }
#endif

    // allow to click and drag
    setDragMode(QGraphicsView::ScrollHandDrag);

    // add a scene
    scene = new QGraphicsScene(this);
    this->setScene(scene);

    // turn on antialiasing too
    setRenderHint(QPainter::Antialiasing, true);

    // set colors etc
    configChanged(CONFIG_APPEARANCE);

    // connect
    connect(context, SIGNAL(configChanged(qint32)), this, SLOT(configChanged(qint32)));
}
开发者ID:GoldenCheetah,项目名称:GoldenCheetah,代码行数:29,代码来源:RCanvas.cpp


示例8: copySurfaceToTexture

bool Blit9::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
{
    IDirect3DTexture9 *texture = copySurfaceToTexture(source, sourceRect);
    if (!texture)
    {
        return false;
    }

    IDirect3DDevice9 *device = mRenderer->getDevice();

    saveState();

    device->SetTexture(0, texture);
    device->SetRenderTarget(0, dest);

    setViewport(sourceRect, xoffset, yoffset);

    setCommonBlitState();
    if (setFormatConvertShaders(destFormat))
    {
        render();
    }

    SafeRelease(texture);

    restoreState();

    return true;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:29,代码来源:Blit9.cpp


示例9: QDeclarativeView

MainWidget::MainWidget(QWidget *parent)
    : QDeclarativeView(parent)
{
    // Switch to fullscreen in device
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
    setWindowState(Qt::WindowFullScreen);
#endif

    setResizeMode(QDeclarativeView::SizeRootObjectToView);

    // Register Tile to be available in QML
    qmlRegisterType<Tile>("gameCore", 1, 0, "Tile");

    // Setup context
    m_context = rootContext();
    m_context->setContextProperty("mainWidget", this);
    m_context->setContextProperty("gameData", &m_gameData);

    // Set view optimizations not already done for QDeclarativeView
    setAttribute(Qt::WA_OpaquePaintEvent);
    setAttribute(Qt::WA_NoSystemBackground);

    // Make QDeclarativeView use OpenGL backend
    QGLWidget *glWidget = new QGLWidget(this);
    setViewport(glWidget);
    setViewportUpdateMode(QGraphicsView::FullViewportUpdate);

    // Open root QML file
    setSource(QUrl(filename));
}
开发者ID:MilanLi,项目名称:Reversi-Game,代码行数:30,代码来源:mainwidget.cpp


示例10: l_RenderWindow_setViewport

static int l_RenderWindow_setViewport(lua_State *L) {
    auto renderWindow = lua_torenderwindow(L, 1);
    if (lua_istable(L, 2)) {
	//x offset
	lua_getfield(L, -1, "x");
	integerType xOffset = luaL_checkint(L, -1);
	lua_pop(L, 1);

	//y offset
	lua_getfield(L, -1, "y");
	integerType yOffset = luaL_checkint(L, -1);
	lua_pop(L, 1);

	//width value
	lua_getfield(L, -1, "w");
	integerType width = luaL_checkint(L, -1);
	lua_pop(L, 1);

	//height value
	lua_getfield(L, -1, "h");
	integerType height = luaL_checkint(L, -1);
	lua_pop(L, 1);

	renderWindow->setViewport(xOffset, yOffset,
				  width, height);
    }
    else {
	luaL_error(L, "setViewport function takes a table as its second argument.");
    }
    return 0;
}
开发者ID:benzap,项目名称:Kampf,代码行数:31,代码来源:l_RenderWindow.cpp


示例11: drawSub1

///////////////////////////////////////////////////////////////////////////////
// draw 2D/3D scene
///////////////////////////////////////////////////////////////////////////////
void ModelGL::draw()
{
    drawSub1();
    drawSub2();

    if(windowSizeChanged)
    {
        setViewport(0, 0, windowWidth, windowHeight);
        windowSizeChanged = false;
    }

    if(drawModeChanged)
    {
        if(drawMode == 0)           // fill mode
        {
            glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
            glEnable(GL_DEPTH_TEST);
            glEnable(GL_CULL_FACE);
        }
        else if(drawMode == 1)      // wireframe mode
        {
            glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
            //glDisable(GL_DEPTH_TEST);
            glDisable(GL_CULL_FACE);
        }
        else if(drawMode == 2)      // point mode
        {
            glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
            //glDisable(GL_DEPTH_TEST);
            glDisable(GL_CULL_FACE);
        }
        drawModeChanged = false;
    }
}
开发者ID:andreaswatch,项目名称:dizuo,代码行数:37,代码来源:ModelGL.cpp


示例12: QGLWidget

void MainWindow::setRenderingSystem()
{
    QWidget *viewport = 0;

#ifndef QT_NO_OPENGL
    if (Colors::openGlRendering) {
        QGLWidget *glw = new QGLWidget(QGLFormat(QGL::SampleBuffers));
        if (Colors::noScreenSync)
            glw->format().setSwapInterval(0);
        glw->setAutoFillBackground(false);
        viewport = glw;
        setCacheMode(QGraphicsView::CacheNone);
        if (Colors::verbose)
            qDebug() << "- using OpenGL";
    } else // software rendering
#endif
    {
        // software rendering
        viewport = new QWidget;
        setCacheMode(QGraphicsView::CacheBackground);
        if (Colors::verbose)
            qDebug() << "- using software rendering";
    }

    setViewport(viewport);
}
开发者ID:mortenelund,项目名称:qt,代码行数:26,代码来源:mainwindow.cpp


示例13: qDebug

void View::initGL()
{
	qDebug( "* OpenGL:" );
	setViewportUpdateMode( QGraphicsView::FullViewportUpdate );
	setFrameShape( QFrame::NoFrame );

	QGLFormat glFormat( QGL::DoubleBuffer | QGL::DepthBuffer | QGL::Rgba | QGL::DirectRendering );
	glFormat.setVersion( 2, 1 );
//	glFormat.setSwapInterval( 1 );

	QSettings settings;
	glFormat.setSampleBuffers( settings.value( "sampleBuffers", false ).toBool() );

	mGLWidget = new GLWidget( glFormat, this );
	setViewport( mGLWidget );

	const GLubyte * vendorGL = glGetString( GL_VENDOR );
	qDebug( "\t* %s:\t%s", qPrintable(tr("Vendor")), vendorGL );
	const GLubyte * rendererGL = glGetString( GL_RENDERER );
	qDebug( "\t* %s:\t%s", qPrintable(tr("Renderer")), rendererGL );
	const GLubyte * versionGL = glGetString( GL_VERSION );
	qDebug( "\t* %s:\t%s", qPrintable(tr("Version")), versionGL );
	const GLubyte * glslVersionGL = glGetString( GL_SHADING_LANGUAGE_VERSION );
	qDebug( "\t* %s:\t%s", qPrintable(tr("GLSL version")), glslVersionGL );
//	const GLubyte * extensionsGL = glGetString( GL_EXTENSIONS );
//	qDebug( "\t* %s:\t%s", qPrintable(tr("Supported extensions")), extensionsGL );
}
开发者ID:splatterlinge,项目名称:Splatterlinge,代码行数:27,代码来源:View.cpp


示例14: copySurfaceToTexture

bool Blit::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
{
    IDirect3DTexture9 *texture = copySurfaceToTexture(source, getSurfaceRect(source));
    if (!texture)
    {
        return false;
    }

    IDirect3DDevice9 *device = getDevice();

    saveState();

    device->SetTexture(0, texture);
    device->SetRenderTarget(0, dest);

    setVertexShader(SHADER_VS_STANDARD);
    setPixelShader(SHADER_PS_PASSTHROUGH);

    setCommonBlitState();
    device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
    device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);

    setViewport(getSurfaceRect(dest), 0, 0);

    render();

    texture->Release();

    restoreState();

    return true;
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:32,代码来源:Blit.cpp


示例15: screenInit

void screenInit()
{
    glColor3f(0.0f,0.0f,0.0f);
	setWindow();
	setViewport(0, windowWidth, 0, windowHeight);

    initTexture("Screens\\InitialScreen.bmp", &initialScreenTexture, &initialScreenType);
}
开发者ID:lahagemann,项目名称:digdug,代码行数:8,代码来源:main.cpp


示例16: setViewport

bool Game::startup()
{
    if (_state != UNINITIALIZED)
        return false;

    setViewport(Rectangle(0.0f, 0.0f, (float)_width, (float)_height));
    RenderState::initialize();
    FrameBuffer::initialize();

    _animationController = new AnimationController();
    _animationController->initialize();

    _audioController = new AudioController();
    _audioController->initialize();

    _physicsController = new PhysicsController();
    _physicsController->initialize();

    _aiController = new AIController();
    _aiController->initialize();

    _scriptController = new ScriptController();
    _scriptController->initialize();

    // Load any gamepads, ui or physical.
    loadGamepads();

    // Set the script callback functions.
    if (_properties)
    {
        Properties* scripts = _properties->getNamespace("scripts", true);
        if (scripts)
        {
            const char* callback;
            while ((callback = scripts->getNextProperty()) != NULL)
            {
                std::string url = scripts->getString();
                std::string file;
                std::string id;
                splitURL(url, &file, &id);

                if (file.size() <= 0 || id.size() <= 0)
                {
                    GP_ERROR("Invalid %s script callback function '%s'.", callback, url.c_str());
                }
                else
                {
                    _scriptController->loadScript(file.c_str());
                    _scriptController->registerCallback(callback, id.c_str());
                }
            }
        }
    }

    _state = RUNNING;

    return true;
}
开发者ID:5guo,项目名称:GamePlay,代码行数:58,代码来源:Game.cpp


示例17: paint

QcScrollArea::QcScrollArea() :
    paint(false),
    painting(false)
{
    setViewport( new QWidget() );
    scrollWidget = new QcScrollWidget( viewport() );
    scrollWidget->installEventFilter( this );
    updateScrollBars();
}
开发者ID:danstowell,项目名称:SuperCute,代码行数:9,代码来源:QcScrollArea.cpp


示例18: AllocTag

EvasCanvas::EvasCanvas( int width, int height )
    :Trackable( "EvasCanvas" )
{
    AllocTag( this, "EvasCanvas" );
    Dout( dc::notice, "EvasCanvas::EvasCanvas - creating new Evas" );
    o = evas_new();
    resize( width, height );
    setViewport( 0, 0, width, height );
}
开发者ID:playya,项目名称:Enlightenment,代码行数:9,代码来源:eflpp_evascanvas.cpp


示例19: getViewport

void WaterSample::render(float dt)
{
	//update the refract buffer
	auto defaultBuffer = m_refractBuffer->bind();
	auto defaultViewport = getViewport();
	setViewport(gp::Rectangle(bufferSize, bufferSize));

	m_clipPlane.y = -1.f;
	m_clipPlane.w = m_waterHeight + waterOffset;
	clear(CLEAR_COLOR_DEPTH, clearColour, 1.0f, 0);
	m_scene->visit(this, &WaterSample::m_drawScene, false);

	//switch plane direction and camera, and update reflection buffer
	m_reflectBuffer->bind();
	m_clipPlane.y = 1.f;
	m_clipPlane.w = -m_waterHeight + waterOffset;

	auto defaultCam = m_scene->getActiveCamera();
	m_scene->setActiveCamera(m_reflectCamNode->getFirstChild()->getCamera());
	//store the mvp matrix here as it is only valid when reflect camera is active
	m_worldViewProjectionReflection = m_scene->findNode("Water")->getWorldViewProjectionMatrix();
	clear(CLEAR_COLOR_DEPTH, clearColour, 1.0f, 0);
	m_scene->visit(this, &WaterSample::m_drawScene, false);

	//draw the final scene
	defaultBuffer->bind();
	setViewport(defaultViewport);
	m_clipPlane = gp::Vector4::zero();
	m_scene->setActiveCamera(defaultCam);
	clear(CLEAR_COLOR_DEPTH, clearColour, 1.0f, 0);
	m_scene->visit(this, &WaterSample::m_drawScene, true);

	//draw preview if enabled
	if (m_showBuffers)
	{
		m_refractBatch->start();
		m_refractBatch->draw(gp::Vector3(0.f, 4.f, 0.f), gp::Rectangle(bufferSize, bufferSize), gp::Vector2(426.f, 240.f));
		m_refractBatch->finish();

		m_reflectBatch->start();
		m_reflectBatch->draw(gp::Vector3(430.f, 4.f, 0.f), gp::Rectangle(bufferSize, bufferSize), gp::Vector2(426.f, 240.f));
		m_reflectBatch->finish();
	}
}
开发者ID:fallahn,项目名称:gp3d-water,代码行数:44,代码来源:WaterSample.cpp


示例20: display_top_view

void display_top_view() {
	setViewport(1 * width / 3, 1 * height / 4, width, height);

	glPushMatrix();
	glLoadIdentity();
	gluLookAt(-50, 250, -70, -50, 0, -70, 0, 0, 1);
	draw_board_and_runners();

	glPopMatrix();
}
开发者ID:verq,项目名称:runners,代码行数:10,代码来源:board.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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