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
|
int main()
{
float vertices[]
= {
960.0F, 0.0F,
960.0F, 270.0F,
480.0F, 270.0F,
480.0F, 0.0F
};
unsigned short int indices[]
= {
0,1,2,
2,3,0
};
unsigned int VB, IB;
glGenBuffers(1, &VB);
glBindBuffer(GL_ARRAY_BUFFER, VB);
glNamedBufferData(VB, sizeof(vertices),vertices,GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);
glGenBuffers(1, &IB);
glBindBuffer(GL_ARRAY_BUFFER, IB);
glNamedBufferData(IB, sizeof(indices), indices, GL_STATIC_DRAW);
{
GLFW glfw(960,540);
ImmediateModeGUI ImGui(glfw.GetWindowID());
while (!glfw.WindowShouldClose())
{
glClearColor(0.0F, 0.0F, 0.0F, 1.0F); // prefix GLCall()
glClear(GL_COLOR_BUFFER_BIT); // prefix GLCall()
ImGui.NewFrame();
ImGui.Begin("Test");
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
ImGui.End();
ImGui.Render();
glfw.SwapBuffers();
}
}
}
|