• R/O
  • SSH
  • HTTPS

qrobosdk: コミット


コミットメタ情報

リビジョン1834 (tree)
日時2010-05-22 21:43:20
作者satofumi

ログメッセージ

add CanvasSurface::drawPoints()

変更サマリ

差分

--- trunk/libs/gui/CanvasSurface.cpp (revision 1833)
+++ trunk/libs/gui/CanvasSurface.cpp (revision 1834)
@@ -29,6 +29,7 @@
2929 GLuint buffer;
3030 GLenum mode;
3131 size_t size;
32+ GLfloat point_size;
3233 GLfloat line_width;
3334 GLint stipple_factor;
3435 GLushort stipple_pattern;
@@ -45,6 +46,7 @@
4546 Rect<long> rect_;
4647 float alpha_;
4748 Color draw_color_;
49+ GLfloat point_size_;
4850 GLfloat line_width_;
4951 int line_stipple_factor_;
5052 unsigned short line_stipple_pattern_;
@@ -55,7 +57,7 @@
5557
5658 pImpl(const Rect<long>& rect)
5759 : rect_(rect), alpha_(1.0), draw_color_(Color(1.0, 1.0, 1.0, 1.0)),
58- line_width_(1.0f),
60+ point_size_(1.0f), line_width_(1.0f),
5961 line_stipple_factor_(1), line_stipple_pattern_(0xffff), font_(NULL)
6062 {
6163 clearBuffers();
@@ -66,8 +68,7 @@
6668 ~pImpl(void)
6769 {
6870 clearBuffers();
69-
70- // !!! clear_draw_ のリソースを解放する
71+ glDeleteBuffers(1, &clear_draw_.buffer);
7172 }
7273
7374
@@ -122,6 +123,7 @@
122123 {
123124 draw.mode = mode;
124125 draw.line_width = line_width_;
126+ draw.point_size = point_size_;
125127 draw.stipple_factor = line_stipple_factor_;
126128 draw.stipple_pattern = line_stipple_pattern_;
127129 draw.buffer = createBuffer();
@@ -163,6 +165,7 @@
163165 void drawPrimitive(const draw_t& draw)
164166 {
165167 glLineWidth(draw.line_width);
168+ glPointSize(draw.point_size);
166169 glLineStipple(draw.stipple_factor, draw.stipple_pattern);
167170
168171 glBindBuffer(GL_ARRAY_BUFFER, draw.buffer);
@@ -305,6 +308,12 @@
305308 }
306309
307310
311+void CanvasSurface::setPointSize(float size)
312+{
313+ pimpl->point_size_ = size;
314+}
315+
316+
308317 void CanvasSurface::setLineWidth(float width)
309318 {
310319 pimpl->line_width_ = width;
@@ -318,6 +327,17 @@
318327 }
319328
320329
330+void CanvasSurface::drawPoints(const std::vector<qrk::Point<long> >& points)
331+{
332+ if (points.empty()) {
333+ return;
334+ }
335+ draw_t draw;
336+ pimpl->registerPrimitive(draw, points, GL_POINTS);
337+ pimpl->draws_.push_back(draw);
338+}
339+
340+
321341 void CanvasSurface::drawLineStrip(const std::vector<qrk::Point<long> >& points)
322342 {
323343 if (points.empty()) {
--- trunk/libs/gui/CanvasSurface.h (revision 1833)
+++ trunk/libs/gui/CanvasSurface.h (revision 1834)
@@ -41,9 +41,11 @@
4141 void setClearColor(const qrk::Color& color);
4242 void clear(void);
4343 void setColor(const qrk::Color& color);
44+ void setPointSize(float size);
4445 void setLineWidth(float width);
4546 void setLineStipple(int factor, unsigned short pattern);
4647
48+ void drawPoints(const std::vector<qrk::Point<long> >& points);
4749 void drawLineStrip(const std::vector<qrk::Point<long> >& points);
4850 void drawLineLoop(const std::vector<qrk::Point<long> >& points);
4951 void drawCircle(const qrk::Point<long>& center, float radius);
旧リポジトリブラウザで表示