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


C++ drawObject函数代码示例

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


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

示例1: recalcModelView

void Scene::draw() {
    GLfloat m[4][4];
    recalcModelView();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    if (showAxis) {
        drawRotationAxis();
    }
    
    if (modelsMode) {        
        glScalef(6, 6, 6);        
        for (unsigned i=0; i < models.size(); i++) {
            models[i]->render();
        }
    } else {
        if (game) {
            drawObject(vertexes, exluded);
            drawExcluded();
        } else {
            drawObject(vertexes, -1);
        }

        if (skeleton) {
            drawSkeleton();
        }
    }
      
    glutSwapBuffers();
}
开发者ID:aurelijusb,项目名称:CG-models,代码行数:28,代码来源:Scene.cpp

示例2: drawObject

void Scene::draw(sf::RenderTarget &target, sf::RenderStates states) const {
	if (player) {
		drawObject(*player, target, states);
	}
	
	for(const auto &object : m_objects) drawObject(object, target, states);
}
开发者ID:Quent42340,项目名称:libegdt,代码行数:7,代码来源:Scene.cpp

示例3: renderGame

void renderGame() {
    drawBackground(bgX, bgY, bgClip);

    drawObject(&player, player.clip);

    if(someObject != NULL) {
        drawObject(someObject, someObject->clip);
    }
    writeText(0, 0, "r37r0 v0.0");
    if(msgTime>0) writeText((SCREENW>>1)-(TILEW*SDL_strlen(message)>>1), SCREENH-TILEH, message);
}
开发者ID:suspirii,项目名称:C0NS0LEC0WB0Y,代码行数:11,代码来源:game.c

示例4: rotateRow

void rotateRow( int x, int y, int z, int v, int s)
{
    // rotate all objects matching x, y, z mask  with value v
    // s verse of rotation
    int j, i, ix, iy, iz;
    
    // animation loop 0-90 deg
    for(j = 0; j <= 90; j+= STEP)
    {
        // clear painting scren
        gClearScreen();                 // clear the hidden screen

        // search all objects for matching pattern
        for( iz=0; iz<3; iz++)
            for( iy=0; iy<3; iy++)
                for(ix=0; ix<3; ix++)
                {   
                    if ( ix*iy*iz == 1) continue; // ignore c[1][1][1]
                    i = c[ix][iy][iz];

                    // check if requires rotation
                    if (( (ix+1)*x == v+1) || ((iy+1)*y == v+1) || ((iz+1)*z == v+1))
                    {  // rotate the corresponding axis
                        // transform and draw the object                        
                        initMatrix( mo, x*s*j, y*s*j, z*s*j, 0, 0, 0);
                        drawObject( mo, i);

                        // if final rotation
                        if ( j == 90)
                            rotateObject( mo, i);
                    }
                    else 
                    {
                        // transform and draw the object                        
                        initMatrix( mo, 0, 0, 0, 0, 0, 0);
                        drawObject( mo, i);
                    }    
                    
                }
        
        
        // update visible screen
        copyV();            
    } // for j steps

    // update pointer matrix c[][][]
    rotateC( x, y, z, v, s);    
        
} // animate rotation of one row/face   
开发者ID:WilliamAvila,项目名称:PIC32MX460F512L_Examples,代码行数:49,代码来源:Cubes.c

示例5: display

void display (void) {
	glClearDepth (1);
    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();  
	gluLookAt(120.0, 20.0, 140.0,		
              0.0, 0.0, 0.0,		
              0.0, 5.0, 0.0);		
	float pos[]={10.0,90.0,-110.0,1.0};        //set the position
	glLightfv(GL_LIGHT0,GL_POSITION,pos);
	glEnable(GL_COLOR_MATERIAL);
	
	camera();
	glPushMatrix();
	
	glTranslatef(0, -30, 0);
	//glScalef(10,10,10);
	//glCallList(cube);
	glPopMatrix();
	drawGrid();
	//createHabitat();
	drawWalls();
	drawHabitat();
	drawFood();
	drawObject();
	drawPredator();

	//saveToDisk();
    glutSwapBuffers();
}
开发者ID:avasay,项目名称:Flocking,代码行数:29,代码来源:flock1.cpp

