Esempio n. 1
0
bool SVGPlotter::Save(const char *fname) {
  sx = width/(xMax-xMin);
  sy = height/(yMax-yMin);
  bool retval = false;
  const char *ext = GetFileExtension(fname);
  FILE *fout = fopen(fname, "w");
  if(!fout) { fprintf(stderr, "Failed to open '%s' for writing plot\n", fname); return false; }

  if(!strcmp(ext, "svg") || !strcmp(ext, "SVG")) {
    retval = SaveHeader(fout) &&
      SaveStyles(fout) &&
      DrawPlots(fout) &&
      DrawAxis(fout) &&
      DrawLegend(fout) &&
      SaveFooter(fout);
  } else if(!strcmp(ext, "m") || !strcmp(ext, "M")) {
    retval = SaveHeaderMatlab(fout) &&
      DrawPlotsMatlab(fout) &&
      DrawLegendMatlab(fout);
  } else {
    fprintf(stderr, "Error: plotter only supports file format .m or .svg\n"); 
    retval = false;
  }
  fclose(fout);

  return retval;
}
Esempio n. 2
0
void Display(void)
{
  if (lighting) {
	  glEnable(GL_LIGHTING);
	  glEnable(GL_LIGHT0);
   } else {
	  glDisable(GL_LIGHTING);
	  glDisable(GL_LIGHT0);
   }


	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glPushMatrix();

	glLoadIdentity();
	glTranslatef(0, 0, centerZ);	/* to center object down Z */
	glMultMatrixd(_matrix);

	if (show_axis)
	    DrawAxis(1.0f);
	if (wireframe)		/* if Wireframe is checked */
	    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);	/* draw wireframe */
	else			/* else */
	    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);	/* draw filled polygons */

	DrawModel();
	glTranslatef(0, 0, -centerZ);	/* to center object down Z */
	glPopMatrix();

 //   if (show_help)
