Multiple colors points in 3D openGL suface.
Posted: Fri Apr 20, 2007 8:58 am
I am plotting two 3D openGL surfaces. One of them (red) is top border. Enother one is a function. If some point of this surface is above red border it should be orange, if not - blue. I've made a simple application like that:
FORM1.CS
FORM1.DESIGNER.CS
But the result was surprising:
Second surface is all blue. So what should I do?
By the way I've discovered than surface is drawing (also rotating, elevating, etc) faster than triSurface with the same data. Am I right?
Do you know what type of surface will draw faster: solid or dot?
Thank you.
FORM1.CS
Code: Select all
using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void MGnazemle3D_Load(object sender, EventArgs e)
{
teeOpenGL1.Light0.Visible = false;
for (double x = 0; x <= 10; x +=0.5)
{
for (double z = 0; z <= 10; z += 0.5)
{
surface1.Add(x, 10, z);
if (x + z <= 10)
surface2.Add(x, x + z, z, Color.Blue);
else
surface2.Add(x, x + z, z, Color.Orange);
}
}
}
}
}
Code: Select all
namespace WindowsApplication1
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.teeOpenGL1 = new Steema.TeeChart.Drawing.GL.TeeOpenGL();
this.tChart1 = new Steema.TeeChart.TChart();
this.surface1 = new Steema.TeeChart.Styles.Surface();
this.surface2 = new Steema.TeeChart.Styles.Surface();
this.rotate1 = new Steema.TeeChart.Tools.Rotate();
//
// teeOpenGL1
//
this.teeOpenGL1.Active = true;
this.teeOpenGL1.AmbientLight = 0;
this.teeOpenGL1.Chart = this.tChart1;
this.teeOpenGL1.Shininess = 1;
//
// tChart1
//
//
//
//
this.tChart1.Aspect.Chart3DPercent = 100;
this.tChart1.Aspect.Elevation = 348;
this.tChart1.Aspect.ElevationFloat = 348;
this.tChart1.Aspect.Orthogonal = false;
this.tChart1.Aspect.Perspective = 0;
this.tChart1.Aspect.Rotation = 336;
this.tChart1.Aspect.RotationFloat = 336;
this.tChart1.Aspect.Zoom = 50;
this.tChart1.Aspect.ZoomText = false;
//
//
//
//
//
//
this.tChart1.Axes.Bottom.Automatic = true;
//
//
//
this.tChart1.Axes.Bottom.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dash;
this.tChart1.Axes.Bottom.Grid.ZPosition = 0;
//
//
//
//
//
//
this.tChart1.Axes.Bottom.Labels.Font.Bold = true;
this.tChart1.Axes.Bottom.Labels.Font.Name = "Microsoft Sans Serif";
this.tChart1.Axes.Bottom.Labels.Font.Size = 18;
this.tChart1.Axes.Bottom.Labels.Font.SizeFloat = 18F;
this.tChart1.Axes.Bottom.Labels.Separation = 30;
//
//
//
this.tChart1.Axes.Depth.Automatic = true;
//
//
//
this.tChart1.Axes.Depth.AxisPen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.tChart1.Axes.Depth.AxisPen.Visible = false;
//
//
//
this.tChart1.Axes.Depth.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dash;
this.tChart1.Axes.Depth.Grid.ZPosition = 0;
//
//
//
//
//
//
this.tChart1.Axes.Depth.Labels.Font.Bold = true;
this.tChart1.Axes.Depth.Labels.Font.Name = "Microsoft Sans Serif";
this.tChart1.Axes.Depth.Labels.Font.Size = 18;
this.tChart1.Axes.Depth.Labels.Font.SizeFloat = 18F;
this.tChart1.Axes.Depth.Labels.Separation = 380;
this.tChart1.Axes.Depth.Labels.ValueFormat = "0.00";
this.tChart1.Axes.Depth.Visible = true;
//
//
//
this.tChart1.Axes.DepthTop.Automatic = true;
//
//
//
this.tChart1.Axes.DepthTop.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dash;
this.tChart1.Axes.DepthTop.Grid.ZPosition = 0;
//
//
//
this.tChart1.Axes.Left.Automatic = true;
//
//
//
this.tChart1.Axes.Left.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dash;
this.tChart1.Axes.Left.Grid.ZPosition = 0;
//
//
//
//
//
//
this.tChart1.Axes.Left.Labels.Font.Bold = true;
this.tChart1.Axes.Left.Labels.Font.Name = "Microsoft Sans Serif";
this.tChart1.Axes.Left.Labels.Font.Size = 18;
this.tChart1.Axes.Left.Labels.Font.SizeFloat = 18F;
this.tChart1.Axes.Left.Labels.Separation = 56;
this.tChart1.Axes.Left.Labels.ValueFormat = "0.0";
//
//
//
this.tChart1.Axes.Left.Title.Angle = 0;
this.tChart1.Axes.Left.Title.Lines = new string[] {
""};
this.tChart1.Axes.Left.Title.Visible = false;
//
//
//
this.tChart1.Axes.Right.Automatic = true;
//
//
//
this.tChart1.Axes.Right.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dash;
this.tChart1.Axes.Right.Grid.ZPosition = 0;
this.tChart1.Axes.Right.Visible = false;
//
//
//
this.tChart1.Axes.Top.Automatic = true;
//
//
//
this.tChart1.Axes.Top.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dash;
this.tChart1.Axes.Top.Grid.ZPosition = 0;
this.tChart1.Axes.Top.Visible = false;
this.tChart1.Cursor = System.Windows.Forms.Cursors.Default;
//
//
//
this.tChart1.Footer.Visible = false;
//
//
//
//
//
//
this.tChart1.Header.Font.Bold = true;
//
//
//
this.tChart1.Header.Font.Brush.Color = System.Drawing.Color.Black;
this.tChart1.Header.Font.Name = "Microsoft Sans Serif";
this.tChart1.Header.Font.Size = 12;
this.tChart1.Header.Font.SizeFloat = 12F;
this.tChart1.Header.Font.Underline = true;
this.tChart1.Header.Lines = new string[] {
"Вибродиагностика"};
this.tChart1.Header.Visible = false;
//
//
//
this.tChart1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Palette;
this.tChart1.Legend.MaxNumRows = 8;
//
//
//
this.tChart1.Legend.Shadow.Visible = true;
//
//
//
//
//
//
this.tChart1.Legend.Title.Font.Bold = true;
//
//
//
this.tChart1.Legend.Title.Pen.Visible = false;
this.tChart1.Legend.Visible = false;
this.tChart1.Location = new System.Drawing.Point(204, 120);
this.tChart1.Name = "tChart1";
//
//
//
//
//
//
this.tChart1.Panel.ImageBevel.Width = 1;
//
//
//
this.tChart1.Panning.Allow = Steema.TeeChart.ScrollModes.None;
this.tChart1.Series.Add(this.surface1);
this.tChart1.Series.Add(this.surface2);
this.tChart1.Size = new System.Drawing.Size(699, 463);
//
//
//
this.tChart1.SubFooter.Visible = false;
//
//
//
//
//
//
this.tChart1.SubHeader.Font.Bold = true;
//
//
//
this.tChart1.SubHeader.Font.Brush.Color = System.Drawing.Color.Black;
this.tChart1.SubHeader.Font.Name = "Microsoft Sans Serif";
this.tChart1.SubHeader.Font.Size = 11;
this.tChart1.SubHeader.Font.SizeFloat = 11F;
this.tChart1.SubHeader.Lines = new string[] {
""};
this.tChart1.SubHeader.Visible = false;
this.tChart1.TabIndex = 10;
this.tChart1.Tools.Add(this.rotate1);
//
//
//
//
//
//
this.tChart1.Walls.Back.AutoHide = false;
this.tChart1.Walls.Back.Visible = false;
//
//
//
this.tChart1.Walls.Bottom.AutoHide = false;
//
//
//
this.tChart1.Walls.Bottom.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
//
//
//
this.tChart1.Walls.Bottom.Gradient.Transparency = 100;
//
//
//
this.tChart1.Walls.Bottom.Pen.Width = 2;
this.tChart1.Walls.Bottom.Size = 1;
this.tChart1.Walls.Bottom.Transparent = true;
//
//
//
this.tChart1.Walls.Left.AutoHide = false;
this.tChart1.Walls.Left.Transparent = true;
this.tChart1.Walls.Left.Visible = false;
//
//
//
this.tChart1.Walls.Right.AutoHide = false;
//
//
//
this.tChart1.Zoom.Allow = false;
//
// surface1
//
//
//
//
this.surface1.Brush.Color = System.Drawing.Color.Red;
//
//
//
//
//
//
this.surface1.Marks.Callout.ArrowHead = Steema.TeeChart.Styles.ArrowHeadStyles.None;
this.surface1.Marks.Callout.ArrowHeadSize = 8;
//
//
//
this.surface1.Marks.Callout.Brush.Color = System.Drawing.Color.Black;
this.surface1.Marks.Callout.Distance = 0;
this.surface1.Marks.Callout.Draw3D = false;
this.surface1.Marks.Callout.Length = 10;
this.surface1.Marks.Callout.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
//
//
//
this.surface1.Marks.Shadow.Visible = true;
//
//
//
//
//
//
this.surface1.Marks.Symbol.Shadow.Visible = true;
this.surface1.PaletteMin = 0;
this.surface1.PaletteStep = 0;
//
//
//
this.surface1.Pen.Visible = false;
this.surface1.Title = "surface1";
this.surface1.UseColorRange = false;
//
//
//
this.surface1.XValues.DataMember = "X";
//
//
//
this.surface1.YValues.DataMember = "Y";
//
//
//
this.surface1.ZValues.DataMember = "Z";
//
// surface2
//
//
//
//
this.surface2.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
//
//
//
//
//
//
this.surface2.Marks.Callout.ArrowHead = Steema.TeeChart.Styles.ArrowHeadStyles.None;
this.surface2.Marks.Callout.ArrowHeadSize = 8;
//
//
//
this.surface2.Marks.Callout.Brush.Color = System.Drawing.Color.Black;
this.surface2.Marks.Callout.Distance = 0;
this.surface2.Marks.Callout.Draw3D = false;
this.surface2.Marks.Callout.Length = 10;
this.surface2.Marks.Callout.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
//
//
//
this.surface2.Marks.Shadow.Visible = true;
//
//
//
//
//
//
this.surface2.Marks.Symbol.Shadow.Visible = true;
this.surface2.PaletteMin = 0;
this.surface2.PaletteStep = 0;
//
//
//
this.surface2.Pen.Visible = false;
this.surface2.Title = "surface2";
this.surface2.UseColorRange = false;
//
//
//
this.surface2.XValues.DataMember = "X";
//
//
//
this.surface2.YValues.DataMember = "Y";
//
//
//
this.surface2.ZValues.DataMember = "Z";
}
#endregion
private Steema.TeeChart.TChart tChart1;
private Steema.TeeChart.Tools.Rotate rotate1;
private Steema.TeeChart.Drawing.GL.TeeOpenGL teeOpenGL1;
private Steema.TeeChart.Styles.Surface surface1;
private Steema.TeeChart.Styles.Surface surface2;
}
}
Second surface is all blue. So what should I do?
By the way I've discovered than surface is drawing (also rotating, elevating, etc) faster than triSurface with the same data. Am I right?
Do you know what type of surface will draw faster: solid or dot?
Thank you.