3 #include "SDL_opengl.h"
10 static bool debug_output_done = false;
11 if (!debug_output_done)
13 Debug("Bounds are %s", m_bounds.Str().c_str());
14 Debug("Objects are:");
15 for (unsigned id = 0; id < m_document.ObjectCount(); ++id)
17 Debug("%u\t%s", id, m_document.m_objects.bounds[id].Str().c_str());
19 debug_output_done = true;
22 glClearColor(1.f,1.f,1.f,1.f);
23 glClear(GL_COLOR_BUFFER_BIT);
25 glMatrixMode(GL_PROJECTION);
27 glOrtho(m_bounds.x, m_bounds.x+m_bounds.w, m_bounds.y + m_bounds.h, m_bounds.y, -1.f, 1.f);
28 glMatrixMode(GL_MODELVIEW);
31 glColor4f(0.f,0.f,0.f,1.f);
33 for (unsigned id = 0; id < m_document.ObjectCount(); ++id)
35 if (m_document.m_objects.types[id] == RECT_FILLED)
37 Rect obj_bounds = m_document.m_objects.bounds[id];
38 glVertex2f(obj_bounds.x, obj_bounds.y);
39 glVertex2f(obj_bounds.x + obj_bounds.w, obj_bounds.y);
40 glVertex2f(obj_bounds.x + obj_bounds.w, obj_bounds.y + obj_bounds.h);
41 glVertex2f(obj_bounds.x, obj_bounds.y + obj_bounds.h);
45 glBegin(GL_LINE_LOOP);
46 for (unsigned id = 0; id < m_document.ObjectCount(); ++id)
48 if (m_document.m_objects.types[id] == RECT_OUTLINE)
50 Rect obj_bounds = m_document.m_objects.bounds[id];
51 glVertex2f(obj_bounds.x, obj_bounds.y);
52 glVertex2f(obj_bounds.x + obj_bounds.w, obj_bounds.y);
53 glVertex2f(obj_bounds.x + obj_bounds.w, obj_bounds.y + obj_bounds.h);
54 glVertex2f(obj_bounds.x, obj_bounds.y + obj_bounds.h);