//	HelpDisplay(ww, wh);


    glutSwapBuffers();
}
Esempio n. 3
0
void CChart::PrintChart(CDC *pDC,int x , int y)
{
	
	int xPixel ;
	int yPixel  ;
	int oldmapmode ;

	CDC *dc = GetDC();
	
	xPixel = pDC->GetDeviceCaps(LOGPIXELSX);
	yPixel = pDC->GetDeviceCaps(LOGPIXELSY);
	
	//Calculate ratio to be zoomed.
	xPixel =  xPixel /dc->GetDeviceCaps(LOGPIXELSX);
	yPixel =  yPixel /dc->GetDeviceCaps(LOGPIXELSY);
	ReleaseDC(dc);
	
	oldmapmode = pDC->SetMapMode(MM_ANISOTROPIC);
	pDC->SetViewportExt(xPixel,yPixel);
	pDC->SetViewportOrg(x,y);

	DrawBorder(pDC);
	pDC->DrawEdge(m_ctlRect,BDR_SUNKENINNER|BDR_SUNKENOUTER, BF_RECT);
	DrawChartTitle(pDC);
	if ( bLogScale )
	   DrawLogGrid(pDC);
	DrawGrid(pDC);
	
	DrawAxis(pDC) ;
	DrawGridLabel(pDC);
	Plot(pDC) ;

	pDC->SetMapMode(oldmapmode);
}
Esempio n. 4
0
void YsClassSample::Display(void)
{
	BIPOSATT biEyePos;
	BIPOINT cursor;

	eyePos.Set(0.0,0.0,-eyeDistance);
	eyePos=eyeAtt.GetMatrix()*eyePos;
	eyePos=eyeLookAt+eyePos;

	BiSetPoint(&biEyePos.p,eyePos.x(),eyePos.y(),eyePos.z());
	BiSetAngleDeg(&biEyePos.a,
	              YsRadToDeg(eyeAtt.h()),
	              YsRadToDeg(eyeAtt.p()),
	              YsRadToDeg(eyeAtt.b()));

	BiClearScreen();
	BiStartBuffer(&biEyePos);

	BiSetPoint(&cursor,
	           pointOfInterest.x(),
	           pointOfInterest.y(),
	           pointOfInterest.z());
	BiInsMarker(&cursor,&BiWhite,BIMK_CROSS);
	DrawSlashedPolygon();
	DrawPolygon(4,q,blu,YSFALSE);
	DrawPolygon(4,r,blu,YSFALSE);
	DrawAxis(5.0);

	BiFlushBuffer();
	BiSwapBuffers();
}
void init(void) 
{
	dl_handle = glGenLists(3);

	glClearColor (0.02, 0.02, 0.04, 0.0);
    glShadeModel (GL_SMOOTH);
    glEnable(GL_DEPTH_TEST);

	float pos[3]={150.0f, 150.0f, 50.0f};

    glLightfv(GL_LIGHT0, GL_DIFFUSE, light_color);
    glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);    
	glLightfv(GL_LIGHT0, GL_POSITION,pos);  
    glEnable(GL_LIGHT0);

	float pos2[3]={-150.0f, 150.0f, 50.0f};

    glLightfv(GL_LIGHT1, GL_DIFFUSE,light_color2);
    glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient);   
	glLightfv(GL_LIGHT1, GL_POSITION, pos2);  
    glEnable(GL_LIGHT1);

    glEnable(GL_LIGHTING);


	// Generación de las Display Lists
	glNewList(DL_AXIS, GL_COMPILE);
		DrawAxis();
	glEndList();
	glNewList(DL_GRID, GL_COMPILE);
		DrawXYGrid();
	glEndList();

}
Esempio n. 6
0
void Threads::picbox_Paint(Upp::Draw & g )
{
	int i,r,c,w,h;

	if (picbox.GetSize().cx == 0 || picbox.GetSize().cy == 0)
		return;
	
	DrawingDraw d(cols,rows);
	d.DrawRect(0,0,rows,cols, White);
	
	INTERLOCKED_(job_lock) {
		for (i=0; i< active.GetCount(); i++)
		{
			r = active.GetKey(i) / cols;
			c = active.GetKey(i) % cols;
			d.DrawRect(c,r,1,1,Color(255,255,0));
		}
	}
	g.Offset(moveShift);
	g.DrawDrawing(0,0,densityC * cols, densityR * rows,d);
	
	INTERLOCKED_(image_lock) {
		for (i=0; i < rendered.GetCount(); i++)
		{
			r = rendered.GetKey(i) / cols;
			c = rendered.GetKey(i) % cols;
			w = picbox.GetSize().cx / cols;
			h = picbox.GetSize().cy / rows;
			g.DrawImage(c * w, r *h, w, h, rendered[i]);
		}
	}
	DrawAxis(g);
	g.End();
}
Esempio n. 7
0
void CArEntity::DrawDamageZones( vector< CArDamageZone * > &DamageZones, const CArAnimator &Animator )
{
	// Don't bother with debug drawing if this is a dismembered limb.
	if ( Animator.m_pDismemberedDz )
	{
		return;
	}

	vector< CArDamageZone * >::iterator iterDz;
	iterDz = DamageZones.begin();
	for ( ; iterDz != DamageZones.end(); ++iterDz )
	{
		const CArDamageZone &Dz = **iterDz;

		if ( Dz.m_iAttachmentJoint == -1 )
		{
			continue;
		}

		D3DXMATRIXA16 &JointMat = Animator.m_pJointTransformsSkel[ Dz.m_iAttachmentJoint ];
		DrawAabbWireframe( Dz.m_Box, &JointMat, g_Colors[ Dz.m_iAttachmentJoint % MAX_COLORS ] );

		DrawAxis( 5.0f, JointMat, true );
	}
}
Esempio n. 8
0
void Display(void)
{
	double matBuf[4*4];
	YsVec3 eyePos;
	YsMatrix4x4 eyeTfm;

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	eyePos.Set(0.0,0.0,eyeDistance);
	eyePos=eyeAtt.GetMatrix()*eyePos;

	eyeTfm.Initialize();
	eyeTfm.Translate(eyePos);
	eyeTfm.Rotate(eyeAtt);
	eyeTfm.Invert();
	eyeTfm.Translate(-eyeLookAt);

	eyeTfm.GetArray(matBuf);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glMultMatrixd(matBuf);
	DrawShell(sh1,blu,drawInPolygon);
	DrawShell(sh2,grn,drawInPolygon);
	DrawAxis(5.0);
	glFlush();
	glutSwapBuffers();
}
Esempio n. 9
0
/**
 *
 *
 *  @author jh
 */