示例6: perspectiveMatrixX

void App::drawFrame()
{
  mat4 projection = perspectiveMatrixX(1.5f, width, height, 0.001f, 1.0f);
  mat4 mvRotate = rotateXY(-wx, -wy);
  mat4 modelview = mvRotate * translate(-camPos);

  glMatrixMode(GL_PROJECTION);
  glLoadTransposeMatrixf(projection);

  glMatrixMode(GL_MODELVIEW);
  glLoadTransposeMatrixf(modelview);

  // Determine the shader selections
  radialSelect = 0;
  if(doRadialEnvMap->isChecked())
  {
    radialSelect = 1;
  }
  constMipSelect = 0;
  if(constantMipLevel->isChecked())
  {
    constMipSelect = 1;
  }

  // Clear only depth
  renderer->clear(false, true, false);

  // Draw the background environment
  drawEnvironment(projection * mvRotate);

  // Draw the object
  drawObject();
}
开发者ID:dtrebilco,项目名称:RadialEnvMap,代码行数:33,代码来源:App.cpp

示例7: DrawFlashlight

void DrawFlashlight() {
	glActiveTexture(GL_TEXTURE0);
	glBindTexture(GL_TEXTURE_2D, tex2);
	glm::vec3 dir = m_center - m_eye;
	matM = glm::translate(glm::mat4(1.0f), m_eye+dir);

	glm::vec4 temp;
	temp = glm::rotate(glm::mat4(1.0f), angleLR, m_up) * glm::vec4 (m_eye+dir,0);// *glm::vec4(m_center - m_eye, 0);

	glm::vec4 temp2;

	glm::vec3 look = glm::normalize(m_center - m_eye);
	glm::vec3 vert_rot = glm::cross(m_up, look);

	temp2 = glm::rotate(glm::mat4(1.0f), rely*mouse_speed, vert_rot)*glm::vec4(m_center - m_eye, 0);

	m_center = m_eye + glm::vec3(temp2);

	angleUD += rely*mouse_speed;
	if (angleUD > 360)angleUD -= 360;
	if (angleUD < -360)angleUD += 360;

	//matM = glm::scale(matM, glm::vec3(1.0, 1.0, 1.0));
		drawObject();
}
开发者ID:kkapitan,项目名称:Maze,代码行数:25,代码来源:main_file.cpp

示例8: drawTile

void cScene::render() {
	// Draw model
	if (data->front == 1) {
		for (int i = 0; i < (int)map.size(); i++) {
			int k = (int)map.size() - 1 - i;
			for (int j = 0; j <= i; j++) {
				drawTile(j, k);
				if (objmap[j][k] != 0) drawObject(j, k);
				k++;
			}
		}

		for (int i = 1; i < (int)map.size(); i++) {
			int k = 0;
			for (int j = i; j < (int)map.size(); j++) {
				drawTile(j, k);
				if (objmap[j][k] != 0) drawObject(j, k);
				k++;
			}
		}
	} else {
		for (int i = 0; i < (int)map.size(); i++) {
			int j = (int)map.size() - 1;
			for (int k = i; k >= 0; k--) {
				drawTile(j, k);
				if (objmap[j][k] != 0) drawObject(j, k);
				j--;
			}
		}

		for (int i = 1; i < (int)map.size(); i++) {
			int k = (int)map.size() - 1;
			for (int j = (int)map.size() - 1 - i; j >= 0; j--) {
				drawTile(j, k);
				if (objmap[j][k] != 0) drawObject(j, k);
				k--;
			}
		}
	}

	if (DEBUG_MODE) {
		drawHighlightTile((int)playerx,-(int)playerz);
		drawHighlightTile((int)playerx +1,-(int)playerz);
		drawHighlightTile((int)playerx,-(int)playerz +1);
		drawHighlightTile((int)playerx +1,-(int)playerz +1);
	}
}
开发者ID:addja,项目名称:keep-running-n-nobody-gets-hurt,代码行数:47,代码来源:cScene.cpp

示例9: SDL_RenderClear

