Reputation: 3336
I've created a window using Win32 in an OpenGL 3.2+ program and I'm experimenting with things.
Currently I'm using the reshape()
function below to resize the window etc.
I've added a border within the viewport so it leaves a 50px border around the viewport which does what I was expecting.
void reshape(int width, int height, int pers_Dist)
{
screenWidth = width;
screenHeight = height;
float border = 50;
glViewport(0+border,0+border,width-(border*2),height-(border*2));
MatrixRoutines<float>::perspective(pers_Dist, (GLfloat)screenWidth/(GLfloat)screenHeight, 1, 200, ProjectionMatrix);
}
The background colour is set inside the init()
function using: glClearColor(0.0,0.0,0.0,0.0);
, to black.
My question is, can the border be assigned a different colour to the background? (if I change the colour, both the background and border are always the colour set).
Upvotes: 1
Views: 999
Reputation: 52084
Use scissor regions to tell OpenGL where to clear:
glDisable( GL_SCISSOR_TEST )
glEnable( GL_SCISSOR_TEST )
Upvotes: 1