当前位置: 首页>>代码示例>>C++>>正文


C++ setProjection函数代码示例

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


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

示例1: reshape

void reshape(int w, int h)
{
    height = h;
    width = w;
    if(height==0) height=1;       //Prevent a divide by zero if window's height is too small

    float ratio = 1.0*width/height;

    // set subwindow 1 as the active window
	glutSetWindow(subWindow1);
	// resize and reposition the sub window
	glutPositionWindow(border,border);
	glutReshapeWindow(w-2*border, h/2 - border*3/2);
	setProjection(w-2*border, h/2 - border*3/2);

	// set subwindow 2 as the active window
	glutSetWindow(subWindow2);
	// resize and reposition the sub window
	glutPositionWindow(border,(h+border)/2);
	glutReshapeWindow(w/2-border*3/2, h/2 - border*3/2);
	setProjection(w/2-border*3/2,h/2 - border*3/2);

	// set subwindow 3 as the active window
	glutSetWindow(subWindow3);
	// resize and reposition the sub window
	glutPositionWindow((w+border)/2,(h+border)/2);
	glutReshapeWindow(w/2-border*3/2,h/2 - border*3/2);
	setProjection(w/2-border*3/2,h/2 - border*3/2);
}
开发者ID:anubhavmagic,项目名称:Blocks-Game,代码行数:29,代码来源:backup4.cpp

示例2: changeSize

void changeSize(int w1,int h1) {

	if(h1 == 0)
		h1 = 1;

	// we're keeping these values cause we'll need them latter
	w = w1;
	h = h1;

	// set subwindow 1 as the active window
	glutSetWindow(subWindow1);
	// resize and reposition the sub window
	glutPositionWindow(border, border);
	glutReshapeWindow(w-2*border, h/2 - border*3/2);
	setProjection(w-2*border, h/2 - border*3/2);

	// set subwindow 2 as the active window
	glutSetWindow(subWindow2);
	// resize and reposition the sub window
	glutPositionWindow(border,(h+border)/2);
	glutReshapeWindow(w/2-border*3/2, h/2 - border*3/2);
	setProjection(w/2-border*3/2,h/2 - border*3/2);

	// set subwindow 3 as the active window
	glutSetWindow(subWindow3);
	// resize and reposition the sub window
	glutPositionWindow((w+border)/2, (h+border)/2);
	glutReshapeWindow(w/2-border*3/2, h/2 - border*3/2);
	setProjection(w/2-border*3/2, h/2 - border*3/2);
}
开发者ID:dbasilioesp,项目名称:computer-graphics-unisinos-class,代码行数:30,代码来源:k-subwindowscode.cpp

示例3: SLOT

