Note that there are some explanatory texts on larger screens.

plurals
  1. POglGenBuffers and glGenTextures always return 0
    text
    copied!<h2>Setup</h2> <p>I'm using <code>System.Windows.Forms.Form</code> as window source. <em>Constructor:</em></p> <pre><code>FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized; </code></pre> <hr> <p><em>Form-Load:</em></p> <pre><code>_Device = new Device(this, DeviceConfiguration.SelectConfiguration(Bits.Eight, Bits.Eight, Bits.Eight, Bits.Eight, Bits.Twentyfour, Bits.Eight, true, true), 1024, 768); Debug.WriteLine(GL.GetString(GL.GL_EXTENSIONS)); base.OnLoad(e); </code></pre> <p>In the load method the device configuration is selected, which is actually working. Calls like <code>GL.GetString(GL.GL_EXTENSIONS)</code> are working. All gl-methods are loaded too so all used methods are supported.</p> <hr> <p><em>Form-Shown:</em></p> <pre><code>Application.Initialize(this); RenderSettings = new RenderSettings(this); Debug.WriteLine("After setup render settings: " + GL.GetErrorDescription()); _Textures[0] = Resources.LoadTexture("Resources\\Buttons\\btn_big_bg_normal.dds"); _Textures[1] = Resources.LoadTexture("Resources\\Buttons\\btn_big_bg_normal.dds"); base.OnShown(e); _IsShown = true; </code></pre> <p>The <code>Application.Initialize(this)</code> initializes the framework used ( written by me ) and is also initializing a default shader, which is working, and model which is not working. This causes the rendering later to fail because the returning handle is invalid.</p> <h2>Framework</h2> <p>I've a own OpenGL-wrapper which has enums for all parameters to enable development without looking in the OpenGL-references many times. As example the method <code>glGenBuffers</code>:</p> <pre><code>[MethodGL] public delegate void glGenBuffers(Int32 count, ArrayBufferHandle[] buffers); </code></pre> <p>The <code>ArrayBufferHandle</code> definition:</p> <pre><code>/// &lt;summary&gt; /// Represents a handle to a buffer /// &lt;/summary&gt; [StructLayout(LayoutKind.Explicit, Size = 4)] [ComVisible(true)] public struct ArrayBufferHandle { [FieldOffset(0)] UInt32 Handle; /// &lt;summary&gt; /// Determines if the buffer is valid /// &lt;/summary&gt; public Boolean IsValid { get { return Handle &gt; 0; } } /// &lt;summary&gt; /// Retrieves the default array buffer /// &lt;br&gt;which is used to reset bindings&lt;/br&gt; /// &lt;/summary&gt; public static ArrayBufferHandle Default { get { return new ArrayBufferHandle(); } } /// &lt;summary&gt; /// Retrieves the string representation of the current object /// &lt;/summary&gt; /// &lt;returns&gt;The current object represented as string&lt;/returns&gt; public override String ToString() { return String.Format("[ArrayBufferHandle Handle:{0} Valid:{1}]", Handle, IsValid); } } </code></pre> <p>Of course the shader creation is working and uses the types like the shown above.</p> <h2>Conclusion</h2> <p>I don't think i've much more to say to the issues i've faced. <code>glGenBuffers</code> and <code>glGenTextures</code> returning zero and i don't know why. The setup seems like others i've already used.</p> <p>Of course the window is shown with a blue background when not rendering any models and i don't have any errors when using <code>glGetError</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload