// Start Rendering into the plugin window
window->setContextToWindow();
glViewport(0,0, config->getWidth(), config->getHeight() );
glEnable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
glClearColor( 0.5f, 0.5f, 0.5f, 0.0f );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-1.0f,1.0f,-1.0f,1.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glBindTexture(GL_TEXTURE_2D, textureIndex_);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glPushMatrix();
glBegin( GL_QUADS );
//glColor3f(1.0f,1.0f,1.0f);
glTexCoord2d(0.0f, 0.0f);glVertex2f( -1.0f, -1.0f );
glTexCoord2d(1.0f, 0.0f);glVertex2f( 1.0f, -1.0f );
glTexCoord2d(1.0f, 1.0f);glVertex2f( 1.0f, 1.0f );
glTexCoord2d(0.0f, 1.0f);glVertex2f( -1.0f, 1.0f );
glEnd();
glPopMatrix();
if (!SwapBuffers( window->getHdc() ))
{
int error = GetLastError();
cout << "Cant swap buff: " << error << endl;
}
// Continue rendering into the Unity Editor
window->setContextToExtern();