void Osg3dView::buildPopupMenu()
{
    QAction *a;
    QMenu *sub = m_popupMenu.addMenu("MouseMode...");

    a = sub->addAction("Orbit", this, SLOT(setMouseMode()), QKeySequence(Qt::Key_O));
    a->setData(QVariant(MM_ORBIT));
    a = sub->addAction("Pan", this, SLOT(setMouseMode()), QKeySequence(Qt::Key_P));
    a->setData(QVariant(MM_PAN));
    a = sub->addAction("Rotate", this, SLOT(setMouseMode()), QKeySequence(Qt::Key_R));
    a->setData(QVariant(MM_ROTATE));
    a = sub->addAction("Zoom", this, SLOT(setMouseMode()), QKeySequence(Qt::Key_Z));
    a->setData(QVariant(MM_ZOOM));
    a = sub->addAction("Pick Center", this, SLOT(setMouseMode()), QKeySequence(Qt::Key_C));
    a->setData(QVariant(MM_PICK_CENTER));
    a = sub->addAction("Select Object", this, SLOT(setMouseMode()), QKeySequence(Qt::Key_S));
    a->setData(QVariant(MM_SELECT));

    sub = m_popupMenu.addMenu("Std View...");
    a = sub->addAction("Top", this, SLOT(setStandardView()), QKeySequence(Qt::SHIFT + Qt::Key_T));
    a->setData(V_TOP);
    a = sub->addAction("Underside", this, SLOT(setStandardView()), QKeySequence(Qt::SHIFT + Qt::Key_U));
    a->setData(V_BOTTOM);
    a = sub->addAction("Front", this, SLOT(setStandardView()), QKeySequence(Qt::SHIFT + Qt::Key_F));
    a->setData(V_FRONT);
    a = sub->addAction("Back", this, SLOT(setStandardView()), QKeySequence(Qt::SHIFT + Qt::Key_B));
    a->setData(V_BACK);
    a = sub->addAction("Right", this, SLOT(setStandardView()), QKeySequence(Qt::SHIFT + Qt::Key_R));
    a->setData(V_RIGHT);
    a = sub->addAction("Left", this, SLOT(setStandardView()), QKeySequence(Qt::SHIFT + Qt::Key_L));
    a->setData(V_LEFT);

    sub = m_popupMenu.addMenu("Projection...");
    a = sub->addAction("Orthographic", this, SLOT(setProjection()));
    a->setData(P_ORTHO);
    a = sub->addAction("Perspective", this, SLOT(setProjection()));
    a->setData(P_PERSP);

    sub = m_popupMenu.addMenu("DrawMode...");
    a = sub->addAction("Facets", this, SLOT(setDrawMode()), QKeySequence(Qt::Key_F));
    a->setData(osg::PolygonMode::FILL);
    a = sub->addAction("Wireframe", this, SLOT(setDrawMode()), QKeySequence(Qt::Key_W));
    a->setData(osg::PolygonMode::LINE);
    a = sub->addAction("Verticies", this, SLOT(setDrawMode()), QKeySequence(Qt::Key_V));
    a->setData(osg::PolygonMode::POINT);

    sub = m_popupMenu.addMenu("Toggle...");
    a = sub->addAction("MenuBar", this, SIGNAL(toggleMenuBar()), QKeySequence(Qt::CTRL+ Qt::Key_M));
    a = sub->addAction("ToolBar", this, SIGNAL(toggleToolBar()), QKeySequence(Qt::CTRL+ Qt::Key_T));
}
开发者ID:iraytrace,项目名称:osgTreeWidget,代码行数:50,代码来源:Osg3dView.cpp

示例4: getFov

void TCompCamera::renderInMenu() {
	float fov_in_rad = getFov();
	float znear = getZNear();
	float zfar = getZFar();
	float ar = getAspectRatio();

	bool changed = false;
	//float fov_in_deg = rad2deg(fov_in_rad);
	//if (ImGui::SliderFloat("Fov", &fov_in_deg, 30.f, 110.f)) {
	//	changed = true;
	//	fov_in_rad = deg2rad(fov_in_deg);
	//}
	if (!isOrtho()) {
		float fov_in_deg = rad2deg(fov_in_rad);
		if (ImGui::DragFloat("Fov", &fov_in_deg, 0.1f, 1.f, 120.f)) {
			changed = true;
			fov_in_rad = deg2rad(clamp(fov_in_deg, 1.f, 120.f));
		}
	}
	changed |= ImGui::DragFloat("ZNear", &znear, 0.01f, 0.01f);
	changed |= ImGui::DragFloat("ZFar", &zfar, 0.01f, 1.f, 1000.f);
	if (changed)
		setProjection(fov_in_rad, znear, zfar);

	if (ImGui::SliderFloat("a/r", &ar, 0.f, 10.f)) {
		//setAspectRatio(ar);
	}
}
开发者ID:DopaminaInTheVein,项目名称:ItLightens,代码行数:28,代码来源:comp_camera.cpp

示例5: setProjection

