May 25, 2018 updates: Privacy Policy
  • R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

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


Commit MetaInfo

Revision52c913bffb0f96e5c12303169024d00b6f01a7cb (tree)
Time2018-05-11 17:04:17
AuthorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Log Message

[Qt][OpenGL_ES] Fix crash with one board computers with OpenGL ES2.

Change Summary

Incremental Difference

--- a/source/src/qt/gui/gles2/qt_glutil_gles_2.cpp
+++ b/source/src/qt/gui/gles2/qt_glutil_gles_2.cpp
@@ -82,6 +82,36 @@ GLDraw_ES_2::~GLDraw_ES_2()
8282
8383 }
8484
85+void GLDraw_ES_2::initBitmapVertex(void)
86+{
87+ if(using_flags->is_use_one_board_computer()) {
88+ vertexBitmap[0].x = -1.0f;
89+ vertexBitmap[0].y = -1.0f;
90+ vertexBitmap[0].z = 0.5f;
91+ vertexBitmap[0].s = 0.0f;
92+ vertexBitmap[0].t = 1.0f;
93+
94+ vertexBitmap[1].x = +1.0f;
95+ vertexBitmap[1].y = -1.0f;
96+ vertexBitmap[1].z = 0.5f;
97+ vertexBitmap[1].s = 1.0f;
98+ vertexBitmap[1].t = 1.0f;
99+
100+ vertexBitmap[2].x = +1.0f;
101+ vertexBitmap[2].y = +1.0f;
102+ vertexBitmap[2].z = 0.5f;
103+ vertexBitmap[2].s = 1.0f;
104+ vertexBitmap[2].t = 0.0f;
105+
106+ vertexBitmap[3].x = -1.0f;
107+ vertexBitmap[3].y = +1.0f;
108+ vertexBitmap[3].z = 0.5f;
109+ vertexBitmap[3].s = 0.0f;
110+ vertexBitmap[3].t = 0.0f;
111+
112+ }
113+}
114+
85115 void GLDraw_ES_2::initFBO(void)
86116 {
87117 glHorizGrids = (GLfloat *)malloc(sizeof(float) * (using_flags->get_real_screen_height() + 2) * 6);
@@ -842,8 +872,10 @@ void GLDraw_ES_2::drawButtonsMain(int num, bool f_smoosing)
842872 bp->bind();
843873 vp->bind();
844874 prg->bind();
875+ QMatrix4x4 ortho;
876+ ortho.ortho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0, 1.0);
845877 extfunc->glViewport(0, 0, p_wid->width(), p_wid->height());
846- //extfunc->glOrtho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0, 1.0);
878+
847879 extfunc->glActiveTexture(GL_TEXTURE0);
848880 extfunc->glBindTexture(GL_TEXTURE_2D, texid);
849881 if(!f_smoosing) {
@@ -854,6 +886,7 @@ void GLDraw_ES_2::drawButtonsMain(int num, bool f_smoosing)
854886 extfunc->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
855887 }
856888 prg->setUniformValue("a_texture", 0);
889+ prg->setUniformValue("v_ortho", ortho);
857890
858891 ii = prg->uniformLocation("color");
859892 if(ii >= 0) {
@@ -903,8 +936,8 @@ void GLDraw_ES_2::drawBitmapTexture(void)
903936 QVector4D color = QVector4D(1.0f, 1.0f, 1.0f, 1.0f);
904937 smoosing = using_flags->get_config_ptr()->use_opengl_filters;
905938
906- if(using_flags->is_use_one_board_computer()) {
907- extfunc->glDisable(GL_BLEND);
939+ if(using_flags->is_use_one_board_computer() && (uBitmapTextureID != NULL)) {
940+ //extfunc->glDisable(GL_BLEND);
908941 drawMain(bitmap_block,
909942 uBitmapTextureID->textureId(),
910943 color, smoosing);
@@ -1040,7 +1073,7 @@ void GLDraw_ES_2::paintGL(void)
10401073 //extfunc->glOrtho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0, 1.0);
10411074
10421075 extfunc->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1043- extfunc->glEnable(GL_DEPTH_TEST);
1076+ extfunc->glDisable(GL_DEPTH_TEST);
10441077 extfunc->glDisable(GL_BLEND);
10451078 if(using_flags->is_use_one_board_computer() || using_flags->is_use_bitmap()) {
10461079 extfunc->glEnable(GL_BLEND);
--- a/source/src/qt/gui/gles2/qt_glutil_gles_2.h
+++ b/source/src/qt/gui/gles2/qt_glutil_gles_2.h
@@ -103,6 +103,8 @@ protected:
103103 virtual void drawLedMain(GLScreenPack *obj, int num, QVector4D color);
104104 virtual void set_led_vertex(int bit);
105105 virtual void set_osd_vertex(int bit);
106+ virtual void initBitmapVertex(void);
107+
106108 public:
107109 GLDraw_ES_2(GLDrawClass *parent, USING_FLAGS *p, CSP_Logger *logger, EMU *emu = 0);
108110 ~GLDraw_ES_2();
Show on old repository browser