<?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[Frage bezüglich Vertexbuffer]]></title><description><![CDATA[<p>Moin erstmal,</p>
<p>also um es vorweg zu nehmen ich bin was Graphicprogrammierung mit DirectX9 angeht ein blutiger Anfänger.</p>
<p>erstmal ein Codeausschnitt</p>
<pre><code>#define CUSTOMFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)

struct CUSTOMVERTEX
{
    FLOAT x, y, z, rhw;    // from the D3DFVF_XYZRHW flag
    DWORD color;    // from the D3DFVF_DIFFUSE flag
};

LPDIRECT3DVERTEXBUFFER9 t_buffer =NULL;

void init_graphics()
{
    // create three vertices using the CUSTOMVERTEX struct built earlier
    CUSTOMVERTEX t_vert[] =
    {
        { 320.0f, 50.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), },
        { 520.0f, 400.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 255, 0), },
        { 120.0f, 400.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
    };

    // create the vertex and store the pointer into t_buffer, which is created globally
    d3ddev-&gt;CreateVertexBuffer(3*sizeof(CUSTOMVERTEX),
                               0,
                               CUSTOMFVF,
                               D3DPOOL_MANAGED,
                               &amp;t_buffer,
                               NULL);
    //--------------------------
    VOID* pVoid;    // die folgenden 2 Zeilen verstehe ich nicht richtig

    t_buffer-&gt;Lock(0, 0, (void**)&amp;pVoid, 0);    // lock the vertex buffer
    memcpy(pVoid, t_vert, sizeof(t_vert));    // copy the vertices to the locked buffer
    t_buffer-&gt;Unlock();    // unlock the vertex buffer

    return;
}
</code></pre>
<p>Also dieser Code ist einem Tutorial entnommen.</p>
<p>Ich verstehe allerdings diese Void-Pointer Sache nicht so richtig.</p>
<pre><code>VOID* pVoid;
</code></pre>
<p>hier wird ein Void-Pointer deklariert, jedoch ohne Initialisierung</p>
<p>Wie kann dann in folgender Zeile &amp;pVoid stehen?</p>
<pre><code>t_buffer-&gt;Lock(0, 0, (void**)&amp;pVoid, 0);
</code></pre>
<p>Ich verstehe &quot;(void**)&amp;pVoid&quot; nicht.</p>
<p>Für ne kurze erklärung wäre ich sehr dankbar.</p>
<p>Mit freundlichen Grüßen</p>
<p>Don Quijote</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/222495/frage-bezüglich-vertexbuffer</link><generator>RSS for Node</generator><lastBuildDate>Mon, 05 Oct 2026 02:54:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/222495.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 13 Sep 2008 13:21:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Frage bezüglich Vertexbuffer on Sat, 13 Sep 2008 13:21:09 GMT]]></title><description><![CDATA[<p>Moin erstmal,</p>
<p>also um es vorweg zu nehmen ich bin was Graphicprogrammierung mit DirectX9 angeht ein blutiger Anfänger.</p>
<p>erstmal ein Codeausschnitt</p>
<pre><code>#define CUSTOMFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)

struct CUSTOMVERTEX
{
    FLOAT x, y, z, rhw;    // from the D3DFVF_XYZRHW flag
    DWORD color;    // from the D3DFVF_DIFFUSE flag
};

LPDIRECT3DVERTEXBUFFER9 t_buffer =NULL;

void init_graphics()
{
    // create three vertices using the CUSTOMVERTEX struct built earlier
    CUSTOMVERTEX t_vert[] =
    {
        { 320.0f, 50.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), },
        { 520.0f, 400.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 255, 0), },
        { 120.0f, 400.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
    };

    // create the vertex and store the pointer into t_buffer, which is created globally
    d3ddev-&gt;CreateVertexBuffer(3*sizeof(CUSTOMVERTEX),
                               0,
                               CUSTOMFVF,
                               D3DPOOL_MANAGED,
                               &amp;t_buffer,
                               NULL);
    //--------------------------
    VOID* pVoid;    // die folgenden 2 Zeilen verstehe ich nicht richtig

    t_buffer-&gt;Lock(0, 0, (void**)&amp;pVoid, 0);    // lock the vertex buffer
    memcpy(pVoid, t_vert, sizeof(t_vert));    // copy the vertices to the locked buffer
    t_buffer-&gt;Unlock();    // unlock the vertex buffer

    return;
}
</code></pre>
<p>Also dieser Code ist einem Tutorial entnommen.</p>
<p>Ich verstehe allerdings diese Void-Pointer Sache nicht so richtig.</p>
<pre><code>VOID* pVoid;
</code></pre>
<p>hier wird ein Void-Pointer deklariert, jedoch ohne Initialisierung</p>
<p>Wie kann dann in folgender Zeile &amp;pVoid stehen?</p>
<pre><code>t_buffer-&gt;Lock(0, 0, (void**)&amp;pVoid, 0);
</code></pre>
<p>Ich verstehe &quot;(void**)&amp;pVoid&quot; nicht.</p>
<p>Für ne kurze erklärung wäre ich sehr dankbar.</p>
<p>Mit freundlichen Grüßen</p>
<p>Don Quijote</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1581333</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1581333</guid><dc:creator><![CDATA[Don Quijote]]></dc:creator><pubDate>Sat, 13 Sep 2008 13:21:09 GMT</pubDate></item><item><title><![CDATA[Reply to Frage bezüglich Vertexbuffer on Sat, 13 Sep 2008 15:14:07 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-5577.html" rel="nofollow">rapso</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-7.html" rel="nofollow">Spiele-/Grafikprogrammierung</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-15.html" rel="nofollow">C++</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1581371</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1581371</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Sat, 13 Sep 2008 15:14:07 GMT</pubDate></item><item><title><![CDATA[Reply to Frage bezüglich Vertexbuffer on Sat, 13 Sep 2008 15:23:23 GMT]]></title><description><![CDATA[<p>Ein Zeiger ist nichts anderes als ein Speicherbereich, welcher die Adresse speichert. Auf einem 32-Bit System ist ein Zeiger daher 4 Bytes gross und auf einem 64-Bit System 8 Bytes. Somit kann man aber auch einen Zeiger auf den Speicherbereich eines Zeigers bekommen. Also einen Zeiger auf einen Zeiger:</p>
<pre><code class="language-cpp">void* // ist ein Zeiger auf void (nichts, deshalb sollte man auch void-Zeiger meiden, eigentlich :) )
void** // Ist ein Zeiger auf einen void-Zeiger
</code></pre>
<p>Bei der DX-Funktion übergibt man also die Adresse zu einem Zeiger. In der Funktion wird dann dieser Zeiger auf einen Zeiger dereferenziert und einen Zeiger zugewiesen. Ist das verständlich? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Am einfachsten geht es eigentlich, wenn man den Zeiger einfach auch als ein Objekt im Speicher sieht. Auf ein Objekt im Speicher kann man auch immer eine Adresse holen. Und Adressen speichert man in Zeigern, welche wiederum Objekte im Speicher sind <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1581375</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1581375</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Sat, 13 Sep 2008 15:23:23 GMT</pubDate></item></channel></rss>