GLForm(borland builderを使用したopenGL)のDraw()関数では、最初に、capture_card :: paintGL()と呼ばれるSDK関数を使用して画像を描画します。そして、この関数は、呼び出される前にこの射影を持つことを強制します:
glViewport(0, 0, (GLsizei)newSize.width, (GLsizei)newSize.height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
そして、このペイントされた画像の前景に、別のビューポートと別のグロルト投影用にすでにコード化されている別のレイヤーを描画する必要があります。
(「onResize」イベントで呼び出されるMainResizeGL()内):
glViewport(-width, -height, width * 2, height * 2);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(double(-width)*viewport_ratio, double(width)*viewport_ratio, double(-height), double(height), 1000.0, 100000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
(および「Ontimer」によって呼び出されるMainDraw()内):
glLoadIdentity();
glTranslatef(0.0, 0.0, -50000.0);
mpGLDrawScene->DrawScene(); //(this calls a doDrawScene() I don't understand exactly how it draws : with calling this->parent, etc.)
glFlush();
SwapBuffers(ghDC);
そこで、MainDraw()を次のように変換しました。
// viewport and projection needed for the paintGL
glViewport(0, 0, (GLsizei)newSize.width, (GLsizei)newSize.height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
// call of the paintGL
if(capture_button_clicked) capture_card::paintGL();
// content of the ResizeGL in order to get back to the projection desired and to matrixmode modelview
glViewport(-width, -height, width * 2, height * 2);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(double(-width)*viewport_ratio, double(width)*viewport_ratio, double(-height), double(height), 1000.0, 100000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// original drawscene call
glLoadIdentity();
glTranslatef(0.0, 0.0, -50000.0);
mpGLDrawScene->DrawScene(); //(this calls a doDrawScene() I don't understand exactly how it draws : with calling this->parent, etc.)
glFlush();
SwapBuffers(ghDC);
その結果、古いプロジェクトの「drawscene」アイテムが表示されますが、「capture_button」をクリックすると、paintGLは非表示のままになり、描画されたアイテムはアルファチャネルcanvaのようなものに変わります。
paintGLの後にglScalef(width、height、1)を追加しようとしましたが、glTranslatef(0,0,50000)を変更した結果、paintGLの色で少量のピクセルが表示されましたが、オーバーレイアイテムが表示されなくなりました。 。
これらの2つの異なるビューポートを重ね合わせるにはどうすればよいですか(つまり、paintGLの上のドローシーン)?
よろしくお願いします、アルノー。