• R/O
  • SSH
  • HTTPS

qrobosdk: コミット


コミットメタ情報

リビジョン1837 (tree)
日時2010-05-28 07:26:14
作者satofumi

ログメッセージ

CanvasSurface.cpp handle alpha color now.

変更サマリ

差分

--- trunk/libs/gui/CanvasSurface.cpp (revision 1836)
+++ trunk/libs/gui/CanvasSurface.cpp (revision 1837)
@@ -38,6 +38,17 @@
3838 Point<long> position;
3939 } draw_t;
4040
41+ typedef struct
42+ {
43+ GLubyte r;
44+ GLubyte g;
45+ GLubyte b;
46+ GLubyte a;
47+ GLfloat x;
48+ GLfloat y;
49+ GLfloat z;
50+ } gl_points_t;
51+
4152 typedef vector<draw_t> Draws;
4253 }
4354
@@ -94,11 +105,18 @@
94105 }
95106
96107
97- void registerColor(vector<GLfloat>& intertwined)
108+ void registerPoint(vector<gl_points_t>& intertwined, GLfloat x, GLfloat y)
98109 {
99- intertwined.push_back(draw_color_.r);
100- intertwined.push_back(draw_color_.g);
101- intertwined.push_back(draw_color_.b);
110+ gl_points_t point;
111+ point.r = min(255.0 * draw_color_.r, 255.0);
112+ point.g = min(255.0 * draw_color_.g, 255.0);
113+ point.b = min(255.0 * draw_color_.b, 255.0);
114+ point.a = min(255.0 * draw_color_.a, 255.0);
115+ point.x = x;
116+ point.y = y;
117+ point.z = 0.0f;
118+
119+ intertwined.push_back(point);
102120 }
103121
104122
@@ -130,13 +148,10 @@
130148 draw.size = points.size();
131149 draw.surface = NULL;
132150
133- vector<GLfloat> intertwined;
151+ vector<gl_points_t> intertwined;
134152 for (vector<Point<long> >::const_iterator it = points.begin();
135153 it != points.end(); ++it) {
136- registerColor(intertwined);
137- intertwined.push_back(it->x);
138- intertwined.push_back(it->y);
139- intertwined.push_back(0.0f);
154+ registerPoint(intertwined, it->x, it->y);
140155 }
141156
142157 glBindBuffer(GL_ARRAY_BUFFER, draw.buffer);
@@ -169,7 +184,7 @@
169184 glLineStipple(draw.stipple_factor, draw.stipple_pattern);
170185
171186 glBindBuffer(GL_ARRAY_BUFFER, draw.buffer);
172- glInterleavedArrays(GL_C3F_V3F, 0, NULL);
187+ glInterleavedArrays(GL_C4UB_V3F, 0, NULL);
173188 glDrawArrays(draw.mode, 0, draw.size);
174189 glBindBuffer(GL_ARRAY_BUFFER, 0);
175190 }
旧リポジトリブラウザで表示