-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenTK3D.h
75 lines (44 loc) · 1.25 KB
/
OpenTK3D.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once
using namespace System;
using namespace OpenTK;
using namespace OpenTK::Graphics;
using namespace OpenTK::Graphics::OpenGL;
public ref class OpenTK3D : public GameWindow
{
private:
int VertexBufferObject;
protected:
void OnLoad(EventArgs ^e) override{
VertexBufferObject = GL::GenBuffer();
//GL::BufferData(BufferTarget::ArrayBuffer, 100, verti, BufferUsageHint::StreamDraw);
GL::ClearColor(0.6f, 0.6f, 0.1f, 1.0f);
GL::MatrixMode(MatrixMode::Modelview);
GL::LoadIdentity();
GameWindow::OnLoad(e);
}
void OnUnload(EventArgs ^e) override
{
GL::BindBuffer(BufferTarget::ArrayBuffer, 0);
GL::DeleteBuffer(VertexBufferObject);
GameWindow::OnUnload(e);
}
void OnRenderFrame(FrameEventArgs ^e) override
{
GameWindow::OnRenderFrame(e);
GL::Clear(ClearBufferMask::ColorBufferBit);
GL::ClearColor(Color::CornflowerBlue);
GL::Begin(PrimitiveType::Lines);
GL::Vertex3(1, 0, 0);
GL::Vertex3(-0.5f, 0.3f, 0.0f);
GL::End();
GL::Flush();
Context->SwapBuffers();
}
void OnResize(EventArgs ^e)override
{
GL::Viewport(0, 0, Width, Height);
GameWindow::OnResize(e);
}
public:
OpenTK3D(int width, int height, String ^ title) : GameWindow(width, height, GraphicsMode::Default, title) { }
};