void Renderer::drawBackground(const std::string& name)
{
	SDL_RenderClear(sRenderer);
	loadTexture(name);

	const ObjRenderable background {name, 0, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH};
	drawObject(background);
}
开发者ID:Ffaithy,项目名称:Simple-Pattern-Matching-Game,代码行数:8,代码来源:Renderer.cpp

示例10: drawIronman

void drawIronman() {
	glColor3f(0.7, 0.7, 0.3);
	glPushMatrix();
	glTranslatef(0.0, 0.0, 0.0);
	glScalef(1.0, 1.0, 1.0);
	drawObject(&ironman);
	glPopMatrix();
}
开发者ID:kidsnow,项目名称:GLUT,代码行数:8,代码来源:display.cpp

示例11: display

//-------------------------------------------------------------------------
//  This function is passed to glutDisplayFunc in order to display 
//	OpenGL contents on the window.
//-------------------------------------------------------------------------
void display (void)
{
	glClear (GL_COLOR_BUFFER_BIT);

    drawObject();
    drawFPS();
	
	glutSwapBuffers ();
}
开发者ID:AM1244,项目名称:Blog,代码行数:13,代码来源:FPS.cpp

示例12: ZBuffer

void Rasterization::drawScene(SceneRenderer * sceneRenderer, Zone & renderingZone) {
	CameraScreen * cameraScreen = sceneRenderer->getCameraScreen();
	Screen * screen = cameraScreen->getScreen();
	this->zbuffer = new ZBuffer(screen->getWidth(), screen->getHeight());
	std::vector<Object3D *> objects = sceneRenderer->getScene()->getObjects3D();
	for(std::vector<Object3D *>::iterator it = objects.begin(); it != objects.end(); it++) {
		drawObject(sceneRenderer->getObject3DRenderer(*it), renderingZone);
	}
	delete zbuffer;
}
开发者ID:Tug,项目名称:RayTracer,代码行数:10,代码来源:Rasterization.cpp

示例13: painter

void ImageWidget::paintEvent(QPaintEvent *event) {
  QWidget::paintEvent(event);

  QPainter painter(this);
  painter.drawImage(QPoint(0, 0), image);

  foreach (const QRect &object, curObjects) {
    drawObject(painter,
               (zoomSet ? Util::scaleRect(object, zoomFactor) : object));
  }
开发者ID:netromdk,项目名称:possamp,代码行数:10,代码来源:ImageWidget.cpp

示例14: Render

void Render()
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glColor3d(7,7,7);
  
  drawObject(Object_1);
  
  glutSwapBuffers(); 
  glutPostRedisplay();
}
开发者ID:fear-sfx,项目名称:C-turtle,代码行数:10,代码来源:Rotation.c

示例15: glPushMatrix

void CCubeZoom::renderChild(int nDepth)
{
	if (nDepth > 3)
		return;

	if (	(m_vCubes[nDepth].m_fScale >= fCUBE_RING_START) && 
			(nDepth < nMAX_CUBE_DEPTH - 1) )
	{
		glPushMatrix();

			renderChild(nDepth + 1);

			glNewList(m_glDispStartIndex + nDepth, GL_COMPILE);

				// Render the center object
				drawObject(nDepth);

				// Render the orbiting objects
				for (int nChild = 0; nChild < nCUBE_CHILDREN; nChild++)
				{
					glPushMatrix();
						glRotatef(fROTATE_ANGLE * nChild, 0.0f, 1.0f, 0.0f);
						glTranslatef(0.0f, 0.0f, -4.5f);
						glCallList(m_glDispStartIndex + nDepth + 1);
					glPopMatrix();
				}
			glEndList();	

		glPopMatrix();

	} else {	
	
		glNewList(m_glDispStartIndex + nDepth, GL_COMPILE);
			drawObject(nDepth);	
		glEndList();

#ifdef _DEBUG
		m_nDepth = nDepth;
#endif // _DEBUG
	}

	glColor3f(1.0f, 1.0f, 1.0f);
}
开发者ID:tronster,项目名称:node,代码行数:43,代码来源:CCubeZoom.cpp


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