<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[OpenGL 3.3] Bug vmtl. bei den Buffern]]></title><description><![CDATA[<p>Das ist Die engine.c, da ist, wo die Rendering-Loop definiert ist:</p>
<pre><code>#include &quot;engine.h&quot;
#include &quot;shader.h&quot;
#include &quot;mesh.h&quot;

void run() {
  // Window creation
  WNDHND wh = createWindow(WIN_WIDTH, WIN_HEIGHT, WIN_TITLE);
  // Definition of the vertices
  float vertices[] = {
     0.5f,  0.5f, 0.0f,  // top right
     0.5f, -0.5f, 0.0f,  // bottom right
    -0.5f, -0.5f, 0.0f,  // bottom left
    -0.5f,  0.5f, 0.0f   // top left
  };
  unsigned int indices[] = {
    0, 1, 3,  // first Triangle
    1, 2, 3   // second Triangle
  };
  // Buffer setup
  BUFFERID vao1 = setupBuffers(vertices, indices,
  sizeof(vertices), sizeof(indices));
  // Shader setup
  SHADERID shader1 = setupShaders(&quot;vs1.glsl&quot;, &quot;fs1.glsl&quot;);
  // Render loop
  while(!windowShouldClose(wh)) {
    // Keep up with changing window dimensions
    int currentWidth;
    int currentHeight;
    glfwGetFramebufferSize(wh, &amp;currentWidth, &amp;currentHeight);
    glViewport(0, 0, currentWidth, currentHeight);
    // Clear with specified color
    const float r = 0.2f;
    const float g = 0.3f;
    const float b = 0.3f;
    const float a = 1.0f;
    glClearColor(r, g, b, a);
    // Draw calls here
    glUseProgram(shader1);
    glBindVertexArray(vao1);
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
    glClear(GL_COLOR_BUFFER_BIT);
    glfwSwapBuffers(wh);
    // Listen for any events
    glfwPollEvents();
  }
  destroyWindow(wh);
}
</code></pre>
<p>Hier ist wo die setupBuffers-Funktion definiert ist. Hier wird erst ein VAO, dann ein VBO erzeugt, gebunden, konfiguriert, um zu definieren wo die Daten hin sollen (zu welchen Attributen), dann wird noch ein EBO gebunden, um es mit Indizes ansprechen zu können:</p>
<pre><code>#include &quot;mesh.h&quot;

BUFFERID setupBuffers(const float verts[], const int indices[],
  const unsigned long szVerts, const unsigned long szIndices) {
  // Create a vertex array object to keep track of subsequent
  // VertexAttribPointer (configurations for attribute linkages) calls.
  GLuint vao;
  glGenVertexArrays(1, &amp;vao);
  glBindVertexArray(vao);
  // Configure vertex data
  GLuint VBO;
  glGenBuffers(1, &amp;vbo);
  glBindBuffer(GL_ARRAY_BUFFER, vbo);
  glBufferData(GL_ARRAY_BUFFER, szVerts, verts, GL_STATIC_DRAW);
  // Tell where position data is, then bind it to the position attribute
  const unsigned int nrOfPosComponents = 3;
  const unsigned int posAttribLocation = 0;
  const unsigned int posStride = nrOfPosComponents * sizeof(float);
  glVertexAttribPointer(posAttribLocation, nrOfPosComponents,
    GL_FLOAT, GL_FALSE, posStride, 0);
  glEnableVertexAttribArray(posAttribLocation);
  // Element buffer object
  GLuint ebo;
  glGenBuffers(1, &amp;ebo);
  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
  glBufferData(GL_ELEMENT_ARRAY_BUFFER, szIndices, indices, GL_STATIC_DRAW);
  return vao;
}
</code></pre>
<p>Die Shader kompilieren, es gibt keine Fehlermeldung.</p>
<p>Falls hier kein Bug ausfindig zu machen ist (habe lange rumgesucht und nichts gefunden), dann poste ich die anderen Codeparts ebenfalls, je nach Bedarf.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/346543/opengl-3-3-bug-vmtl-bei-den-buffern</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 18:35:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/346543.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 01 Mar 2018 13:14:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [OpenGL 3.3] Bug vmtl. bei den Buffern on Thu, 01 Mar 2018 13:14:25 GMT]]></title><description><![CDATA[<p>Das ist Die engine.c, da ist, wo die Rendering-Loop definiert ist:</p>
<pre><code>#include &quot;engine.h&quot;
#include &quot;shader.h&quot;
#include &quot;mesh.h&quot;

void run() {
  // Window creation
  WNDHND wh = createWindow(WIN_WIDTH, WIN_HEIGHT, WIN_TITLE);
  // Definition of the vertices
  float vertices[] = {
     0.5f,  0.5f, 0.0f,  // top right
     0.5f, -0.5f, 0.0f,  // bottom right
    -0.5f, -0.5f, 0.0f,  // bottom left
    -0.5f,  0.5f, 0.0f   // top left
  };
  unsigned int indices[] = {
    0, 1, 3,  // first Triangle
    1, 2, 3   // second Triangle
  };
  // Buffer setup
  BUFFERID vao1 = setupBuffers(vertices, indices,
  sizeof(vertices), sizeof(indices));
  // Shader setup
  SHADERID shader1 = setupShaders(&quot;vs1.glsl&quot;, &quot;fs1.glsl&quot;);
  // Render loop
  while(!windowShouldClose(wh)) {
    // Keep up with changing window dimensions
    int currentWidth;
    int currentHeight;
    glfwGetFramebufferSize(wh, &amp;currentWidth, &amp;currentHeight);
    glViewport(0, 0, currentWidth, currentHeight);
    // Clear with specified color
    const float r = 0.2f;
    const float g = 0.3f;
    const float b = 0.3f;
    const float a = 1.0f;
    glClearColor(r, g, b, a);
    // Draw calls here
    glUseProgram(shader1);
    glBindVertexArray(vao1);
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
    glClear(GL_COLOR_BUFFER_BIT);
    glfwSwapBuffers(wh);
    // Listen for any events
    glfwPollEvents();
  }
  destroyWindow(wh);
}
</code></pre>
<p>Hier ist wo die setupBuffers-Funktion definiert ist. Hier wird erst ein VAO, dann ein VBO erzeugt, gebunden, konfiguriert, um zu definieren wo die Daten hin sollen (zu welchen Attributen), dann wird noch ein EBO gebunden, um es mit Indizes ansprechen zu können:</p>
<pre><code>#include &quot;mesh.h&quot;

BUFFERID setupBuffers(const float verts[], const int indices[],
  const unsigned long szVerts, const unsigned long szIndices) {
  // Create a vertex array object to keep track of subsequent
  // VertexAttribPointer (configurations for attribute linkages) calls.
  GLuint vao;
  glGenVertexArrays(1, &amp;vao);
  glBindVertexArray(vao);
  // Configure vertex data
  GLuint VBO;
  glGenBuffers(1, &amp;vbo);
  glBindBuffer(GL_ARRAY_BUFFER, vbo);
  glBufferData(GL_ARRAY_BUFFER, szVerts, verts, GL_STATIC_DRAW);
  // Tell where position data is, then bind it to the position attribute
  const unsigned int nrOfPosComponents = 3;
  const unsigned int posAttribLocation = 0;
  const unsigned int posStride = nrOfPosComponents * sizeof(float);
  glVertexAttribPointer(posAttribLocation, nrOfPosComponents,
    GL_FLOAT, GL_FALSE, posStride, 0);
  glEnableVertexAttribArray(posAttribLocation);
  // Element buffer object
  GLuint ebo;
  glGenBuffers(1, &amp;ebo);
  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
  glBufferData(GL_ELEMENT_ARRAY_BUFFER, szIndices, indices, GL_STATIC_DRAW);
  return vao;
}
</code></pre>
<p>Die Shader kompilieren, es gibt keine Fehlermeldung.</p>
<p>Falls hier kein Bug ausfindig zu machen ist (habe lange rumgesucht und nichts gefunden), dann poste ich die anderen Codeparts ebenfalls, je nach Bedarf.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2552106</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2552106</guid><dc:creator><![CDATA[t0ky0lambda]]></dc:creator><pubDate>Thu, 01 Mar 2018 13:14:25 GMT</pubDate></item><item><title><![CDATA[Reply to [OpenGL 3.3] Bug vmtl. bei den Buffern on Thu, 01 Mar 2018 13:21:17 GMT]]></title><description><![CDATA[<p>Oh, und das Problem ist, dass keine Geometrie/Dreieck zu sehen ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2552107</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2552107</guid><dc:creator><![CDATA[t0ky0lambda]]></dc:creator><pubDate>Thu, 01 Mar 2018 13:21:17 GMT</pubDate></item><item><title><![CDATA[Reply to [OpenGL 3.3] Bug vmtl. bei den Buffern on Thu, 01 Mar 2018 13:57:25 GMT]]></title><description><![CDATA[<pre><code>#include &quot;mesh.h&quot;

BUFFERID setupBuffers(const float verts[], const int indices[],
  const unsigned long szVerts, const unsigned long szIndices) {
  // Create a vertex array object to keep track of subsequent
  // VertexAttribPointer (configurations for attribute linkages) calls.
  GLuint vao;
  glGenVertexArrays(1, &amp;vao);
  glBindVertexArray(vao);
  // Configure vertex data
  GLuint vbo;
  glGenBuffers(1, &amp;vbo);
  glBindBuffer(GL_ARRAY_BUFFER, vbo);
  glBufferData(GL_ARRAY_BUFFER, szVerts, verts, GL_STATIC_DRAW);
  // Tell where position data is, then bind it to the position attribute
  const unsigned int nrOfPosComponents = 3;
  const unsigned int posAttribLocation = 0;
  const unsigned int posStride = nrOfPosComponents * sizeof(float);
  glVertexAttribPointer(posAttribLocation, nrOfPosComponents,
    GL_FLOAT, GL_FALSE, posStride, 0);
  glEnableVertexAttribArray(posAttribLocation);
  // Element buffer object
  GLuint ebo;
  glGenBuffers(1, &amp;ebo);
  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
  glBufferData(GL_ELEMENT_ARRAY_BUFFER, szIndices, indices, GL_STATIC_DRAW);
  return vao;
}
</code></pre>
<p>Tippfehler korrigiert (Variablenname).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2552113</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2552113</guid><dc:creator><![CDATA[t0ky0lambda]]></dc:creator><pubDate>Thu, 01 Mar 2018 13:57:25 GMT</pubDate></item><item><title><![CDATA[Reply to [OpenGL 3.3] Bug vmtl. bei den Buffern on Thu, 01 Mar 2018 17:39:26 GMT]]></title><description><![CDATA[<p>Lag wohl daran, dass ich zu früh den Framebuffer gelöscht habe... Das glClear muss davor!</p>
<p>PS: Das Forum ist dem anschein nach gestorben... kein volkard (Universalgelehrter, der immer bei allen Themen kompetent ist), kein Fytch... (er ist einfach verschwunden)</p>
<p>Es kommt mir vor als ob ich die ganze Zeit mit mir selbst rede hier im Forum... (wie bei Home Alone)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2552141</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2552141</guid><dc:creator><![CDATA[t0ky0lambda]]></dc:creator><pubDate>Thu, 01 Mar 2018 17:39:26 GMT</pubDate></item><item><title><![CDATA[Reply to [OpenGL 3.3] Bug vmtl. bei den Buffern on Tue, 06 Mar 2018 11:08:05 GMT]]></title><description><![CDATA[<p>Niemand will mein Zeug debuggen... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2552412</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2552412</guid><dc:creator><![CDATA[t0ky0lambda]]></dc:creator><pubDate>Tue, 06 Mar 2018 11:08:05 GMT</pubDate></item></channel></rss>