iulian3000's picture

Im a total newb

Can please someone please post how to initialize vbo with glcontrol?
I've search and found only examples with gamewindow.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
iulian3000's picture

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:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
namespace opegl_test_1
    public partial class Form1 : Form
        public Form1()
        bool loadddeed = false;
        private void glControl1_Load(object sender, EventArgs e)
            loadddeed = true;
        private void SetupViewPort()
            int w = glControl1.Width;
            int h = glControl1.Height;
            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 area
        private void glControl1_Resize(object sender, EventArgs e)
            SetupViewPort();//is this necessary here?
        private void glControl1_Paint(object sender, PaintEventArgs e)
            if (!loadddeed) return;
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.ColorBufferBit);
            //Draw something
            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);

Where should i put the vbo code and what in what order.
I have tried copying the code from gamewindow but doesnt draw anythig.