• R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

Common Source Code Project for Qt (a.k.a for FM-7).


Commit MetaInfo

Revisionc1ee28e9aa76185778a9c5820f5f057d009b81af (tree)
Zeit2017-08-10 03:12:41
AutorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Log Message

[Ui][Qt][OpenGL] OSD: Make icons transparent.
[Ui][Qt][OpenGL] OSD: Add support OpenGL 2.0.

Ändern Zusammenfassung

Diff

--- a/source/src/qt/common/emu_thread.cpp
+++ b/source/src/qt/common/emu_thread.cpp
@@ -227,7 +227,7 @@ void EmuThreadClass::get_tape_string()
227227 tmpstr = QString::fromUtf8("<FONT COLOR=BLUE> EMPTY </FONT>");
228228 }
229229 if(tmpstr != cmt_text[i]) {
230- //emit sig_set_access_lamp(i + 12 + ((readwrite) ? 2 : 0), inserted);
230+ emit sig_set_access_lamp(i + 12 + ((readwrite) ? 2 : 0), inserted);
231231 emit sig_change_osd(CSP_DockDisks_Domain_CMT, i, tmpstr);
232232 cmt_text[i] = tmpstr;
233233 }
--- a/source/src/qt/common/qrc/shaders.qrc
+++ b/source/src/qt/common/qrc/shaders.qrc
@@ -7,6 +7,7 @@
77 <file alias="chromakey_fragment_shader2.glsl">../../gui/chromakey_fragment_shader2.glsl</file>
88 <file alias="led_fragment_shader.glsl">../../gui/led_fragment_shader.glsl</file>
99 <file alias="led_vertex_shader.glsl">../../gui/led_vertex_shader.glsl</file>
10+ <file alias="icon_fragment_shader.glsl">../../gui/icon_fragment_shader.glsl</file>
1011 <file alias="vertex_shader.glsl">../../gui/vertex_shader.glsl</file>
1112 <file alias="grids_fragment_shader.glsl">../../gui/grids_fragment_shader.glsl</file>
1213 <file alias="grids_vertex_shader.glsl">../../gui/grids_vertex_shader.glsl</file>
--- /dev/null
+++ b/source/src/qt/gui/icon_fragment_shader.glsl
@@ -0,0 +1,19 @@
1+varying vec2 v_texcoord;
2+uniform vec4 color;
3+uniform vec3 chromakey;
4+uniform bool do_chromakey;
5+uniform sampler2D a_texture;
6+void main ()
7+{
8+ vec4 pixel_r_1;
9+ vec4 pixel;
10+ float alpha;
11+ pixel_r_1 = texture2D(a_texture, v_texcoord);
12+ //alpha = pixel_r_1.a * color.a;
13+
14+ pixel_r_1 = pixel_r_1 * color;
15+ pixel = pixel_r_1 * color; //;vec4(pixel_r_1.rgb, alpha);
16+ gl_FragColor = pixel;
17+
18+}
19+
--- a/source/src/qt/gui/qt_drawitem.cpp
+++ b/source/src/qt/gui/qt_drawitem.cpp
@@ -90,7 +90,7 @@ void CSP_DrawItem::drawPolygonItem(QPointF _points[], int members,
9090 }
9191
9292
93-void CSP_DrawItem::drawFloppy5Inch(QColor &BGColor, QColor &FGColor, QColor &TextColor, float text_pt, QString text)
93+void CSP_DrawItem::drawFloppy5Inch(QColor &BGColor, QColor &FGColor, QColor &FGColor2, QColor &TextColor, float text_pt, QString text)
9494 {
9595 double __width = (double)_width;
9696 double __height = (double)_height;
@@ -103,12 +103,12 @@ void CSP_DrawItem::drawFloppy5Inch(QColor &BGColor, QColor &FGColor, QColor &Tex
103103 int ybase = (int)((__height - _nwidth) * 0.5);
104104 int wbase = (int)_nwidth;
105105 int hbase = wbase;
106- drawRectItem(xbase, ybase, wbase, hbase, toned_brush_mid, FGColor, FGColor);
106+ drawRectItem(xbase, ybase, wbase, hbase, fill_brush, FGColor, FGColor);
107107 {
108108 int r = (int)((_nwidth * 0.35) / 2.0);
109109 int x = xbase + wbase / 2 - r;
110110 int y = ybase + hbase / 2 - r;
111- drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, FGColor, FGColor);
111+ drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, FGColor2, FGColor2);
112112 }
113113 {
114114 int r = (int)((_nwidth * 0.15) / 2.0);
@@ -121,7 +121,7 @@ void CSP_DrawItem::drawFloppy5Inch(QColor &BGColor, QColor &FGColor, QColor &Tex
121121 double h = _nwidth * (1.0 - 0.35 - 0.2) / 2.0;
122122 int x = (xbase + wbase / 2) - (int)(w / 2.0);
123123 int y = (ybase + wbase / 2) + (int)(_nwidth * 0.45 / 2.0);
124- drawRectItem(x, y, w, h, fill_brush, FGColor, FGColor);
124+ drawRectItem(x, y, w, h, fill_brush, FGColor2, FGColor2);
125125 }
126126 if(!text.isEmpty()) {
127127 int x = xbase + (int)(_nwidth * 0.65);
@@ -136,7 +136,7 @@ void CSP_DrawItem::drawFloppy5Inch(QColor &BGColor, QColor &FGColor, QColor &Tex
136136 }
137137
138138
139-void CSP_DrawItem::drawFloppy3_5Inch(QColor &BGColor, QColor &FGColor, QColor &TextColor, float text_pt, QString text)
139+void CSP_DrawItem::drawFloppy3_5Inch(QColor &BGColor, QColor &FGColor, QColor &FGColor2, QColor &FGColor3, QColor &TextColor, float text_pt, QString text)
140140 {
141141 double __width = (double)_width;
142142 double __height = (double)_height;
@@ -159,7 +159,7 @@ void CSP_DrawItem::drawFloppy3_5Inch(QColor &BGColor, QColor &FGColor, QColor &T
159159 QPointF((float)xbase + (float)_nwidth, (float)ybase + (float)_nheight),
160160 QPointF((float)xbase, (float)ybase + (float)_nheight)
161161 };
162- drawPolygonItem(points, 5, toned_brush_mid, FGColor, FGColor);
162+ drawPolygonItem(points, 5, fill_brush, FGColor, FGColor);
163163 }
164164 {
165165 float xoffset = (float)(_nwidth * 0.25);
@@ -172,7 +172,7 @@ void CSP_DrawItem::drawFloppy3_5Inch(QColor &BGColor, QColor &FGColor, QColor &T
172172 QPointF((float)xbase + xoffset, (float)ybase + _h),
173173 };
174174 drawPolygonItem(points, 4, fill_brush, BGColor, BGColor);
175- drawPolygonItem(points, 4, toned_brush_light, FGColor, FGColor);
175+ drawPolygonItem(points, 4, fill_brush, FGColor2, FGColor2);
176176
177177 {
178178 xoffset = xoffset + _w * 0.65;
@@ -185,11 +185,11 @@ void CSP_DrawItem::drawFloppy3_5Inch(QColor &BGColor, QColor &FGColor, QColor &T
185185 QPointF((float)xbase + xoffset + _w2, (float)ybase + yoffset + _h2),
186186 QPointF((float)xbase + xoffset, (float)ybase + yoffset + _h2),
187187 };
188- drawPolygonItem(points2, 4, toned_brush_mid, FGColor, FGColor);
188+ drawPolygonItem(points2, 4, fill_brush, FGColor3, FGColor3);
189189 }
190190 }
191191 if(!text.isEmpty()) {
192- int x = xbase + + (int)(_nwidth * 0.23);
192+ int x = xbase + + (int)(_nwidth * 0.65);
193193 int y = ybase + (int)(_nwidth * 0.55);
194194 int w = (int)(_nwidth * 0.40);
195195 int h = w;
@@ -199,7 +199,7 @@ void CSP_DrawItem::drawFloppy3_5Inch(QColor &BGColor, QColor &FGColor, QColor &T
199199 }
200200 }
201201
202-void CSP_DrawItem::drawCasetteTape(QColor &BGColor, QColor &FGColor, QColor &TextColor, float text_pt, QString text)
202+void CSP_DrawItem::drawCasetteTape(QColor &BGColor, QColor &FGColor, QColor &FGColor2, QColor &FGColor3, QColor &TextColor, float text_pt, QString text)
203203 {
204204 double __width = (double)_width;
205205 double __height = (double)_height;
@@ -218,59 +218,59 @@ void CSP_DrawItem::drawCasetteTape(QColor &BGColor, QColor &FGColor, QColor &Tex
218218 int y = ybase;
219219 int w = wbase;
220220 int h = hbase;
221- drawRectItem(x, y, w, h, fill_brush, BGColor, FGColor);
221+ drawRectItem(x, y, w, h, fill_brush, BGColor, BGColor);
222222 }
223223 {
224224 int r = (int)((_nwidth * 0.45) / 2.0);
225225 int x = xbase + (int)(_nwidth * 0.25) - r;
226226 int y = ybase + (int)(_nheight * 0.5) - r;
227- drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, FGColor, FGColor);
227+ drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, FGColor, FGColor, Qt::NoPen);
228228 }
229229 {
230230 int r = (int)((_nwidth * 0.10) / 2.0);
231231 int x = xbase + (int)(_nwidth * 0.25) - r;
232232 int y = ybase + (int)(_nheight * 0.5) - r;
233- drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, BGColor, BGColor);
233+ drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, BGColor, BGColor, Qt::NoPen);
234234 }
235235 {
236236 int r = (int)((_nwidth * 0.25) / 2.0);
237237 int x = xbase + (int)(_nwidth * 0.75) - r;
238238 int y = ybase + (int)(_nheight * 0.5) - r;
239- drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, FGColor, FGColor);
239+ drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, FGColor, FGColor, Qt::NoPen);
240240 }
241241 {
242242 int r = (int)((_nwidth * 0.10) / 2.0);
243243 int x = xbase + (int)(_nwidth * 0.75) - r;
244244 int y = ybase + (int)(_nheight * 0.5) - r;
245- drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, BGColor, BGColor);
245+ drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, BGColor, BGColor, Qt::NoPen);
246246 }
247247 {
248248 int x = xbase;
249249 int y = ybase;
250250 int w = wbase;
251251 int h = (int)(_nheight * 0.35);
252- drawRectItem(x, y, w, h, toned_brush_mid, FGColor, FGColor, Qt::NoPen);
252+ drawRectItem(x, y, w, h, fill_brush, FGColor2, FGColor2, Qt::NoPen);
253253 }
254254 {
255255 int x = xbase;
256256 int y = ybase + (int)(_nheight * 0.65);
257257 int w = wbase;
258258 int h = (int)(_nheight * 0.3);
259- drawRectItem(x, y, w, h, toned_brush_mid, FGColor, FGColor, Qt::NoPen);
259+ drawRectItem(x, y, w, h, fill_brush, FGColor2, FGColor2, Qt::NoPen);
260260 }
261261 {
262262 int x = xbase;
263263 int y = ybase;
264- int w = (int)(_nwidth * 0.2);
264+ int w = (int)(_nwidth * 0.1);
265265 int h = hbase;
266- drawRectItem(x, y, w, h, toned_brush_mid, FGColor, FGColor, Qt::NoPen);
266+ drawRectItem(x, y, w, h, fill_brush, FGColor2, FGColor2, Qt::NoPen);
267267 }
268268 {
269- int w = (int)(_nwidth * 0.2);
269+ int w = (int)(_nwidth * 0.1);
270270 int x = xbase + wbase - w;
271271 int y = ybase;
272272 int h = hbase;
273- drawRectItem(x, y, w, h, toned_brush_mid, FGColor, FGColor, Qt::NoPen);
273+ drawRectItem(x, y, w, h, fill_brush, FGColor2, FGColor2, Qt::NoPen);
274274 }
275275 if(!text.isEmpty()) {
276276 int x = 0 + (int)(__width * 0.7);
@@ -284,7 +284,7 @@ void CSP_DrawItem::drawCasetteTape(QColor &BGColor, QColor &FGColor, QColor &Tex
284284 }
285285 }
286286
287-void CSP_DrawItem::drawQuickDisk(QColor &BGColor, QColor &FGColor, QColor &TextColor, float text_pt, QString text)
287+void CSP_DrawItem::drawQuickDisk(QColor &BGColor, QColor &FGColor, QColor &FGColor2, QColor &TextColor, float text_pt, QString text)
288288 {
289289 double __width = (double)_width;
290290 double __height = (double)_height;
@@ -297,7 +297,7 @@ void CSP_DrawItem::drawQuickDisk(QColor &BGColor, QColor &FGColor, QColor &TextC
297297 int ybase = (int)((__height - _nwidth) * 0.5);
298298 int wbase = (int)_nwidth;
299299 int hbase = wbase;
300- drawRectItem(xbase, ybase, wbase, hbase, toned_brush_mid, FGColor, FGColor);
300+ drawRectItem(xbase, ybase, wbase, hbase, fill_brush, FGColor2, FGColor2);
301301 {
302302 int r = (int)((_nwidth * 0.40) / 2.0);
303303 int x = xbase + wbase / 2 - r;
@@ -322,7 +322,7 @@ void CSP_DrawItem::drawQuickDisk(QColor &BGColor, QColor &FGColor, QColor &TextC
322322 }
323323 }
324324
325-void CSP_DrawItem::drawCompactDisc(QColor &BGColor, QColor &FGColor, QColor &LabelColor, QColor &TextColor, float text_pt, QString text)
325+void CSP_DrawItem::drawCompactDisc(QColor &BGColor, QColor &FGColor, QColor &FGColor2, QColor &FGColor3, QColor &LabelColor, QColor &TextColor, float text_pt, QString text)
326326 {
327327 double __width = (double)_width;
328328 double __height = (double)_height;
@@ -339,13 +339,13 @@ void CSP_DrawItem::drawCompactDisc(QColor &BGColor, QColor &FGColor, QColor &Lab
339339 int r = (int)_nr;
340340 int x = xbase - rbase;
341341 int y = ybase - rbase;
342- drawCircleItem(x, y, r, 0, 360 * 16, toned_brush_mid, FGColor, FGColor, Qt::NoPen);
342+ drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, FGColor2, FGColor2, Qt::NoPen);
343343 }
344344 {
345345 int r = (int)(_nr * 0.41 * 1.2);
346346 int x = xbase - r;
347347 int y = ybase - r;
348- drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, FGColor, FGColor);
348+ drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, FGColor3, FGColor3);
349349 }
350350 {
351351 int r = (int)(_nr * 0.35 * 1.2);
@@ -357,7 +357,7 @@ void CSP_DrawItem::drawCompactDisc(QColor &BGColor, QColor &FGColor, QColor &Lab
357357 int r = (int)(_nr * 0.22 * 1.2);
358358 int x = xbase - r;
359359 int y = ybase - r;
360- drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, FGColor, FGColor);
360+ drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, FGColor2, FGColor2);
361361 }
362362 {
363363 int r = (int)(_nr * 0.15 * 1.2);
@@ -388,7 +388,7 @@ void CSP_DrawItem::drawCompactDisc(QColor &BGColor, QColor &FGColor, QColor &Lab
388388 }
389389 }
390390
391-void CSP_DrawItem::drawLaserDisc(QColor &BGColor, QColor &FGColor, QColor &LabelColor, QColor &TextColor, float text_pt, QString text)
391+void CSP_DrawItem::drawLaserDisc(QColor &BGColor, QColor &FGColor, QColor &FGColor2, QColor &LabelColor, QColor &TextColor, float text_pt, QString text)
392392 {
393393 double __width = (double)_width;
394394 double __height = (double)_height;
@@ -405,13 +405,13 @@ void CSP_DrawItem::drawLaserDisc(QColor &BGColor, QColor &FGColor, QColor &Label
405405 int r = (int)_nr;
406406 int x = xbase - rbase;
407407 int y = ybase - rbase;
408- drawCircleItem(x, y, r, 0, 360 * 16, toned_brush_mid, FGColor, FGColor, Qt::NoPen);
408+ drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, FGColor2, FGColor2, Qt::NoPen);
409409 }
410410 {
411411 int r = (int)(_nr * 0.30 * 1.2);
412412 int x = xbase - r;
413413 int y = ybase - r;
414- drawCircleItem(x, y, r, 0, 360 * 16, toned_brush_deep, FGColor, FGColor, Qt::NoPen);
414+ drawCircleItem(x, y, r, 0, 360 * 16, fill_brush, FGColor, FGColor, Qt::NoPen);
415415 }
416416 {
417417 int r = (int)(_nr * 0.15 * 1.2);
--- a/source/src/qt/gui/qt_drawitem.h
+++ b/source/src/qt/gui/qt_drawitem.h
@@ -30,12 +30,12 @@ public:
3030 CSP_DrawItem(int width, int height, Format fmt = QImage::Format_RGBA8888);
3131 ~CSP_DrawItem();
3232 void clearCanvas(QColor &clColor);
33- void drawFloppy5Inch(QColor &BGColor, QColor &FGColor, QColor &TextColor, float text_pt, QString text);
34- void drawFloppy3_5Inch(QColor &BGColor, QColor &FGColor, QColor &TextColor, float text_pt, QString text);
35- void drawCasetteTape(QColor &BGColor, QColor &FGColor, QColor &TextColor, float text_pt, QString text);
36- void drawQuickDisk(QColor &BGColor, QColor &FGColor, QColor &TextColor, float text_pt, QString text);
37- void drawCompactDisc(QColor &BGColor, QColor &FGColor, QColor &LabelColor, QColor &TextColor, float text_pt, QString text);
38- void drawLaserDisc(QColor &BGColor, QColor &FGColor, QColor &LabelColor, QColor &TextColor, float text_pt, QString text);
33+ void drawFloppy5Inch(QColor &BGColor, QColor &FGColor, QColor &FGColor2, QColor &TextColor, float text_pt, QString text);
34+ void drawFloppy3_5Inch(QColor &BGColor, QColor &FGColor, QColor &FGColor2, QColor &FGColor3, QColor &TextColor, float text_pt, QString text);
35+ void drawCasetteTape(QColor &BGColor, QColor &FGColor, QColor &FGColor2, QColor &FGColor3, QColor &TextColor, float text_pt, QString text);
36+ void drawQuickDisk(QColor &BGColor, QColor &FGColor, QColor &FGColor2, QColor &TextColor, float text_pt, QString text);
37+ void drawCompactDisc(QColor &BGColor, QColor &FGColor, QColor &FGColor2, QColor &FGColor3, QColor &LabelColor, QColor &TextColor, float text_pt, QString text);
38+ void drawLaserDisc(QColor &BGColor, QColor &FGColor, QColor &FGColor2, QColor &LabelColor, QColor &TextColor, float text_pt, QString text);
3939 };
4040 //QT_END_NAMESPACE
4141 #endif /* _CSP_QT_DRAWITEM_H_ */
--- a/source/src/qt/gui/qt_gldraw.h
+++ b/source/src/qt/gui/qt_gldraw.h
@@ -151,7 +151,7 @@ public slots:
151151 void do_display_osd_leds(int lednum,bool onoff);
152152 void do_set_led_width(int bitwidth);
153153 void do_update_icon(int icon_type, int localnum, QPixmap *p);
154- void do_update_icon(int icon_type, int localnum, QString message, QColor bg, QColor fg, QColor lg, QColor tg, float pt);
154+ void do_update_icon(int icon_type, int localnum, QString message, QColor bg, QColor fg, QColor fg2, QColor fg3, QColor lg, QColor tg, float pt);
155155
156156 signals:
157157 void update_screenChanged(int tick);
--- a/source/src/qt/gui/qt_glutil.cpp
+++ b/source/src/qt/gui/qt_glutil.cpp
@@ -49,7 +49,7 @@ void GLDrawClass::do_update_icon(int icon_type, int localnum, QPixmap *p)
4949 }
5050 }
5151
52-void GLDrawClass::do_update_icon(int icon_type, int localnum, QString message, QColor bg, QColor fg, QColor lg, QColor tg, float pt)
52+void GLDrawClass::do_update_icon(int icon_type, int localnum, QString message, QColor bg, QColor fg, QColor fg2, QColor fg3, QColor lg, QColor tg, float pt)
5353 {
5454 if(draw_item != NULL) {
5555 QPixmap icon;
@@ -59,23 +59,23 @@ void GLDrawClass::do_update_icon(int icon_type, int localnum, QString message, Q
5959 draw_item->clearCanvas(nullColor);
6060 break;
6161 case 1:
62- draw_item->drawFloppy5Inch(bg, fg, tg, pt, message);
62+ draw_item->drawFloppy5Inch(bg, fg, fg2, tg, pt, message);
6363 break;
6464 case 2:
65- draw_item->drawFloppy3_5Inch(bg, fg, tg, pt, message);
65+ draw_item->drawFloppy3_5Inch(bg, fg3, fg2, fg, tg, pt, message);
6666 break;
6767 case 3:
68- draw_item->drawQuickDisk(bg, fg, tg, pt, message);
68+ draw_item->drawQuickDisk(bg, fg, fg2, tg, pt, message);
6969 break;
7070 case 4:
7171 case 5:
72- draw_item->drawCasetteTape(bg, fg, tg, pt, message);
72+ draw_item->drawCasetteTape(bg, fg, fg2, fg3, tg, pt, message);
7373 break;
7474 case 6:
75- draw_item->drawCompactDisc(bg, fg, lg, tg, pt, message);
75+ draw_item->drawCompactDisc(bg, fg, fg2, fg3, lg, tg, pt, message);
7676 break;
7777 case 7:
78- draw_item->drawLaserDisc(bg, fg, lg, tg, pt, message);
78+ draw_item->drawLaserDisc(bg, fg, fg2, lg, tg, pt, message);
7979 break;
8080 default:
8181 break;
@@ -102,17 +102,20 @@ void GLDrawClass::initializeGL(void)
102102 InitFBO(); // 拡張の有無を調べてからFBOを初期化する。
103103 InitGLExtensionVars();
104104
105- QColor BG = QColor(0, 250, 0, 196);
106- QColor TG = QColor(0, 0, 250, 196);
107- QColor LG = QColor(250, 0, 0, 196);
108- QColor FG = QColor(255, 255, 255, 196);
105+ QColor BG = QColor(0, 250, 0, 255);
106+ QColor TG = QColor(0, 0, 250, 255);
107+ QColor TG2 = QColor(250, 250, 250, 255);
108+ QColor LG = QColor(250, 0, 0, 255);
109+ QColor FG = QColor(255, 255, 255, 255);
110+ QColor FG2 = QColor(128, 128, 128, 255);
111+ QColor FG3 = QColor(64, 64, 64, 255);
109112
110- do_update_icon(0, 0, QString::fromUtf8(""), BG, FG, LG, TG, 12.0f);
113+ do_update_icon(0, 0, QString::fromUtf8(""), BG, FG, FG2, FG3, LG, TG, 12.0f);
111114 if(using_flags->is_use_laser_disc()) {
112- do_update_icon(7, 0, QString::fromUtf8("LD"), BG, FG, LG, TG, 12.0f);
115+ do_update_icon(7, 0, QString::fromUtf8("LD"), BG, FG, FG2, FG3, LG, TG, 12.0f);
113116 }
114117 if(using_flags->is_use_compact_disc()) {
115- do_update_icon(6, 0, QString::fromUtf8("CD"), BG, FG, LG, TG, 12.0f);
118+ do_update_icon(6, 0, QString::fromUtf8("CD"), BG, FG, FG2, FG3, LG, TG, 12.0f);
116119 }
117120 if(using_flags->is_use_fd()) {
118121 int drvs = using_flags->get_max_drive();
@@ -121,7 +124,8 @@ void GLDrawClass::initializeGL(void)
121124 tmps = QString::fromUtf8("");
122125 ts.setNum(i);
123126 tmps = tmps + ts + QString::fromUtf8(":");
124- do_update_icon(1, i, tmps, BG, FG, LG, TG, 12.0f); // Dedicate to 3.5/5/8? and startnum.
127+ do_update_icon(1, i, tmps, BG, FG, FG2, FG3, LG, TG, 12.0f); // Dedicate to 3.5/5/8? and startnum.
128+ do_update_icon(2, i, tmps, BG, FG, FG2, FG3, LG, TG2, 12.0f); // Dedicate to 3.5/5/8? and startnum.
125129 }
126130 }
127131 if(using_flags->is_use_qd()) {
@@ -131,22 +135,24 @@ void GLDrawClass::initializeGL(void)
131135 tmps = QString::fromUtf8("");
132136 ts.setNum(i);
133137 tmps = tmps + ts + QString::fromUtf8(":");
134- do_update_icon(3, i, tmps, BG, FG, LG, TG, 12.0f); // Dedicate to 3.5/5/8? and startnum.
138+ do_update_icon(3, i, tmps, BG, FG, FG2, FG3, LG, TG, 12.0f); // Dedicate to 3.5/5/8? and startnum.
135139 }
136140 }
137141 if(using_flags->is_use_tape()) {
138142 int drvs = using_flags->get_max_tape();
139- QColor R_BG = QColor(0, 0, 255, 192);
140- QColor W_BG = QColor(255, 0, 0, 192);
141- QColor C_FG = QColor(255, 255, 255, 192);
142- QColor C_TG = QColor(0, 255, 0, 255);
143+ QColor R_BG = QColor(0, 0, 255, 255);
144+ QColor W_BG = QColor(255, 0, 0, 255);
145+ QColor C_FG = QColor(255, 255, 255, 255);
146+ QColor C_FG2 = QColor(64, 64, 64, 255);
147+ QColor C_FG3 = QColor(128, 128, 128, 255);
148+ QColor C_TG = QColor(0, 255, 0, 255);
143149 QString ts, tmps;
144150 for(int i = 0; i < drvs; i++) {
145151 tmps = QString::fromUtf8("");
146152 ts.setNum(i + 1);
147153 tmps = tmps + ts;
148- do_update_icon(4, i, tmps, R_BG, C_FG, LG, C_TG, 12.0f); // Dedicate to 3.5/5/8? and startnum.
149- do_update_icon(5, i, tmps, W_BG, C_FG, LG, C_TG, 12.0f); // Dedicate to 3.5/5/8? and startnum.
154+ do_update_icon(4, i, tmps, R_BG, C_FG, C_FG2, C_FG3, LG, C_TG, 12.0f); // Dedicate to 3.5/5/8? and startnum.
155+ do_update_icon(5, i, tmps, W_BG, C_FG, C_FG2, C_FG3, LG, C_TG, 12.0f); // Dedicate to 3.5/5/8? and startnum.
150156 }
151157 }
152158 }
--- a/source/src/qt/gui/qt_glutil_gl2_0.cpp
+++ b/source/src/qt/gui/qt_glutil_gl2_0.cpp
@@ -88,8 +88,6 @@ GLDraw_2_0::GLDraw_2_0(GLDrawClass *parent, USING_FLAGS *p, CSP_Logger *logger,
8888 for(int i = 0; i < 8; i++) {
8989 for(int j = 0; j < 8; j++) {
9090 icon_texid[i][j] = 0;
91- icon_uploaded[i][j] = false;
92- icon_reqdraw[i][j] = false;
9391 }
9492 }
9593
@@ -161,6 +159,70 @@ void GLDraw_2_0::do_set_display_osd(bool onoff)
161159 osd_onoff = onoff;
162160 }
163161
162+void GLDraw_2_0::set_osd_vertex(int xbit)
163+{
164+ float xbase, ybase, zbase;
165+ int major, minor, nl;
166+ int i = xbit;
167+ if((xbit < 0) || (xbit >= 32)) return;
168+ if((i >= 2) && (i < 10)) { // FD
169+ major = 0;
170+ minor = i - 2;
171+ nl = using_flags->get_max_drive();
172+ } else if((i >= 10) && (i < 12)) { // QD
173+ major = 2;
174+ minor = i - 10;
175+ nl = using_flags->get_max_qd();
176+ } else if((i >= 12) && (i < 14)) { // CMT(R)
177+ major = 1;
178+ minor = i - 12;
179+ nl = using_flags->get_max_tape();
180+ } else if((i >= 14) && (i < 16)) { // CMT(W)
181+ major = 1;
182+ minor = i - 14;
183+ nl = using_flags->get_max_tape();
184+ } else if(i >= 16) {
185+ major = 4 + (i / 8) - 2;
186+ minor = i % 8;
187+ nl = 8;
188+ } else {
189+ major = 6;
190+ minor = i;
191+ nl = 2;
192+ }
193+ xbase = 1.0f - (1.0f * 48.0f / 640.0f) * (float)(nl - minor) - (4.0f / 640.0f);;
194+ ybase = -1.0f + (1.0f * 48.0f / 400.0f) * (float)(major + 1) + (4.0f / 400.0f);
195+ zbase = -0.998f;
196+ vertexOSD[i][0].x = xbase;
197+ vertexOSD[i][0].y = ybase;
198+ vertexOSD[i][0].z = zbase;
199+ vertexOSD[i][0].s = 0.0f;
200+ vertexOSD[i][0].t = 1.0f;
201+
202+ vertexOSD[i][1].x = xbase + (48.0f / 640.0f);
203+ vertexOSD[i][1].y = ybase;
204+ vertexOSD[i][1].z = zbase;
205+ vertexOSD[i][1].s = 1.0f;
206+ vertexOSD[i][1].t = 1.0f;
207+
208+ vertexOSD[i][2].x = xbase + (48.0f / 640.0f);
209+ vertexOSD[i][2].y = ybase - (48.0f / 400.0f);
210+ vertexOSD[i][2].z = zbase;
211+ vertexOSD[i][2].s = 1.0f;
212+ vertexOSD[i][2].t = 0.0f;
213+
214+ vertexOSD[i][3].x = xbase;
215+ vertexOSD[i][3].y = ybase - (48.0f / 400.0f);
216+ vertexOSD[i][3].z = zbase;
217+ vertexOSD[i][3].s = 0.0f;
218+ vertexOSD[i][3].t = 0.0f;
219+
220+ setNormalVAO(osd_shader, vertex_osd[xbit],
221+ buffer_osd[xbit],
222+ &(vertexOSD[i][0]), 4);
223+}
224+
225+
164226 void GLDraw_2_0::do_display_osd_leds(int lednum, bool onoff)
165227 {
166228 if(lednum == -1) {
@@ -241,6 +303,74 @@ void GLDraw_2_0::drawOsdLeds()
241303 }
242304 }
243305
306+
307+void GLDraw_2_0::drawOsdIcons()
308+{
309+ QVector4D color_on;
310+ QVector4D color_off;
311+ int major, minor;
312+ if(osd_onoff) {
313+ color_on = QVector4D(1.0, 1.0, 1.0, 0.8);
314+ color_off = QVector4D(1.0, 1.0, 1.0, 0.00);
315+ } else {
316+ color_on = QVector4D(0.00,0.00, 0.00, 0.0);
317+ color_off = QVector4D(0.00,0.00, 0.00, 0.0);
318+ }
319+ extfunc_2->glEnable(GL_BLEND);
320+ extfunc_2->glEnable(GL_TEXTURE_2D);
321+ extfunc_2->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
322+ extfunc_2->glDisable(GL_DEPTH_TEST);
323+ extfunc_2->glViewport(0, 0, p_wid->width(), p_wid->height());
324+ extfunc_2->glOrtho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0, 1.0);
325+ if(osd_onoff) {
326+ uint32_t _bit = 0x00000001;
327+ bool checkf;
328+ for(int ii = 0; ii < osd_led_bit_width; ii++) {
329+ checkf = ((_bit & osd_led_status) != 0);
330+ if(checkf == ((_bit & osd_led_status_bak) != 0)) {
331+ if(!checkf) {
332+ _bit <<= 1;
333+ continue;
334+ }
335+ }
336+ if((ii >= 2) && (ii < 10)) { // FD
337+ major = 2;
338+ minor = ii - 2;
339+ } else if((ii >= 10) && (ii < 12)) { // QD
340+ major = 3;
341+ minor = ii - 10;
342+ } else if((ii >= 12) && (ii < 14)) { // CMT(R)
343+ major = 4;
344+ minor = ii - 12;
345+ } else if((ii >= 14) && (ii < 16)) { // CMT(W)
346+ major = 5;
347+ minor = ii - 14;
348+ } else if(ii >= 16) {
349+ major = 4 + (ii / 8) - 2;
350+ minor = ii % 8;
351+ } else {
352+ major = 6;
353+ minor = ii;
354+ }
355+ if(checkf) {
356+ drawMain(osd_shader, vertex_osd[ii],
357+ buffer_osd[ii],
358+ vertexOSD[ii],
359+ icon_texid[major][minor],
360+ color_on, false);
361+ } else {
362+ drawMain(osd_shader, vertex_osd[ii],
363+ buffer_osd[ii],
364+ vertexOSD[ii],
365+ icon_texid[major][minor],
366+ color_off, false);
367+ }
368+ _bit <<= 1;
369+ }
370+ osd_led_status_bak = osd_led_status;
371+ }
372+}
373+
244374 void GLDraw_2_0::setNormalVAO(QOpenGLShaderProgram *prg,
245375 QOpenGLVertexArrayObject *vp,
246376 QOpenGLBuffer *bp,
@@ -553,6 +683,42 @@ void GLDraw_2_0::initLocalGLObjects(void)
553683 }
554684 }
555685 initBitmapVAO();
686+ initOsdObjects();
687+}
688+
689+void GLDraw_2_0::initOsdObjects(void)
690+{
691+ osd_shader = new QOpenGLShaderProgram(p_wid);
692+ if(osd_shader != NULL) {
693+ osd_shader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/vertex_shader.glsl");
694+ osd_shader->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/icon_fragment_shader.glsl");
695+ osd_shader->link();
696+ }
697+ for(int i = 0; i < 32; i++) {
698+ buffer_osd[i] = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer);
699+ vertex_osd[i] = new QOpenGLVertexArrayObject;
700+
701+ if(buffer_osd[i] != NULL) {
702+ if(buffer_osd[i]->create()) {
703+ {
704+ QVector4D c;
705+ c = QVector4D(1.0, 1.0, 1.0, 1.0);
706+ osd_shader->setUniformValue("color", c);
707+ }
708+
709+ //buffer_screen_vertex->create();
710+ buffer_osd[i]->setUsagePattern(QOpenGLBuffer::StaticDraw);
711+ vertex_osd[i]->create();
712+
713+ if(vertex_osd[i] != NULL) vertex_osd[i]->bind();
714+ buffer_osd[i]->bind();
715+ buffer_osd[i]->allocate(sizeof(VertexTexCoord_t) * 4);
716+ if(vertex_osd[i] != NULL) vertex_osd[i]->release();
717+ buffer_osd[i]->release();
718+ set_osd_vertex(i);
719+ }
720+ }
721+ }
556722 }
557723
558724 void GLDraw_2_0::doSetGridsHorizonal(int lines, bool force)
@@ -888,25 +1054,15 @@ void GLDraw_2_0::uploadBitmapTexture(QImage *p)
8881054 void GLDraw_2_0::uploadIconTexture(QPixmap *p, int icon_type, int localnum)
8891055 {
8901056 if((icon_type > 7) || (icon_type < 0)) return;
891- if((localnum >= 8) || (localnum < 0)) return;
1057+ if((localnum >= 9) || (localnum < 0)) return;
8921058 if(p == NULL) return;
8931059 p_wid->makeCurrent();
8941060 QImage image = p->toImage();
8951061 GLuint texid = icon_texid[icon_type][localnum];
8961062
897- icon_uploaded[icon_type][localnum] = true;
898- if(texid == 0) {
899- icon_texid[icon_type][localnum] = p_wid->bindTexture(*p);
900- texid = icon_texid[icon_type][localnum];
901- }
1063+ if(texid != 0) p_wid->deleteTexture(texid);
9021064 {
903- // Upload to main texture
904- extfunc_2->glBindTexture(GL_TEXTURE_2D, texid);
905- extfunc_2->glTexSubImage2D(GL_TEXTURE_2D, 0,
906- 0, 0,
907- image.width(), image.height(),
908- GL_BGRA, GL_UNSIGNED_BYTE, image.constBits());
909- extfunc_2->glBindTexture(GL_TEXTURE_2D, 0);
1065+ icon_texid[icon_type][localnum] = p_wid->bindTexture(*p);
9101066 }
9111067 p_wid->doneCurrent();
9121068
@@ -927,8 +1083,6 @@ void GLDraw_2_0::uploadMainTexture(QImage *p, bool use_chromakey)
9271083 imgptr = p;
9281084 if(p == NULL) return;
9291085 {
930- if(use_chromakey) {
931- }
9321086 // Upload to main texture
9331087 if(uVramTextureID == 0) {
9341088 uVramTextureID = p_wid->bindTexture(*p);
@@ -1032,7 +1186,7 @@ void GLDraw_2_0::resizeGL(int width, int height)
10321186 void GLDraw_2_0::paintGL(void)
10331187 {
10341188 //p_wid->makeCurrent();
1035- if(crt_flag || redraw_required) { //return;
1189+ //if(crt_flag || redraw_required) { //return;
10361190 if(emu_launched) {
10371191 crt_flag = false;
10381192 }
@@ -1057,12 +1211,14 @@ void GLDraw_2_0::paintGL(void)
10571211 if(!using_flags->is_use_one_board_computer() && (using_flags->get_max_button() <= 0)) {
10581212 drawGrids();
10591213 }
1060- drawOsdLeds();
1214+ //drawOsdLeds();
1215+ drawOsdIcons();
10611216 extfunc_2->glFlush();
1062- } else {
1063- drawOsdLeds();
1064- extfunc_2->glFlush();
1065- }
1217+ //} else {
1218+ //drawOsdLeds();
1219+ // drawOsdIcons();
1220+ // extfunc_2->glFlush();
1221+ //}
10661222 //p_wid->doneCurrent();
10671223 }
10681224
--- a/source/src/qt/gui/qt_glutil_gl2_0.h
+++ b/source/src/qt/gui/qt_glutil_gl2_0.h
@@ -60,9 +60,7 @@ protected:
6060 int screen_texture_height;
6161 int screen_texture_height_old;
6262
63- bool icon_uploaded[8][8];
64- bool icon_reqdraw[8][8];
65- GLuint icon_texid[8][8];
63+ GLuint icon_texid[9][8];
6664
6765 int rec_count;
6866 int rec_width;
@@ -82,6 +80,10 @@ protected:
8280 QOpenGLVertexArrayObject *vertex_button[128];
8381 QOpenGLBuffer *buffer_button_vertex[128];
8482 QOpenGLShaderProgram *button_shader;
83+ VertexTexCoord_t vertexOSD[32][4];
84+ QOpenGLVertexArrayObject *vertex_osd[32];
85+ QOpenGLBuffer *buffer_osd[32];
86+ QOpenGLShaderProgram *osd_shader;
8587
8688 virtual void initButtons(void);
8789 virtual void initBitmapVertex(void);
@@ -126,6 +128,8 @@ protected:
126128 bool redraw_required;
127129
128130 virtual void drawOsdLeds();
131+ virtual void drawOsdIcons();
132+ virtual void set_osd_vertex(int xbit);
129133
130134 QOpenGLFramebufferObject *offscreen_frame_buffer;
131135 QOpenGLFramebufferObjectFormat *offscreen_frame_buffer_format;
@@ -146,6 +150,8 @@ public:
146150 virtual void initGLObjects();
147151 virtual void initFBO(void);
148152 virtual void initLocalGLObjects(void);
153+ virtual void initOsdObjects(void);
154+
149155 virtual void uploadMainTexture(QImage *p, bool chromakey);
150156
151157 virtual void drawScreenTexture(void);
--- a/source/src/qt/gui/qt_glutil_gl3_0.cpp
+++ b/source/src/qt/gui/qt_glutil_gl3_0.cpp
@@ -456,7 +456,7 @@ void GLDraw_3_0::initLocalGLObjects(void)
456456 }
457457 initPackedGLObject(&osd_pass,
458458 48.0, 48.0,
459- ":/vertex_shader.glsl" , ":/chromakey_fragment_shader.glsl",
459+ ":/vertex_shader.glsl" , ":/icon_fragment_shader.glsl",
460460 "OSD Shader");
461461 for(int i = 0; i < 32; i++) {
462462 osd_pass_vao[i] = new QOpenGLVertexArrayObject;
@@ -1130,8 +1130,8 @@ void GLDraw_3_0::drawOsdIcons()
11301130 QVector4D color_off;
11311131 uint32_t bit = 0x00000001;
11321132 if(osd_onoff) {
1133- color_on = QVector4D(1.0, 1.0, 1.0, 0.3);
1134- color_off = QVector4D(1.0, 1.0, 1.0, 0.05);
1133+ color_on = QVector4D(1.0, 1.0, 1.0, 0.8);
1134+ color_off = QVector4D(1.0, 1.0, 1.0, 0.00);
11351135 } else {
11361136 color_on = QVector4D(0.00,0.00, 0.00, 0.0);
11371137 color_off = QVector4D(0.00,0.00, 0.00, 0.0);
@@ -1147,7 +1147,7 @@ void GLDraw_3_0::drawOsdIcons()
11471147 }
11481148 }
11491149 if((i >= 2) && (i < 10)) { // FD
1150- major = 1;
1150+ major = 2;
11511151 minor = i - 2;
11521152 } else if((i >= 10) && (i < 12)) { // QD
11531153 major = 3;
@@ -1459,27 +1459,6 @@ void GLDraw_3_0::do_set_texture_size(QImage *p, int w, int h)
14591459 }
14601460 }
14611461
1462-void GLDraw_3_0::uploadIconTexture(QPixmap *p, int icon_type, int localnum)
1463-{
1464- if((icon_type > 7) || (icon_type < 0)) return;
1465- if((localnum >= 8) || (localnum < 0)) return;
1466- if(p == NULL) return;
1467- p_wid->makeCurrent();
1468-
1469- QImage image = p->toImage();
1470- GLuint texid = icon_texid[icon_type][localnum];
1471-
1472- icon_uploaded[icon_type][localnum] = true;
1473- if(texid != 0) p_wid->deleteTexture(texid);
1474- {
1475- icon_texid[icon_type][localnum] = p_wid->bindTexture(image);
1476- }
1477- texid = icon_texid[icon_type][localnum];
1478- printf("TYPE=%d LOCALNUM=%d TEXID=%d w=%d h=%d\n", icon_type, localnum, texid, image.width(), image.height());
1479- p_wid->doneCurrent();
1480-
1481-}
1482-
14831462 void GLDraw_3_0::resizeGL_Screen(void)
14841463 {
14851464 if(main_pass != NULL) {
--- a/source/src/qt/gui/qt_glutil_gl3_0.h
+++ b/source/src/qt/gui/qt_glutil_gl3_0.h
@@ -116,6 +116,5 @@ public slots:
116116 void do_set_texture_size(QImage *p, int w, int h);
117117 virtual void paintGL(void);
118118 virtual void resizeGL(int width, int height);
119- virtual void uploadIconTexture(QPixmap *p, int icon_type, int localnum);
120119 };
121120 #endif
Show on old repository browser