#include <assert.h>
#include "miniglut.h"
#include "app.h"
+#include "rtk.h"
#include "logger.h"
static void display(void);
static PROC wgl_swap_interval_ext;
#endif
+static rtk_rect rband;
int main(int argc, char **argv)
void app_redisplay(int x, int y, int w, int h)
{
- dbgmsg("fakeupd: %d,%d (%dx%d)\n", x, y, w, h);
+ /*dbgmsg("fakeupd: %d,%d (%dx%d)\n", x, y, w, h);*/
glutPostRedisplay();
}
void app_swap_buffers(void)
{
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
glRasterPos2i(-1, 1);
glPixelZoom(1, -1);
glDrawPixels(win_width, win_height, GL_BGRA, GL_UNSIGNED_BYTE, framebuf);
glDisable(GL_ALPHA_TEST);
- glMatrixMode(GL_PROJECTION);
+ if(rband.width | rband.height) {
+ glOrtho(0, win_width, win_height, 0, -1, 1);
+
+ glPushAttrib(GL_ENABLE_BIT);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_LIGHTING);
+
+ glEnable(GL_COLOR_LOGIC_OP);
+ glLogicOp(GL_XOR);
+
+ glBegin(GL_LINE_LOOP);
+ glColor3f(1, 1, 1);
+ glVertex2f(rband.x, rband.y);
+ glVertex2f(rband.x + rband.width, rband.y);
+ glVertex2f(rband.x + rband.width, rband.y + rband.height);
+ glVertex2f(rband.x, rband.y + rband.height);
+ glEnd();
+
+ glPopAttrib();
+ }
+
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
}
#endif
+void app_rband(int x, int y, int w, int h)
+{
+ rband.x = x;
+ rband.y = y;
+ rband.width = w;
+ rband.height = h;
+
+ glutPostRedisplay();
+}
+
static void display(void)
{