#include "opencsgConfig.h"
#include "openglExt.h"
#include "openglHelper.h"
namespace OpenCSG {
namespace OpenGL {
GLfloat projection[16];
GLfloat modelview[16];
GLint canvasPos[4];
GLint stencilBits = 0;
unsigned int stencilMax = 0;
unsigned int stencilMask = 0;
GLint scissorPos[4];
void scissor(const PCArea& area) {
const int dx = area.maxx - area.minx;
const int dy = area.maxy - area.miny;
glScissor(area.minx, area.miny, dx, dy);
glEnable(GL_SCISSOR_TEST);
}
void drawQuad() {
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
const GLfloat v[8] = {
-1.0f, -1.0f,
1.0f, -1.0f,
-1.0f, 1.0f,
1.0f, 1.0f
};
GLboolean origVertexArrayState = glIsEnabled(GL_VERTEX_ARRAY);
if (!origVertexArrayState) {
glEnableClientState(GL_VERTEX_ARRAY);
}
glVertexPointer(2, GL_FLOAT, 0, v);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
if (!origVertexArrayState) {
glDisableClientState(GL_VERTEX_ARRAY);
}
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}
}
}