CheatCat's picture

[Solved] GenTexture() problems!

I try to generate a texture by GenTexture(). But I get this error:
"No context is current in the calling thread (ThreadId: 10)."

The code:

using System;
using OpenTK;
using OpenTK.Graphics;
 
namespace Test
{
    static class Program
    {
        [STAThread]
        static void Main()
        {
            int tex = GL.GenTexture();
        }
    }
}

Comments

Comment viewing options

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

CheatCat. You need an "opengl context" to call methods in GL.

Easiest way is inheriting from the GameWindow class; look at the examples in the OpenTK download.

CheatCat's picture

Oh, I forget that! xD Thanks!