void iwStatistics::Msg_PaintAfter()
{
    // Die farbigen Boxen unter den Spielerportraits malen
    unsigned short startX = 126 - numPlayingPlayers * 17;
    unsigned pos = 0;
    for (unsigned i = 0; i < GAMECLIENT.GetPlayerCount(); ++i)
    {
        GameClientPlayer& player = GAMECLIENT.GetPlayer(i);
        if (!(player.ps == PS_KI || player.ps == PS_OCCUPIED))
        {
            continue;
        }
        if (activePlayers[i])
        {
            DrawRectangle(this->x_ + startX + pos * 34, this->y_ + 68, 34, 12, COLORS[player.color]);
        }
        pos++;
    }

    // Koordinatenachsen malen
    DrawAxis();

    // Statistiklinien malen
    DrawStatistic(currentView);
}
double HandDetector::GetOrientation(const vector<Point> &pts, Mat &img)
{
    if (pts.size() == 0) return false;

    //Construct a buffer used by the pca analysis
    Mat data_pts = Mat(pts.size(), 2, CV_64FC1);
    for (int i = 0; i < data_pts.rows; ++i)
    {
        data_pts.at<double>(i, 0) = pts[i].x;
        data_pts.at<double>(i, 1) = pts[i].y;
    }


    //Perform PCA analysis
    PCA pca_analysis(data_pts, Mat(), CV_PCA_DATA_AS_ROW);

    //Store the position of the object
    Point pos = Point(pca_analysis.mean.at<double>(0, 0),
                      pca_analysis.mean.at<double>(0, 1));

    //Store the eigenvalues and eigenvectors
    vector<Point2d> eigen_vecs(2);
    vector<double> eigen_val(2);
    for (int i = 0; i < 2; ++i)
    {
        eigen_vecs[i] = Point2d(pca_analysis.eigenvectors.at<double>(i, 0),
                                pca_analysis.eigenvectors.at<double>(i, 1));

        eigen_val[i] = pca_analysis.eigenvalues.at<double>(i);
    }

    // Draw the principal components
    circle(img, pos, 3, CV_RGB(255, 0, 255), 2);
    //line(img, pos, pos + 0.02 * Point(eigen_vecs[0].x * eigen_val[0], eigen_vecs[0].y * eigen_val[0]) , CV_RGB(255, 255, 0));
    //line(img, pos, pos + 0.02 * Point(eigen_vecs[1].x * eigen_val[1], eigen_vecs[1].y * eigen_val[1]) , CV_RGB(0, 255, 255));

	Point p1 = pos + 0.02 * Point(eigen_vecs[0].x * eigen_val[0], eigen_vecs[0].y * eigen_val[0]);
    Point p2 = pos + 0.02 * Point(eigen_vecs[1].x * eigen_val[1], eigen_vecs[1].y * eigen_val[1]);
    

	DrawAxis(img, pos, p1, Scalar(0, 255, 0), 1);
    DrawAxis(img, pos, p2, Scalar(255, 255, 0), 5);


    return atan2(eigen_vecs[0].y, eigen_vecs[0].x)*(180/CV_PI);

}
Esempio n. 11
0
void TimeLogChart::OnPaint(wxPaintEvent &evt)
{
    wxPaintDC dc(this);
    DrawAxis(dc);
    DrawTitle(dc);
    DrawCharts(dc);
    DrawLegends(dc);
}
/*
* Draws the axis and bars to the screen.
*/
void BarChart::Draw()
{
	DrawAxis(WIDTH, HEIGHT);

	for (auto i : bars)
	{
		i.Draw();
	}
}
Esempio n. 13
0
void CGLView::DrawGL()
{
	DrawAxis();
	DrawViewAxis();
	DrawCamCenterAxis();

	//glColor3f(1.f,0.5f,0.5f);
	//glutSolidCube(50.f);
	//glutSolidSphere(50.,20,20);
}
Esempio n. 14
0
// init and display part split of so they can be moved to front end
void
PaintEvalGraph (void)
{
    VariantClass v = gameInfo.variant;
    range = (gameInfo.holdingsWidth && v != VariantSuper && v != VariantGreat && v != VariantSChess) ? 2 : 1; // [HGM] double range in drop games
    /* Draw */
    DrawRectangle(0, 0, nWidthPB, nHeightPB, 2, FILLED);
    DrawAxis();
    DrawHistograms();
}
Esempio n. 15
0
void CRenWin3D::paintGL()
{
    if(m_model)
    {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glMultMatrixf(&m_viewMatrix[0][0]);

        glBegin(GL_TRIANGLES);

        glLightfv(GL_LIGHT1, GL_POSITION, &m_cameraPosition[0]);

        const std::vector<glm::vec3> &vert = m_model->GetVertices();
        const std::vector<glm::vec2> &uvs = m_model->GetUVCoords();
        const std::vector<glm::vec3> &norms = m_model->GetNormals();

        int i = 0;
        for(const glm::uvec4 &t : m_model->GetTriangles())
        {
            BindTexture(t[3]);

            const glm::vec3 &vertex1 = vert[t[0]];
            const glm::vec3 &vertex2 = vert[t[1]];
            const glm::vec3 &vertex3 = vert[t[2]];

            const glm::vec2 &uv1 = uvs[t[0]];
            const glm::vec2 &uv2 = uvs[t[1]];
            const glm::vec2 &uv3 = uvs[t[2]];

            const glm::vec3 &faceNormal = norms[i++];

            glNormal3f(faceNormal[0], faceNormal[1], faceNormal[2]);

            glTexCoord2f(uv1[0], uv1[1]);
            glVertex3f(vertex1[0], vertex1[1], vertex1[2]);

            glTexCoord2f(uv2[0], uv2[1]);
            glVertex3f(vertex2[0], vertex2[1], vertex2[2]);

            glTexCoord2f(uv3[0], uv3[1]);
            glVertex3f(vertex3[0], vertex3[1], vertex3[2]);
        }

        glEnd();

        UnbindTexture();
    }
    if(m_grid)
    {
        DrawGrid();
    }
    DrawAxis();
}
Esempio n. 16
0
static void Draw()
{
	BeginFrame();

	DrawAxis();

	void ProcessCommands();
	ProcessCommands();

	EndFrame();
}
Esempio n. 17
0
void Sound::DrawOverlay(X3DDrawContext* pDC)
{
	// TODO: not here
	if (m_selected)
	{
		pDC->m_renderContext->PushModelView(pDC->m_renderContext->modelViewMatrix() * MatrixTranslation(getLocation()));

		DrawAxis(pDC);

		pDC->m_renderContext->PopMatrix();
	//	pDC->m_renderContext->GetRT()->m_d3d10->m_device->OMSetDepthStencilState(depthStencilState, stencilRef);
	}
}
void CvMultiFunctionPlotWithTrackbar::Draw()
{
    if (!PlotCanvas.HasBeenSetUp()) return;

    unsigned int FunctionsToPlot = (unsigned int)DataToPlot.size();
    if (FunctionsToPlot == 0) return;       // No functions to plot

    for (unsigned int i = 0;i<FunctionsToPlot;++i)
    {
        const CvMultiFunctionPlotWithTrackbar::FunctionPlotProperties& PlotData = DataToPlot.at(i);
        PlotCanvas.PlotFunction(PlotData.PlotData,PlotData.PlotColour,PlotData.ROIPlot,1.0);
        DrawAxis(PlotData);
    }
}
Esempio n. 19
0
void CScope::OnPaint() //静态面板以及该面板上所有控件的绘制
{
	CPaintDC dc(this); 
	DrawCurvePanel(&dc);//显示曲线面板
	DrawGrid(&dc);//出现绘制网格

	DrawCurveA(&dc);//绘制正弦波
	DrawCurveB(&dc);//绘制方波
	DrawCurveC(&dc);//绘制正弦波
	DrawCurveD(&dc);//绘制方波
	DrawCurveE(&dc);//绘制正弦波
	DrawCurveF(&dc);//绘制方波
	DrawAxis(&dc);//绘制刻度
}
Esempio n. 20
0
void UReporterGraph::DrawAxes(UCanvas* Canvas)
{
    FVector2D Min = GraphScreenSize.Min;

    FVector2D XMax = GraphScreenSize.Min;
    XMax.X = GraphScreenSize.Max.X;

    FVector2D YMax = GraphScreenSize.Min;
    YMax.Y = GraphScreenSize.Max.Y;

    UFont* Font = GetDefaultFont();
    int32 StringSizeX, StringSizeY;
    // Draw the X axis
    StringSize(Font, StringSizeX, StringSizeY, *FString::Printf(TEXT("%.2f"), GraphMinMaxData.Max.X) );
    const float SizeX = (XMax.X - Min.X) * Canvas->SizeX;
    NumXNotches = FMath::CeilToInt(SizeX * 0.7 / StringSizeX);
    DrawAxis(Canvas, Min, XMax, NumXNotches, false);

    // Draw the Y axis
    StringSize(Font, StringSizeX, StringSizeY, *FString::Printf(TEXT("%.2f"), GraphMinMaxData.Max.Y));
    float SizeY = (YMax.Y - Min.Y) * Canvas->SizeY;
    NumYNotches = FMath::CeilToInt(SizeY * 0.7 / StringSizeY);
    DrawAxis(Canvas, Min, YMax, NumYNotches, true);
}
Esempio n. 21
0
void CGraphPanel::DrawToDC(CDC* dc_to_draw, CRect& rect_to_draw)
{
    //fill background
    CBrush bkbrush(bkColor);
    CBrush* oldbrush = (CBrush*)dc_to_draw->SelectObject(&bkbrush);

    CRect bkrect(rect_to_draw);
    bkrect.bottom+=1; bkrect.right+=1; bkrect.left-=1; bkrect.top -= 1;
    dc_to_draw->Rectangle(bkrect);
    dc_to_draw->SelectObject(oldbrush);

    //draw points
    DrawPoints(dc_to_draw, rect_to_draw);

    //axis
    if ((m_grflags & GRAPH_DRAW_AXIS) == GRAPH_DRAW_AXIS) DrawAxis(dc_to_draw, rect_to_draw);
}
Esempio n. 22
0
void CGizmoTransformMove::Draw()
{
    ComputeScreenFactor();

    Initialize();
    if (m_pMatrix)
    {

        //glDisable(GL_DEPTH_TEST);
        tvector3 orig = GetTranslation();

        tvector3 axeX(1,0,0),axeY(0,1,0),axeZ(0,0,1);


        if (mLocation == LOCATE_LOCAL)
        {
            axeX.TransformVector(*m_pMatrix);
            axeY.TransformVector(*m_pMatrix);
            axeZ.TransformVector(*m_pMatrix);
            axeX.Normalize();
            axeY.Normalize();
            axeZ.Normalize();
        }




        DrawQuad(orig, 0.5f*GetScreenFactor(), (m_MoveTypePredict == MOVE_XZ), axeX, axeZ);
        DrawQuad(orig, 0.5f*GetScreenFactor(), (m_MoveTypePredict == MOVE_XY), axeX, axeY);
        DrawQuad(orig, 0.5f*GetScreenFactor(), (m_MoveTypePredict == MOVE_YZ), axeY, axeZ);

        axeX*=GetScreenFactor();
        axeY*=GetScreenFactor();
        axeZ*=GetScreenFactor();

        static const tvector3 selectedColor(0xff / 255.0, 0xdc / 255.0, 0),
                unitXColor(1, 0x41 / 255.0, 0x36 / 255.0),
                unitYColor(0x2e / 255.0, 0xcc / 255.0, 0x40 / 255.0),
                unitZColor(0, 0x74 / 255.0, 0xd9 / 255.0);

        // plan1
        if (m_MoveTypePredict != MOVE_X) DrawAxis(orig,axeX,axeY,axeZ,0.05f,0.83f,unitXColor);
            else DrawAxis(orig,axeX,axeY,axeZ, 0.05f,0.83f,selectedColor);

        //plan2
        if (m_MoveTypePredict != MOVE_Y) DrawAxis(orig,axeY,axeX,axeZ, 0.05f,0.83f,unitYColor);
            else DrawAxis(orig,axeY,axeX,axeZ, 0.05f,0.83f,selectedColor);

        //plan3
        if (m_MoveTypePredict != MOVE_Z) DrawAxis(orig,axeZ,axeX,axeY, 0.05f,0.83f,unitZColor);
            else DrawAxis(orig,axeZ,axeX,axeY, 0.05f,0.83f,selectedColor);
    }
}
void CGizmoTransformScale::Draw()
{
  if (m_pMatrix)
  {
    ComputeScreenFactor();


    tvector3 orig(m_pMatrix->m16[12],m_pMatrix->m16[13],m_pMatrix->m16[14]);


    // axis
    tvector3 axeX(1,0,0),axeY(0,1,0),axeZ(0,0,1);
    if (mLocation == LOCATE_LOCAL)
    {
      axeX.TransformVector(*m_pMatrix);
      axeY.TransformVector(*m_pMatrix);
      axeZ.TransformVector(*m_pMatrix);
      axeX.Normalize();
      axeY.Normalize();
      axeZ.Normalize();
    }

    DrawTri(orig, 0.5f*GetScreenFactor(),((m_ScaleTypePredict==SCALE_XZ)||(m_ScaleTypePredict==SCALE_XYZ)), axeX, axeZ);
    DrawTri(orig, 0.5f*GetScreenFactor(),((m_ScaleTypePredict==SCALE_XY)||(m_ScaleTypePredict==SCALE_XYZ)), axeX, axeY);
    DrawTri(orig, 0.5f*GetScreenFactor(),((m_ScaleTypePredict==SCALE_YZ)||(m_ScaleTypePredict==SCALE_XYZ)), axeY, axeZ);

    axeX*=GetScreenFactor();
    axeY*=GetScreenFactor();
    axeZ*=GetScreenFactor();


    // plan1
    if (m_ScaleTypePredict != SCALE_X)
      DrawAxis(orig,axeX,axeY,axeZ,0.05f,0.83f,vector4(1,0,0,1));
    else
      DrawAxis(orig,axeX,axeY,axeZ,0.05f,0.83f,vector4(1,1,1,1));

    //plan2
    if (m_ScaleTypePredict != SCALE_Y)
      DrawAxis(orig,axeY,axeX,axeZ,0.05f,0.83f,vector4(0,1,0,1));
    else
      DrawAxis(orig,axeY,axeX,axeZ,0.05f,0.83f,vector4(1,1,1,1));

    //plan3
    if (m_ScaleTypePredict != SCALE_Z)
      DrawAxis(orig,axeZ,axeX,axeY,0.05f,0.83f,vector4(0,0,1,1));
    else
      DrawAxis(orig,axeZ,axeX,axeY,0.05f,0.83f,vector4(1,1,1,1));
  }


}
Esempio n. 24
0
// whole process of draw a figure.
void Figure::Show()
{
	Initialize();

	IplImage *output = cvCreateImage(figure_size, IPL_DEPTH_8U, 3);
	cvSet(output, backgroud_color, 0);

	DrawAxis(output);

	DrawPlots(output);

	DrawLabels(output, figure_size.width - 100, 10);

	cvShowImage(figure_name.c_str(), output);
	cvWaitKey(1);
	cvReleaseImage(&output);

}
Esempio n. 25
0
void CChart::DrawBackGround(CDC *pDC)
{
	if(memBkDC.GetSafeHdc() == NULL) {
		memBkDC.CreateCompatibleDC(pDC);
		m_BkBitmap.CreateCompatibleBitmap(pDC,
										  m_clientRect.Width(), 
										  m_clientRect.Height());
	}

	m_pOldBkBitmap = (CBitmap*)memBkDC.SelectObject(&m_BkBitmap) ;
	DrawBorder(&memBkDC);
	DrawAxis(&memBkDC);
	DrawGrid(&memBkDC);
	if(bLogScale)
		DrawLogGrid(&memBkDC);
	DrawGridLabel(&memBkDC);
	DrawChartTitle(&memBkDC);

}
Esempio n. 26
0
void TextureRender()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    glMatrixMode(GL_MODELVIEW);    
    glLoadIdentity();
    glRotatef (30, 1.0f, 0.0f, 0.0f);
    glRotatef (-45, 0.0f, 1.0f, 0.0f);

    DrawAxis ();
    //DrawTexRect ();
    glRotatef (texangx, 1.0f, 0.0f, 0.0f);
    glRotatef (texangy, 0.0f, 1.0f, 0.0f);
    glRotatef (texangz, 0.0f, 0.0f, 1.0f);
    DrawSphere ();

    if (texangx >= 360.0f)
    {
        texangx = 1.0f;
    }
    else
    {
        texangx += 1.0f;
    }

    if (texangy >= 360.0f)
    {
        texangy = 2.0f;
    }
    else
    {
        texangy += 2.0f;
    }

    if (texangz >= 360.0f)
    {
        texangz = 3.0f;
    }
    else
    {
        texangz += 3.0f;
    }
}
Esempio n. 27
0
void Display(void)
{
	double matBuf[4*4];
	YsVec3 eyePos;
	YsMatrix4x4 eyeTfm;
	YsVec3 p;

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	eyePos.Set(0.0,0.0,eyeDistance);
	eyePos=eyeAtt.GetMatrix()*eyePos;

	eyeTfm.Initialize();
	eyeTfm.Translate(eyePos);
	eyeTfm.Rotate(eyeAtt);
	eyeTfm.Invert();
	eyeTfm.Translate(-eyeLookAt);

	eyeTfm.GetArray(matBuf);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glMultMatrixd(matBuf);
	DrawAxis(5.0);

	glDisable(GL_LIGHTING);
	glColor3d(1.0,1.0,1.0);
	glBegin(GL_LINES);
	glVertex3d(0.0,0.0,0.0);
	glVertex3d(axisOfOrbit.x()*5.0,axisOfOrbit.y()*5.0,axisOfOrbit.z()*5.0);
	glEnd();

	rot.RotatePositive(p,orbiter);
	glPushMatrix();
	glTranslatef(p.x()*5.0,p.y()*5.0,p.z()*5.0);
	DrawCursor();
	glPopMatrix();

	glFlush();
	glutSwapBuffers();
}
Esempio n. 28
0
void SlideDraw::Display() {
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //カラーバッファ,デプスバッファ指定
  // 光源と視点が一緒に動かず固定されている場合
  // const GLfloat light0pos[4] = {lightpos[0][0],
  //                               lightpos[0][1],
  //                               lightpos[0][2],
  //                               lightpos[0][3]};
  // glLightfv(GL_LIGHT0, GL_POSITION, light0pos);

  for (auto&& ptcl : Particle) {
    if (IsDrawnObject(ptcl)) RenderSphere(ptcl);
  }

  ChangeCrossSection();
  // DrawCubic();
  // Drawxyz();

  const float col[][3] {{0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}, {1.0, 0.0, 0.0}};
  DrawAxis(0.02, 0.3, col);
  RenderCurTime();
  glutSwapBuffers();
}
void CameraCalibration::DrawChessboardAndImage(const int c_idx, const int img_idx, const bool is_undistorted, const bool is_stereobind)
{
	
    Mat img = imread(data_path+"/"+calib_params[c_idx].ImageList.at(img_idx), CV_LOAD_IMAGE_COLOR);

    if(is_undistorted)
    {
        Mat undistort_img;
		undistort(img, 
				  undistort_img,
				  calib_params[c_idx].CameraMatrix,
				  calib_params[c_idx].DistCoeffs,
				  calib_params[c_idx].CameraMatrix);

        img = undistort_img;
    }

	view[c_idx]->ActivateScissorAndClear();

	gl_img_tex->Upload(img.ptr<unsigned char>(), GL_BGR, GL_UNSIGNED_BYTE);
	gl_img_tex->RenderToViewportFlipY();
			
	// OpenGL rendering for left and right views
	CamIntrins[c_idx].Load();
	if(!c_idx)
		CamExtrins[c_idx].at(img_idx).Load();
	else
	{
		// right camera
		if(is_stereobind)
			StereoBind(CamExtrins[0].at(img_idx)).Load();
		else
			CamExtrins[c_idx].at(img_idx).Load();
	}

	DrawAxis();
    gl_chessboard_tex->Render3DPlanTexture(BoardTexWdith, BoardTexHeight);

}
Esempio n. 30
0
	void DisplayDebugInfo::Draw()
	{
		if (Game::Instance()->GetDebugOptions().ShowAxis == true)
		{
			DrawAxis(m_VertexBuffer, m_pProgram->Handle());
		}

		if (Game::Instance()->GetDebugOptions().ShowFPS == true)
		{
			ShowFPS();
		}

		if (Game::Instance()->GetDebugOptions().IsDebugActivated == true)
		{
			ShowDebugWindow();
		}

		if (Game::Instance()->GetDebugOptions().ShowLogInGame == true)
		{
			InGameLogger::Instance().ShowWindow();
		}
	}