مهدی نصیری
سه شنبه 28 دی 1389, 14:39 عصر
سلام دوستان
چگونه می شود این کد را تغییر داد و چگون به انتهای این سیلندر دیسک اضافه کرد که بر خلاف جهت سیلندر
حرکت کند. با تشکر
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SharpGL;
using SharpGL.SceneGraph.Quadrics;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
OpenGL g;
int sh = 0, fh = 0;
private void openGLCtrl2_OpenGLDraw(object sender, PaintEventArgs e)
{
g.Clear(OpenGL.COLOR_BUFFER_BIT | OpenGL.DEPTH_BUFFER_BIT);
g.LoadIdentity();
g.Translate(6.0f, 0.0f, -10.0f);
g.Color(1.0f, 1.0f, 1.0f);
g.Rotate(0, -90, sh);
Cylinder cyl = new Cylinder();
cyl.QuadricDrawStyle = Quadric.DrawStyle.Point ;
cyl.TopRadius = cyl.BaseRadius;
cyl.Height = 2.0;
cyl.Create(openGLCtrl2.OpenGL);
cyl.Draw(openGLCtrl2.OpenGL);
g.Translate(0.0f, 5.0f, 4.0f);
g.Rotate(1,1 , fh);
Cylinder h = new Cylinder();
h.QuadricDrawStyle = Quadric.DrawStyle.Line ;
g.Color(1.0f, 1.0f, 2.0);
h.BaseRadius = cyl.TopRadius;
h.Height = 2;
h.TopRadius = 50;
h.Create(openGLCtrl2.OpenGL);
h.Draw(openGLCtrl2.OpenGL);
sh += 10;
fh -= 20;
}
private void Form1_Load(object sender, EventArgs e)
{
g = openGLCtrl2.OpenGL;
}
}
}
چگونه می شود این کد را تغییر داد و چگون به انتهای این سیلندر دیسک اضافه کرد که بر خلاف جهت سیلندر
حرکت کند. با تشکر
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SharpGL;
using SharpGL.SceneGraph.Quadrics;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
OpenGL g;
int sh = 0, fh = 0;
private void openGLCtrl2_OpenGLDraw(object sender, PaintEventArgs e)
{
g.Clear(OpenGL.COLOR_BUFFER_BIT | OpenGL.DEPTH_BUFFER_BIT);
g.LoadIdentity();
g.Translate(6.0f, 0.0f, -10.0f);
g.Color(1.0f, 1.0f, 1.0f);
g.Rotate(0, -90, sh);
Cylinder cyl = new Cylinder();
cyl.QuadricDrawStyle = Quadric.DrawStyle.Point ;
cyl.TopRadius = cyl.BaseRadius;
cyl.Height = 2.0;
cyl.Create(openGLCtrl2.OpenGL);
cyl.Draw(openGLCtrl2.OpenGL);
g.Translate(0.0f, 5.0f, 4.0f);
g.Rotate(1,1 , fh);
Cylinder h = new Cylinder();
h.QuadricDrawStyle = Quadric.DrawStyle.Line ;
g.Color(1.0f, 1.0f, 2.0);
h.BaseRadius = cyl.TopRadius;
h.Height = 2;
h.TopRadius = 50;
h.Create(openGLCtrl2.OpenGL);
h.Draw(openGLCtrl2.OpenGL);
sh += 10;
fh -= 20;
}
private void Form1_Load(object sender, EventArgs e)
{
g = openGLCtrl2.OpenGL;
}
}
}