<?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 zum OpenGl FAQ]]></title><description><![CDATA[<p>Ich habe mir nun mal den FAQ Beitrag zum Builder mit OpenGl angeschaut.<br />
Nun wollte ich das mal ausprobieren,aber bekomme zig Errors.</p>
<p>[C++ Error] Unit1.h(30): E2303 Type name expected<br />
[C++ Error] Unit1.h(30): E2139 Declaration missing ;<br />
[C++ Error] Unit1.cpp(18): E2268 Call to undefined function '_control87'<br />
[C++ Error] Unit1.cpp(18): E2451 Undefined symbol 'MCW_EM'<br />
[C++ Error] Unit1.cpp(39): E2268 Call to undefined function 'SetupRC'<br />
[C++ Error] Unit1.cpp(43): E2316 '_fastcall TForm1::SetupRC()' is not a member of 'TForm1'</p>
<p>Den Sourcecode habe ich hier:</p>
<pre><code class="language-cpp">//die unit.h
#include &lt;vcl.h&gt;
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
#include &lt;gl/gl.h&gt; 
#include &lt;gl/glu.h&gt;
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
void __fastcall FormCreate(TObject *Sender); 
    void __fastcall FormDestroy(TObject *Sender); 
    void __fastcall FormResize(TObject *Sender);
    void __fastcall FormPaint(TObject *Sender); 

private:	// User declarations
HDC hdc; 
    HGLRC hrc;
    int PixelFormat;

public:		// User declarations

    fastcall TForm1(TComponent* Owner);
    void __fastcall IdleLoop(TObject*, bool&amp;);
    void __fastcall RenderGLScene(); 
    void __fastcall SetPixelFormatDescriptor();

        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

//die cpp
//---------------------------------------------------------------------------
//--------------------------------------------------------------------------- 

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) 
    : TForm(Owner) 
{ 
    Application-&gt;OnIdle = IdleLoop;
    _control87(MCW_EM, MCW_EM);
}
//--------------------------------------------------------------------------- 
void __fastcall TForm1::IdleLoop(TObject*, bool&amp; done) 
{ 
     done = false; 
     RenderGLScene(); 
     SwapBuffers(hdc); 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::RenderGLScene() 
{ 
     //Place your OpenGL drawing code here 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::FormCreate(TObject *Sender) 
{ 
    hdc = GetDC(Handle); 
    SetPixelFormatDescriptor(); 
    hrc = wglCreateContext(hdc); 
    wglMakeCurrent(hdc, hrc); 
    SetupRC();
}
//--------------------------------------------------------------------------- 
void __fastcall TForm1::SetupRC() 
{ 
    glClearColor(1.0f, 1.0f, 1.0f, 1.0f); 
    glClear(GL_COLOR_BUFFER_BIT); 
    glFlush(); 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::FormDestroy(TObject *Sender) 
{ 
    ReleaseDC(hdc);
    wglMakeCurrent(hdc, NULL); 
    wglDeleteContext(hrc); 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::SetPixelFormatDescriptor() 
{ 
    PIXELFORMATDESCRIPTOR pfd = { 
        sizeof(PIXELFORMATDESCRIPTOR), 
        1, 
        PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, 
        PFD_TYPE_RGBA, 
        24, 
        0,0,0,0,0,0, 
        0,0, 
        0,0,0,0,0, 
        32, 
        0, 
        0, 
        PFD_MAIN_PLANE, 
        0, 
        0,0,0 
        }; 
    PixelFormat = ChoosePixelFormat(hdc, &amp;pfd); 
    SetPixelFormat(hdc, PixelFormat, &amp;pfd); 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::FormResize(TObject *Sender) 
{ 
    GLfloat nRange = 200.0f; 
    glViewport(0, 0, ClientWidth, ClientHeight); 
    glMatrixMode(GL_PROJECTION); 
    glLoadIdentity(); 

    if (ClientWidth &lt;= ClientHeight) 
       glOrtho(-nRange, nRange, -nRange*ClientHeight/ClientWidth, 
                nRange*ClientHeight/ClientWidth, -nRange, nRange); 
    else 
       glOrtho(-nRange*ClientWidth/ClientHeight, nRange*ClientWidth/ClientHeight, 
                -nRange, nRange, -nRange, nRange); 

    glMatrixMode(GL_MODELVIEW); 
    glLoadIdentity(); 
} 
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
</code></pre>
<p>Ich benutze den BCB 5 Enterprise.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/85422/frage-zum-opengl-faq</link><generator>RSS for Node</generator><lastBuildDate>Fri, 03 Jul 2026 04:29:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/85422.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 08 Sep 2004 17:24:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Wed, 08 Sep 2004 17:24:30 GMT]]></title><description><![CDATA[<p>Ich habe mir nun mal den FAQ Beitrag zum Builder mit OpenGl angeschaut.<br />
Nun wollte ich das mal ausprobieren,aber bekomme zig Errors.</p>
<p>[C++ Error] Unit1.h(30): E2303 Type name expected<br />
[C++ Error] Unit1.h(30): E2139 Declaration missing ;<br />
[C++ Error] Unit1.cpp(18): E2268 Call to undefined function '_control87'<br />
[C++ Error] Unit1.cpp(18): E2451 Undefined symbol 'MCW_EM'<br />
[C++ Error] Unit1.cpp(39): E2268 Call to undefined function 'SetupRC'<br />
[C++ Error] Unit1.cpp(43): E2316 '_fastcall TForm1::SetupRC()' is not a member of 'TForm1'</p>
<p>Den Sourcecode habe ich hier:</p>
<pre><code class="language-cpp">//die unit.h
#include &lt;vcl.h&gt;
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
#include &lt;gl/gl.h&gt; 
#include &lt;gl/glu.h&gt;
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
void __fastcall FormCreate(TObject *Sender); 
    void __fastcall FormDestroy(TObject *Sender); 
    void __fastcall FormResize(TObject *Sender);
    void __fastcall FormPaint(TObject *Sender); 

private:	// User declarations
HDC hdc; 
    HGLRC hrc;
    int PixelFormat;

public:		// User declarations

    fastcall TForm1(TComponent* Owner);
    void __fastcall IdleLoop(TObject*, bool&amp;);
    void __fastcall RenderGLScene(); 
    void __fastcall SetPixelFormatDescriptor();

        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

//die cpp
//---------------------------------------------------------------------------
//--------------------------------------------------------------------------- 

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) 
    : TForm(Owner) 
{ 
    Application-&gt;OnIdle = IdleLoop;
    _control87(MCW_EM, MCW_EM);
}
//--------------------------------------------------------------------------- 
void __fastcall TForm1::IdleLoop(TObject*, bool&amp; done) 
{ 
     done = false; 
     RenderGLScene(); 
     SwapBuffers(hdc); 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::RenderGLScene() 
{ 
     //Place your OpenGL drawing code here 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::FormCreate(TObject *Sender) 
{ 
    hdc = GetDC(Handle); 
    SetPixelFormatDescriptor(); 
    hrc = wglCreateContext(hdc); 
    wglMakeCurrent(hdc, hrc); 
    SetupRC();
}
//--------------------------------------------------------------------------- 
void __fastcall TForm1::SetupRC() 
{ 
    glClearColor(1.0f, 1.0f, 1.0f, 1.0f); 
    glClear(GL_COLOR_BUFFER_BIT); 
    glFlush(); 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::FormDestroy(TObject *Sender) 
{ 
    ReleaseDC(hdc);
    wglMakeCurrent(hdc, NULL); 
    wglDeleteContext(hrc); 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::SetPixelFormatDescriptor() 
{ 
    PIXELFORMATDESCRIPTOR pfd = { 
        sizeof(PIXELFORMATDESCRIPTOR), 
        1, 
        PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, 
        PFD_TYPE_RGBA, 
        24, 
        0,0,0,0,0,0, 
        0,0, 
        0,0,0,0,0, 
        32, 
        0, 
        0, 
        PFD_MAIN_PLANE, 
        0, 
        0,0,0 
        }; 
    PixelFormat = ChoosePixelFormat(hdc, &amp;pfd); 
    SetPixelFormat(hdc, PixelFormat, &amp;pfd); 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::FormResize(TObject *Sender) 
{ 
    GLfloat nRange = 200.0f; 
    glViewport(0, 0, ClientWidth, ClientHeight); 
    glMatrixMode(GL_PROJECTION); 
    glLoadIdentity(); 

    if (ClientWidth &lt;= ClientHeight) 
       glOrtho(-nRange, nRange, -nRange*ClientHeight/ClientWidth, 
                nRange*ClientHeight/ClientWidth, -nRange, nRange); 
    else 
       glOrtho(-nRange*ClientWidth/ClientHeight, nRange*ClientWidth/ClientHeight, 
                -nRange, nRange, -nRange, nRange); 

    glMatrixMode(GL_MODELVIEW); 
    glLoadIdentity(); 
} 
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
</code></pre>
<p>Ich benutze den BCB 5 Enterprise.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/602689</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/602689</guid><dc:creator><![CDATA[the_hero99]]></dc:creator><pubDate>Wed, 08 Sep 2004 17:24:30 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Wed, 08 Sep 2004 17:27:59 GMT]]></title><description><![CDATA[<p>Also, du hast vergessen in der Unit1.cpp die float.h zu inkludieren. Dann hast du von SetupRC keine Deklaration in der Header-Datei. Damit dürften die meisten Fehler schon mal behoben sein <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>
]]></description><link>https://www.c-plusplus.net/forum/post/602690</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/602690</guid><dc:creator><![CDATA[PuppetMaster2k]]></dc:creator><pubDate>Wed, 08 Sep 2004 17:27:59 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Wed, 08 Sep 2004 17:42:35 GMT]]></title><description><![CDATA[<p>[C++ Error] Unit1.h(30): E2303 Type name expected<br />
[C++ Error] Unit1.h(30): E2139 Declaration missing ;<br />
[C++ Error] Unit1.cpp(52): E2193 Too few parameters in call to '__stdcall ReleaseDC(void *,void *)'</p>
<p>bleiben über.<br />
hast du noch ne Idee?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/602712</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/602712</guid><dc:creator><![CDATA[the_hero99]]></dc:creator><pubDate>Wed, 08 Sep 2004 17:42:35 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Wed, 08 Sep 2004 17:49:39 GMT]]></title><description><![CDATA[<p>Wie wärs wenn du den Zeilen mal folgst und guckst was da falsch ist? Überleg mal ganz genau was in Zeile 30 in der Header-Datei falsch ist! Ich geb dir nen Tip, sieh dir fastcall an <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>Edit:<br />
ReleaseDC() kannst du dir zur Not auch noch in der Hilfe ansehen oder in der MSDN im Netz. Dann weißt du auch was da noch fehlt.</p>
<p>P.S. Der Link aus dem FAQ-Beitrag für OpenGL klappt funktioniert nicht bzw. die URL ist falsch. Folgende URL wird bei mir auf gerufen <a href="http://www.c-plusplus.net/forum/topic,39422.html" rel="nofollow">http://www.c-plusplus.net/forum/topic,39422.html</a> es sollte aber <a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39422.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic.php?t=39422.html</a> heißen <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>
]]></description><link>https://www.c-plusplus.net/forum/post/602715</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/602715</guid><dc:creator><![CDATA[PuppetMaster2k]]></dc:creator><pubDate>Wed, 08 Sep 2004 17:49:39 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Wed, 08 Sep 2004 20:33:16 GMT]]></title><description><![CDATA[<p>Der will ein hWnd nur sowas habe ich ja nirgends.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/602836</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/602836</guid><dc:creator><![CDATA[the_hero99]]></dc:creator><pubDate>Wed, 08 Sep 2004 20:33:16 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Wed, 08 Sep 2004 20:51:31 GMT]]></title><description><![CDATA[<p>Doch hast du. Form1-&gt;Handle</p>
]]></description><link>https://www.c-plusplus.net/forum/post/602847</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/602847</guid><dc:creator><![CDATA[PuppetMaster2k]]></dc:creator><pubDate>Wed, 08 Sep 2004 20:51:31 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Wed, 08 Sep 2004 20:54:44 GMT]]></title><description><![CDATA[<p>[Linker Error] Unresolved external '__fastcall TForm1::FormPaint(System::TObject *)' referenced from D:\PROGRAMMIEREN\C++_PROGRESS\GRAPHIC\UNIT1.OBJ</p>
<p>Was will der jetzt?</p>
<p>und was muss alles bei den opengl drawcode alles rein?</p>
<p>Nur die Opengl Befehle?</p>
<p>glTranslatef(-2.0f,0.0f,-6.0f);</p>
<p>glBegin(GL_TRIANGLES); // Ein Dreieck soll gezeichnet werden<br />
glColor3f(0.0f,0.0f,1.0f); // es soll soll blau werden<br />
glVertex3f( 0.0f, 1.0f, 0.0f); // Die obere Ecke des Dreiecks<br />
glVertex3f(-1.0f,-1.0f, 0.0f); // unten links<br />
glVertex3f( 1.0f,-1.0f, 0.0f); // unten rechts<br />
glEnd();</p>
<p>oder noch alle glLoadidenty etc?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/602855</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/602855</guid><dc:creator><![CDATA[the_hero99]]></dc:creator><pubDate>Wed, 08 Sep 2004 20:54:44 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Thu, 09 Sep 2004 06:33:33 GMT]]></title><description><![CDATA[<p>Zu dem Linker Error siehe FAQ. Zu deiner anderen Frage: Probieren geht über studieren!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/602926</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/602926</guid><dc:creator><![CDATA[PuppetMaster2k]]></dc:creator><pubDate>Thu, 09 Sep 2004 06:33:33 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Thu, 09 Sep 2004 08:30:27 GMT]]></title><description><![CDATA[<p>Puppetmaster: stellvertretend für Hero vielen Dank fürs Händchenhalten!<br />
Hero: viel Erfolg beim ausprobieren und lernen, du bist auf dem richtigen Weg.</p>
<p>Gegen deine Fragen zu OpenGL empfehle ich die Tutorials von NeHe, die sind web-weit bekannt und auch ausreichend.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/603005</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/603005</guid><dc:creator><![CDATA[Dominatissimo]]></dc:creator><pubDate>Thu, 09 Sep 2004 08:30:27 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Thu, 09 Sep 2004 08:51:36 GMT]]></title><description><![CDATA[<p>und wenn man nicht so gut englisch kann sollte man sich die <a href="http://www.codeworx.org/opengl_tuts.php" rel="nofollow">deutsche übersetzung</a> angucken.</p>
<p>ps.: ich dachte ich hätte den link hier irgendwo im forum gefunden weis aber net mehr wo <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>pps.: die kommentare in deinem post sehen stark nach diesem tutorial aus <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>
]]></description><link>https://www.c-plusplus.net/forum/post/603021</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/603021</guid><dc:creator><![CDATA[Beliah]]></dc:creator><pubDate>Thu, 09 Sep 2004 08:51:36 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Thu, 09 Sep 2004 12:53:00 GMT]]></title><description><![CDATA[<p>Ja ich habe die deutsche Version von Neon Helium oder wie der heisst gefunden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/603291</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/603291</guid><dc:creator><![CDATA[the_hero99]]></dc:creator><pubDate>Thu, 09 Sep 2004 12:53:00 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Thu, 09 Sep 2004 13:08:10 GMT]]></title><description><![CDATA[<p>Also ich habe in die FAQ geguckt und gesucht, und nur ein passenden Beitrag gefunden. Nur ich weiss nicht was das jetzt bringen sollte die Libs und headers sind extra BCB kompatible(aus den Netz gedownloaded).</p>
<p>Die *.h habe ich in den Standard Include Verzeichnis gepackt,die Libs in ein extra Ordner den Ordner in Projectoptions unter Bedingung bei den Libs angegeben.</p>
<p>Nur der Linker macht nachwievor Stress.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/603307</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/603307</guid><dc:creator><![CDATA[the_hero99]]></dc:creator><pubDate>Thu, 09 Sep 2004 13:08:10 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Thu, 09 Sep 2004 13:27:23 GMT]]></title><description><![CDATA[<p>Mal ne Frage: Hast du die Methode FormPaint einfach aus dem Beitrag kopiert oder hast du sie über den Objectinspector (per Doppelklick) erstellt? Letzteres sollte dein Problem denke ich lösen. Vorher noch schnell die *.obj und *.tds löschen und neu kompilieren.</p>
<p>Edit: Rechtschreibung... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/603341</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/603341</guid><dc:creator><![CDATA[PuppetMaster2k]]></dc:creator><pubDate>Thu, 09 Sep 2004 13:27:23 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Thu, 09 Sep 2004 13:44:37 GMT]]></title><description><![CDATA[<p>Na super. Nun habe ich es endlich kompilieren und linken können,habe auch den Draw Code paar Beiträge vorher, reingeschrieben und was geht?</p>
<p>Nix Bild bleibt grau.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/603374</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/603374</guid><dc:creator><![CDATA[the_hero99]]></dc:creator><pubDate>Thu, 09 Sep 2004 13:44:37 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Thu, 09 Sep 2004 15:13:06 GMT]]></title><description><![CDATA[<p>Dann versuch mal Folgendes in der Zeichen-Routine:</p>
<pre><code class="language-cpp">glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
	glLoadIdentity();

	glBegin( GL_TRIANGLES ); // Ein Dreieck soll gezeichnet werden

		glColor3f( 0.0f,0.0f,1.0f ); // es soll soll blau werden
		glVertex3f(  0.0f,  1.0f, 0.0f ); // Die obere Ecke des Dreiecks
		glVertex3f( -1.0f, -1.0f, 0.0f ); // unten links
		glVertex3f(  1.0f, -1.0f, 0.0f ); // unten rechts

	glEnd();
	glFinish();

	glFlush();
	SwapBuffers( g_Win.GetHDC() );
</code></pre>
<p>MfG Aoeke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/603490</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/603490</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Thu, 09 Sep 2004 15:13:06 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Thu, 09 Sep 2004 18:22:19 GMT]]></title><description><![CDATA[<p>Es kommt wieder nothing an Pics.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/603609</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/603609</guid><dc:creator><![CDATA[the_hero99]]></dc:creator><pubDate>Thu, 09 Sep 2004 18:22:19 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zum OpenGl FAQ on Thu, 09 Sep 2004 19:32:13 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>Versuchs mal mit dieser Version, ich hab sie ein bischen umgemodelt. Ein Teil der Methoden waren nicht nötig. Zusätzlich hab ich eine Methoe hinzugefügt die ein Koordinatensystem zeichnet, um zu testen ob es funktioniert. <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>Vielleicht kann man den FAQ-Beitrag ja dahingehend anpassen? (Getestet auf BCB 5 Prof. und BCB 6 Enterprise)</p>
<p><strong>Form1.h</strong></p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#ifndef frmOpenglH
#define frmOpenglH
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
#include &lt;gl/gl.h&gt;
#include &lt;gl/glu.h&gt;
#include &lt;gl/glaux.h&gt;

//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
	void __fastcall FormCreate(TObject *Sender);
	void __fastcall FormDestroy(TObject *Sender);
	void __fastcall FormPaint(TObject *Sender);
	void __fastcall FormResize(TObject *Sender);

private:	// User declarations
	HDC dc;
	HGLRC GLContext;
	HDC InitOpenGL(HWND Handle);

public:		// User declarations
	__fastcall TForm1(TComponent* Owner);
	void drawScene (void);
	void CoordinateSystem(GLdouble x, GLdouble y, GLdouble z);

};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
// ein paar Farben
const GLfloat colRed[]	= {1, 0, 0},
	colGreen[]     = {0, 1, 0},
	colBlue[]      = {0, 0, 1},
	colYellow[]    = {1, 1, 0},
	colDarkGray[]  = {0.2, 0.2, 0.2},
	colGray[]      = {0.5, 0.5, 0.5},
	colLightGray[] = {0.8, 0.8, 0.8},
	colBlack[]     = {0, 0, 0};
</code></pre>
<p><strong>Form1.cpp</strong></p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &lt;float.h&gt; //für _control87()
#include &quot;Form1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
	// Floatingpointeinheit initialisieren
	_control87(MCW_EM, MCW_EM);
}
//---------------------------------------------------------------------------
// OpenGl Devicekontext initialisieren
HDC TForm1::InitOpenGL(HWND Handle)
{
    PIXELFORMATDESCRIPTOR pfd;

    memset(&amp;pfd, 0, sizeof(pfd));

    pfd.nSize      = sizeof(PIXELFORMATDESCRIPTOR);
    pfd.nVersion   = 1; // Versionsnummer, 1 notwendig

    pfd.dwFlags    = PFD_DRAW_TO_WINDOW | // Zeichne in ein Fenster
		             PFD_SUPPORT_OPENGL;  // OpenGL anstelle von GDI

    pfd.dwFlags   |= PFD_DOUBLEBUFFER; // flag setzen

    pfd.iPixelType = PFD_TYPE_RGBA; // RGBA Pixel
    pfd.cColorBits = 24; // Farbtiefe 24 Bit
    pfd.cDepthBits = 32; // Tiefenpuffer 32 Bits
    pfd.iLayerType = PFD_MAIN_PLANE; // Einzige Möglichkeit

    HDC dc  = GetDC(Handle);
    int iPF = ChoosePixelFormat(dc, &amp;pfd);

    if (iPF == 0)
        ShowMessage(&quot;Fehler bei ChoosePixelFormat&quot;);

    SetPixelFormat(dc, iPF, &amp;pfd);
    GLContext = wglCreateContext(dc);

    if (GLContext)
        wglMakeCurrent(dc, GLContext);
    else
        ShowMessage(&quot;wglMakeCurrent nicht erfolgreich&quot;);

    return dc;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
    dc = InitOpenGL(Handle);
    glEnable(GL_DEPTH_TEST);
    //Hintergrundfarbe setzen (weis)
    glClearColor(1, 1, 1, 1);

    glMatrixMode(GL_MODELVIEW);

    //Auf Z-Achse um 4 nach hinten verschieben
    glTranslated(0, 0, -4);
    glLineWidth(1);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
    ReleaseDC(Handle,dc);
    wglMakeCurrent(dc, NULL);
    wglDeleteContext(GLContext);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormPaint(TObject *Sender)
{
    FormResize(Sender);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormResize(TObject *Sender)
{
    glViewport(0, 0, ClientWidth, ClientHeight);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    GLdouble aspect =(double)ClientWidth/ClientHeight;
    gluPerspective(60, aspect, 0.1, 100);

    glMatrixMode(GL_MODELVIEW);
    drawScene();
}
// Koordinatensystem zeichnen
void TForm1::CoordinateSystem(GLdouble x, GLdouble y, GLdouble z)
{
    glBegin(GL_LINES);
        glColor3fv(colRed);
        glVertex3d(-x, 0, 0);
        glVertex3d(x, 0, 0);
        glColor3fv(colGreen);
        glVertex3d(0, -y, 0);
        glVertex3d(0, y, 0);
        glColor3fv(colBlue);
        glVertex3d(0, 0, z);
        glVertex3d(0, 0, -z);
    glEnd();

    double h=0.05;

    glBegin(GL_TRIANGLES); // Pfeil am Ende der X-Achse
        glColor3fv(colRed);
        glVertex3d(x-h, h, 0);
        glVertex3d(x, 0, 0);
        glVertex3d(x-h, -h, 0);
    glEnd();

    glBegin(GL_TRIANGLES); // Pfeil am Ende der Y-Achse
        glColor3fv(colGreen);
        glVertex3d(+h, y-h, 0);
        glVertex3d(0, y, 0);
        glVertex3d(-h, y-h, 0);
    glEnd();

    glBegin(GL_TRIANGLES); // Pfeil am Ende der Z-Achse
        glColor3fv(colBlue);
        glVertex3d(0, +h, z-h);
        glVertex3d(0, 0, z);
        glVertex3d(0, -h, z-h);
    glEnd();
}

// Szene zeichnen
void TForm1::drawScene (void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    //Koordinatensystem zeichnen
    CoordinateSystem(1.0, 1.0, 1.0);

    SwapBuffers(dc);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/603649</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/603649</guid><dc:creator><![CDATA[PuppetMaster2k]]></dc:creator><pubDate>Thu, 09 Sep 2004 19:32:13 GMT</pubDate></item></channel></rss>