I have managed to make it run with immediate mode, from the tutorial, now i want to try the Vertex Buffer Object method.
I want to make(at least try) a 2D/3D cad program so gamewindow mode is not for me.
Here is code from Immediate Mode:
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
usingSystem.Windows.Forms;
usingOpenTK;
usingOpenTK.Graphics;
usingOpenTK.Graphics.OpenGL;
namespace opegl_test_1
{public partial class Form1 : Form{public Form1(){
InitializeComponent();
}bool loadddeed = false;
privatevoid glControl1_Load(object sender, EventArgs e){
loadddeed = true;
SetupViewPort();
}privatevoid SetupViewPort(){int w = glControl1.Width;
int h = glControl1.Height;
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Ortho(0, w, 0, h, -1, 1); // Bottom-left corner pixel has coordinate (0, 0)GL.Viewport(0, 0, w, h); // Use all of the glControl painting areaGL.ClearColor(Color.YellowGreen);
}privatevoid glControl1_Resize(object sender, EventArgs e){
glControl1.Refresh();
SetupViewPort();//is this necessary here?}privatevoid glControl1_Paint(object sender, PaintEventArgs e){if(!loadddeed)return;
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.ColorBufferBit);
GL.MatrixMode(MatrixMode.Modelview);
GL.Color3(Color.Red);
//Draw somethingGL.Begin(BeginMode.Lines);
for(int i = 0; i < 100; i++){for(int j = 0; j < 100; j++){GL.Vertex2(i *0.5, j *2);
GL.Vertex2(i *1.5, j * 1.5);
}}GL.End();
glControl1.SwapBuffers();
}}}
Where should i put the vbo code and what in what order.
I have tried copying the code from gamewindow but doesnt draw anythig.
Comments
Re: Im a total newb
I have managed to make it run with immediate mode, from the tutorial, now i want to try the Vertex Buffer Object method.
I want to make(at least try) a 2D/3D cad program so gamewindow mode is not for me.
Here is code from Immediate Mode:
Where should i put the vbo code and what in what order.
I have tried copying the code from gamewindow but doesnt draw anythig.