void
Lpanel::doPickProjection(void)
{
//  glOrtho(bbox.xyz_min[0], bbox.xyz_max[0], bbox.xyz_min[1], bbox.xyz_max[1], .1, 1000.);
  setProjection(1);

}
开发者ID:cassini232,项目名称:Emulator,代码行数:7,代码来源:lp_window.cpp

示例6: MarbleWidget

GlobeGPS::GlobeGPS(QWidget *parent) : MarbleWidget(parent),
    loadedDives(0),
    messageWidget(new KMessageWidget(this)),
    fixZoomTimer(new QTimer(this)),
    currentZoomLevel(0),
    needResetZoom(false),
    editingDiveLocation(false)
{
    // check if Google Sat Maps are installed
    // if not, check if they are in a known location
    MapThemeManager mtm;
    QStringList list = mtm.mapThemeIds();
    QString subsurfaceDataPath;
    QDir marble;
    if (!list.contains("earth/googlesat/googlesat.dgml")) {
        subsurfaceDataPath = getSubsurfaceDataPath("marbledata");
        if (subsurfaceDataPath.size()) {
            MarbleDirs::setMarbleDataPath(subsurfaceDataPath);
        } else {
            subsurfaceDataPath = getSubsurfaceDataPath("data");
            if (subsurfaceDataPath.size())
                MarbleDirs::setMarbleDataPath(subsurfaceDataPath);
        }
    }
    messageWidget->setCloseButtonVisible(false);
    messageWidget->setHidden(true);

    setMapThemeId("earth/googlesat/googlesat.dgml");
    //setMapThemeId("earth/openstreetmap/openstreetmap.dgml");
    setProjection(Marble::Spherical);

    setAnimationsEnabled(true);
    Q_FOREACH (AbstractFloatItem *i, floatItems()) {
        i->setVisible(false);
    }
开发者ID:Jheengut,项目名称:subsurface,代码行数:35,代码来源:globe.cpp

示例7: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLView::create("My Game");
        director->setOpenGLView(glview);
    }

    director->setProjection(cocos2d::Director::Projection::_2D);
    director->setDepthTest(false);
    // turn on display FPS
    director->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    director->setAnimationInterval(1.0 / 60);

    // create a scene. it's an autorelease object
    auto scene = HelloWorld::createScene();

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:kaznog,项目名称:t08,代码行数:25,代码来源:AppDelegate.cpp

示例8: init

void
init(void)
{
    GLfloat matDiff[4] = { 0.65F, 0.05F, 0.20F, 0.60F };
    GLfloat matSpec[4] = { 0.50F, 0.50F, 0.50F, 1.00F };
    GLfloat matShine = 20.00F;
    GLint indexes[3];
    GLfloat light0Pos[4] = { 0.70F, 0.70F, 1.25F, 0.00F };

    glClearColor(colors[2].diff[0], colors[2].diff[1], colors[2].diff[2], 1.0F);
    glClearIndex((GLfloat) colors[2].indexes[1]);

    setProjection();
    glTranslatef(0.0F, 0.0F, -2.0F);

    glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff);
    glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, matSpec);
    glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, matShine);

    indexes[0] = 0;
    indexes[1] = colors[0].indexes[1] - colors[0].indexes[0];
    indexes[2] = colors[0].indexes[2] - colors[0].indexes[0];
    glMaterialiv(GL_FRONT_AND_BACK, GL_COLOR_INDEXES, indexes);
    glLightfv(GL_LIGHT0, GL_POSITION, light0Pos);
    glEnable(GL_LIGHT0);

    glEnable(GL_LIGHTING);
    glEnable(GL_DEPTH_TEST);

    setCheckTexture();
    glEnable(GL_TEXTURE_2D);

    glEnable(GL_CULL_FACE);
}
开发者ID:OS2World,项目名称:LIB-VIDEO-MGL,代码行数:34,代码来源:indextex.c

