本文整理汇总了C#中OpenTK.GLControl类的典型用法代码示例。如果您正苦于以下问题:C# GLControl类的具体用法?C# GLControl怎么用?C# GLControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GLControl类属于OpenTK命名空间,在下文中一共展示了GLControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NativeEditorGraphicsContext
public NativeEditorGraphicsContext()
{
GraphicsMode defaultGraphicsMode = this.GetDefaultGraphicsMode();
this.mainContextControl = new GLControl(defaultGraphicsMode);
this.mainContextControl.VSync = false;
this.mainContextControl.MakeCurrent();
}
示例2: GLForm
public GLForm(OpenTKGraphics graphics)
{
this.graphics = graphics;
InitializeComponent();
glControl = new GLControl();
glControl.BackColor = System.Drawing.Color.Black;
glControl.Dock = DockStyle.Fill;
glControl.TabIndex = 0;
glControl.VSync = false;
Controls.Add(glControl);
glControl.Paint += new PaintEventHandler(glControl_Paint);
glControl.Disposed += new EventHandler(glControl_Disposed);
glControl.KeyDown += new KeyEventHandler(glControl_KeyDown);
glControl.KeyUp += new KeyEventHandler(glControl_KeyUp);
glControl.MouseDown += new MouseEventHandler(glControl_MouseDown);
glControl.MouseUp += new MouseEventHandler(glControl_MouseUp);
glControl.MouseMove += new MouseEventHandler(glControl_MouseMove);
glControl.MouseWheel += new MouseEventHandler(glControl_MouseWheel);
glControl.PreviewKeyDown += new PreviewKeyDownEventHandler(glControl_PreviewKeyDown);
Resize += new EventHandler(GLForm_Resize);
}
示例3: Viewport
public Viewport(Window parentWindow)
{
ParentWindow = parentWindow;
OpenTK.Graphics.GraphicsMode Mode = new OpenTK.Graphics.GraphicsMode(new OpenTK.Graphics.ColorFormat(8, 8, 8, 8), 24);
GLControl = new GLControl(Mode, 4, 4, OpenTK.Graphics.GraphicsContextFlags.Default);
GLControl.MakeCurrent();
GLControl.Paint += GLControl_Paint;
GLControl.Resize += GLControl_Resize;
GLControl.MouseDown += GLControl_MouseDown;
GLControl.MouseUp += GLControl_MouseUp;
GLControl.MouseMove += GLControl_MouseMove;
GLControl.MouseWheel += GLControl_MouseWheel;
GLControl.MouseLeave += GLControl_MouseLeave;
GLControl.Dock = System.Windows.Forms.DockStyle.Fill;
GL.Disable(EnableCap.CullFace);
GL.Enable(EnableCap.DepthTest);
GL.DepthFunc(DepthFunction.Less);
GL.DepthMask(true);
GL.Enable(EnableCap.Blend);
GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
_Camera = new Camera();
_Camera.ViewportSize = new int2(GLControl.Width, GLControl.Height);
_Camera.PropertyChanged += _Camera_PropertyChanged;
}
示例4: Add
public static void Add(GLControl control)
{
IGraphicsContext context = control.Context;
IWindowInfo window = control.WindowInfo;
Contexts.Add(context, new ContextAsset(window));
}
示例5: Window_Loaded
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// Create the GLControl.
glc = new GLControl();
// Assign Load and Paint events of GLControl.
glc.Load += new EventHandler(glc_Load);
glc.Paint += new PaintEventHandler(glc_Paint);
// Assign the GLControl as the host control's child.
host.Child = glc;
// Initiate Kinect runtime and streams
nui = Runtime.Kinects[0];
try
{
nui.Initialize(RuntimeOptions.UseColor);
nui.VideoStream.Open(ImageStreamType.Video, 2,
ImageResolution.Resolution640x480, ImageType.Color);
}
catch (InvalidOperationException)
{
return;
}
// Assign stream events
nui.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_VideoFrameReady);
}
示例6: OpenGLWriteableBitmapUpdater
/// <summary>
/// Constructor
/// </summary>
public OpenGLWriteableBitmapUpdater(Size size, GraphicsMode graphicsMode, Action<GLControl> onPrepare = null, Action<GLControl> onFinalize = null)
{
this.loaded = false;
this.Size = size;
this.framebufferId = -1;
this.OnPrepare += onPrepare;
this.OnFinalize += onFinalize;
messagingTask.StartMessageLoop(
prepare: () =>
{
this.glControl = new GLControl(graphicsMode);
this.glControl.MakeCurrent();
if (this.OnPrepare != null)
{
this.OnPrepare(this.glControl);
this.OnPrepare -= onPrepare;
}
},
finalize: () =>
{
if (this.OnFinalize != null)
{
this.OnFinalize(this.glControl);
this.OnFinalize -= onFinalize;
}
this.glControl.Context.MakeCurrent(null);
this.glControl.Dispose();
});
}
示例7: CanvasForm
public CanvasForm(Control parent)
{
InitializeComponent();
ContextContainer = new Panel();
ContextContainer.Padding = new Padding(1);
ContextContainer.BackColor = Color.Black;
Console.WriteLine(ContextContainer.Anchor);
GraphicsMode mode = new GraphicsMode(
new ColorFormat(8, 8, 8, 8),
8, 8, MSAASamples,
new ColorFormat(8, 8, 8, 8), 2, false
);
GLContext = new GLControl(mode, 2, 0, GraphicsContextFlags.Default);
GLContext.Dock = DockStyle.Fill;
GLContext.VSync = true;
GLContext.Paint += new PaintEventHandler(this.GLContext_Paint);
GLContext.MouseDown += new MouseEventHandler(this.GLContext_MouseDown);
GLContext.MouseMove += new MouseEventHandler(this.GLContext_MouseMove);
GLContext.MouseUp += new MouseEventHandler(this.GLContext_MouseUp);
ContextContainer.Controls.Add(GLContext);
Controls.Add(ContextContainer);
// Setup stuff
TopLevel = false;
parent.Controls.Add(this);
}
示例8: FullScreenWindow
public FullScreenWindow(ref GLRenderer renderer, ref GLCamera camera,
ref AnimationController animationController,
ref GLControl control,
float fieldOfView, float nearPlane, float farPlane)
{
// Store references
this.renderer = renderer;
this.camera = camera;
this.animationController = animationController;
this.fieldOfView = fieldOfView;
this.nearPlane = nearPlane;
this.farPlane = farPlane;
this.mainGLControl = control;
InitializeComponent();
//
// Set up callbacks.
//
// GLControl Callbacks
glControlMain.Load += new EventHandler(GLControlMainOnLoad);
glControlMain.Resize += new EventHandler(GLControlMainOnResize);
glControlMain.Paint += new PaintEventHandler(GLControlMainOnPaint);
// Set mouse events
glControlMain.MouseDown += new MouseEventHandler(GLControlOnMouseDown);
glControlMain.MouseUp += new MouseEventHandler(GLControlOnMouseUp);
glControlMain.MouseWheel += new MouseEventHandler(GLControlOnMouseWheel);
glControlMain.MouseMove += new MouseEventHandler(GLControlOnMouseMove);
// Set keyboard events
glControlMain.KeyDown += new KeyEventHandler(GLControlMainOnKeyDown);
glControlMain.KeyUp += new KeyEventHandler(GLControlMainOnKeyUp);
}
示例9: Timeline
public Timeline(GLControl context)
{
GLContext = context;
FrameNum = 0.0f;
PlayStart = null;
}
示例10: MapViewControl
public MapViewControl(frmMain Owner)
{
_Owner = Owner;
InitializeComponent();
ListSelect = new ContextMenuStrip();
ListSelect.ItemClicked += ListSelect_Click;
ListSelect.Closed += ListSelect_Close;
UndoMessageTimer = new Timer();
UndoMessageTimer.Tick += RemoveUndoMessage;
OpenGLControl = Program.OpenGL1;
pnlDraw.Controls.Add(OpenGLControl);
GLInitializeDelayTimer = new Timer();
GLInitializeDelayTimer.Interval = 50;
GLInitializeDelayTimer.Tick += GLInitialize;
GLInitializeDelayTimer.Enabled = true;
tmrDraw = new Timer();
tmrDraw.Tick += tmrDraw_Tick;
tmrDraw.Interval = 1;
tmrDrawDelay = new Timer();
tmrDrawDelay.Tick += tmrDrawDelay_Tick;
tmrDrawDelay.Interval = 30;
UndoMessageTimer.Interval = 4000;
}
示例11: Input
public Input(GLControl control)
{
Control = control;
control.MouseMove += control_MouseMove;
control.MouseLeave += delegate { _mouseInside = false; };
control.MouseEnter += delegate { _mouseInside = true; };
control.MouseWheel += control_MouseWheel;
}
示例12: MyCamera
public MyCamera(GLControl glControl)
{
m_glControl = glControl;
glControl.MouseDown += new MouseEventHandler(glControl_MouseDown);
glControl.MouseMove += new MouseEventHandler(glControl_MouseMove);
glControl.MouseUp += new MouseEventHandler(glControl_MouseUp);
}
示例13: Run
public void Run()
{
using (Form form = CreateForm())
{
var mGLControl = new GLControl
{
Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
BackColor = Color.LightGreen,
Location = new Point(1, 0),
Name = "GL Control",
Size = new Size(WIDTH, HEIGHT),
TabIndex = 0,
VSync = false
};
form.Controls.Add(mGLControl);
//have to set this to get a -1 to 1 system view
GL.Viewport(0, 0, WIDTH, HEIGHT);
if (false)//!GL.SupportsExtension("VERSION_1_5"))
{
Assert.Fail("You need at least OpenGL 1.5 to run this example. Aborting.", "VBOs not supported");
}
var positions = new[]
{
new Vector3(-1, -1, 0),
new Vector3(1, -1, 0),
new Vector3(1, 1, 0),
new Vector3(-1, 1, 0),
};
var colors = new[]
{
new Vector3(1, 0, 0), new Vector3(0, 1, 0),
new Vector3(0, 0, 1), new Vector3(1, 1, 0)
};
var indices = new uint[] { 0, 1, 2, 0, 2, 3 };
LoadBuffers(positions, indices, colors);
Application.Idle +=
delegate
{
mGLControl.MakeCurrent();
GL.ClearColor(mGLControl.BackColor);
GL.Clear(ClearBufferMask.ColorBufferBit);
RenderFrame();
mGLControl.SwapBuffers();
};
form.BringToFront();
Application.Run(form);
}
}
示例14: LoadROM
public void LoadROM(byte[] romBuffer, ref GLControl control)
{
Buffer.BlockCopy(romBuffer, 0x0000, _rom, 0x0000, _rom.Length);
Buffer.BlockCopy(romBuffer, 0xC000, _wram, 0x0000, _wram.Length);
Buffer.BlockCopy(romBuffer, 0xA000, _eram, 0x0000, _eram.Length);
Buffer.BlockCopy(romBuffer, 0xFF80, _zram, 0x0000, _zram.Length);
GBCGPU.LoadROM(ref romBuffer, ref control);
}
示例15: OpenGLD3DImageUpdater
/// <summary>
/// constructor
/// </summary>
/// <param name="size">initialize surface size</param>
/// <param name="graphicsMode">OpenGL graphics mode</param>
public OpenGLD3DImageUpdater(
Size size,
GraphicsMode graphicsMode)
{
this.glControl = new GLControl(graphicsMode);
this.glControl.MakeCurrent();
Size = size;
this.CreateD3D9ExContext(this.glControl.Handle, graphicsMode.Depth > 0, graphicsMode.Stencil > 0);
}