示例9: glViewport

 void VisorOpenGL::resizeGL(int width, int height)
 {
     //int side = qMin(width, height);
     //glViewport((width - side) / 2, (height - side) / 2, width,width);//side, side);
     glViewport(0,0,width,height);
     setProjection();
}
开发者ID:czyrux,项目名称:DroidHunter,代码行数:7,代码来源:visoropengl.cpp

示例10: lookAt

CFirstPersonCamera::CFirstPersonCamera(const glm::vec3& position, const glm::vec3& target,
                                       const glm::vec3& up, float fieldOfView, float aspectRatio,
                                       float zNear, float zFar)
{
    lookAt(position, target, up);
    setProjection(fieldOfView, aspectRatio, zNear, zFar);
}
开发者ID:redagito,项目名称:RTR2014,代码行数:7,代码来源:CFirstPersonCamera.cpp

示例11: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
		glview = GLViewImpl::create("My Game");	//for cocos2d-x ver3.3
//        glview = GLView::create("My Game");	//for cocos2d-x ver3.2
        director->setOpenGLView(glview);
    }
	int h = 1024;
	int w = 1024;
	glview->setFrameSize(h, w);
	glview->setDesignResolutionSize(h, w, ResolutionPolicy::NO_BORDER);
	//���s���e
	director->setProjection(kCCDirectorProjection2D);

    // turn on display FPS
    director->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    director->setAnimationInterval(1.0 / 60);

    // create a scene. it's an autorelease object
    auto scene = HelloWorld::createScene();

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:Fumihiro-Kato,项目名称:SS5PlayerForCocos2d-x,代码行数:30,代码来源:AppDelegate.cpp

示例12: glClear

void VisorOpenGL::paintGL() {
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     glLoadIdentity();
     setProjection();
     setCamara();
     dibujarEscena();
 }
开发者ID:czyrux,项目名称:DroidHunter,代码行数:7,代码来源:visoropengl.cpp

示例13: drawSceneToSpecificFramebuffer

/**
 * Renders a scene not to the screen but into a texture
 */
void drawSceneToSpecificFramebuffer(GLuint fbo, int renderToTexture) {
    /**
     * Drawing into the given framebuffer-object
     */
    glBindFramebuffer(GL_FRAMEBUFFER, fbo);
    if (renderToTexture) {
        glClearColor(0.0, 0.8, 0.8, 0.0);
    } else {
        glClearColor(0.0, 1.0, 1.0, 0.0);
    }
    glClearDepth(1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glDisable(GL_CULL_FACE);
    glViewport (0, 0, G_Width, G_Height);
    setProjection ((double)G_Width/G_Height);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    gluLookAt (getCameraPosition(0), getCameraPosition(1), getCameraPosition(2),
         0.0, 0.0, 0.0,
         0.0, 1.0, 0.0);

    glDisable(GL_TEXTURE_2D);
    if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
        printf ("Framebuffer is not correct!\n");
    }

    drawDemo(renderToTexture);

    glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
开发者ID:danilogr,项目名称:Simple_GLSL_Shader_Example,代码行数:34,代码来源:io.c

示例14: setFrame

void
Camera::set(CoordinateFrame3 const & frame_, ProjectionType projection_type_, Real left_, Real right_, Real bottom_,
            Real top_, Real near_dist_, Real far_dist_, ProjectedYDirection proj_y_dir_)
{
  setFrame(frame_);
  setProjection(projection_type_, left_, right_, bottom_, top_, near_dist_, far_dist_, proj_y_dir_);
}
开发者ID:sidch,项目名称:DGP,代码行数:7,代码来源:Camera.cpp

示例15: mScene

	CameraOld::CameraOld(Scene* scene) :
		mScene(scene)
	{
		setProjection();
		setPosition(glm::vec3(10,10,10));
		lookAt(glm::vec3(0,0,0));
	}
开发者ID:JackMcCallum,项目名称:N-GINE-Old,代码行数:7,代码来源:NGineCamera.cpp


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