• R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

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


Commit MetaInfo

Revision07ba51d4d9658610699fa22a6d60d0e19ed61db2 (tree)
Time2018-07-02 16:06:10
AuthorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Log Message

[Qt][OpenGL] Fix wrong screen.

Change Summary

Incremental Difference

--- a/source/src/qt/gui/gl2/qt_glutil_gl2_0.cpp
+++ b/source/src/qt/gui/gl2/qt_glutil_gl2_0.cpp
@@ -788,13 +788,22 @@ void GLDraw_2_0::drawGridsMain(GLfloat *tp,
788788 if(tp != NULL) {
789789 int i;
790790 int p = 0;
791+ QMatrix2x2 rot;
791792 extfunc_2->glColor4f(color.x(), color.y(), color.z(), color.w());
792793 extfunc_2->glLineWidth(lineWidth);
793794 extfunc_2->glBegin(GL_LINES);
794- for(i = 0; i < (number + 1); i++) {
795- extfunc_2->glVertex3f(tp[p + 0], tp[p + 1], tp[p + 2]);
796- extfunc_2->glVertex3f(tp[p + 3], tp[p + 4], tp[p + 5]);
797- p += 6;
795+ if((p_config->rotate_type == 1) || (p_config->rotate_type == 3)) {
796+ for(i = 0; i < (number + 1); i++) {
797+ extfunc_2->glVertex3f(tp[p + 1], tp[p + 0], tp[p + 2]);
798+ extfunc_2->glVertex3f(tp[p + 4], tp[p + 3], tp[p + 5]);
799+ p += 6;
800+ }
801+ } else {
802+ for(i = 0; i < (number + 1); i++) {
803+ extfunc_2->glVertex3f(tp[p + 0], tp[p + 1], tp[p + 2]);
804+ extfunc_2->glVertex3f(tp[p + 3], tp[p + 4], tp[p + 5]);
805+ p += 6;
806+ }
798807 }
799808 extfunc_2->glEnd();
800809 }
@@ -982,7 +991,6 @@ void GLDraw_2_0::drawMain(QOpenGLShaderProgram *prg,
982991 prg->setUniformValue("tex_width", (float)p->width());
983992 prg->setUniformValue("tex_height", (float)p->height());
984993 }
985- // ToDo: Put Matrix.
986994 QMatrix2x2 rot;
987995 switch(p_config->rotate_type) {
988996 case 0:
--- a/source/src/qt/gui/gl3/qt_glutil_gl3_0.cpp
+++ b/source/src/qt/gui/gl3/qt_glutil_gl3_0.cpp
@@ -572,19 +572,32 @@ void GLDraw_3_0::drawGridsMain_3(QOpenGLShaderProgram *prg,
572572 bp->bind();
573573 vp->bind();
574574 prg->bind();
575- //GLfloat ff[2];
576- //bp->read(8, &ff, sizeof(GLfloat) * 2);
577- //printf("%d %f %f\n", number, ff[0], ff[1]);
578575
576+ QMatrix2x2 rot;
577+ switch(p_config->rotate_type) {
578+ case 0:
579+ rot = QMatrix2x2(rot0);
580+ break;
581+ case 1:
582+ rot = QMatrix2x2(rot90);
583+ break;
584+ case 2:
585+ rot = QMatrix2x2(rot180);
586+ break;
587+ case 3:
588+ rot = QMatrix2x2(rot270);
589+ break;
590+ default:
591+ rot = QMatrix2x2(rot0);
592+ break;
593+ }
594+ prg->setUniformValue("rotate_mat", rot);
579595 prg->setUniformValue("color", color);
580596 prg->enableAttributeArray("vertex");
581597 int vertex_loc = prg->attributeLocation("vertex");
582598
583599 extfunc->glViewport(0, 0, p_wid->width(), p_wid->height());
584600 extfunc->glOrtho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0, 1.0);
585- //extfunc->glEnable(GL_BLEND);
586- //extfunc->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
587- //extfunc->glBlendFunc(GL_SRC_ALPHA, GL_ONE);
588601 extfunc->glVertexAttribPointer(vertex_loc, 3, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 3, 0);
589602 extfunc->glEnableVertexAttribArray(vertex_loc);
590603
@@ -594,7 +607,7 @@ void GLDraw_3_0::drawGridsMain_3(QOpenGLShaderProgram *prg,
594607 extfunc->glVertexPointer(3, GL_FLOAT, 0, 0);
595608 extfunc->glDrawArrays(GL_LINES, 0, (number + 1) * 2);
596609 extfunc->glDisableClientState(GL_VERTEX_ARRAY);
597- //extfunc->glDisable(GL_BLEND);
610+
598611 prg->release();
599612 vp->release();
600613 bp->release();
@@ -689,14 +702,8 @@ void GLDraw_3_0::renderToTmpFrameBuffer_nPass(GLuint src_texture,
689702 if(ringing_phase > 1.0) ringing_phase = ringing_phase - 1.0;
690703 shader->setUniformValue(ii, ringing_phase);
691704 }
692- //ii = shader->uniformLocation("luma_filter");
693- //if(ii >= 0) {
694- // shader->setUniformValueArray(ii, luma_filter, 24 + 1, 1);
695- //}
696- //ii = shader->uniformLocation("chroma_filter");
697- //if(ii >= 0) {
698- // shader->setUniformValueArray(ii, chroma_filter, 24 + 1, 1);
699- //}
705+ shader->setUniformValue("rotate_mat", QMatrix2x2(rot0));
706+
700707 }
701708 {
702709 QVector4D c(fBrightR, fBrightG, fBrightB, 1.0);
--- a/source/src/qt/gui/gles2/qt_glutil_gles_2.cpp
+++ b/source/src/qt/gui/gles2/qt_glutil_gles_2.cpp
@@ -465,29 +465,35 @@ void GLDraw_ES_2::drawGridsMain_es(QOpenGLShaderProgram *prg,
465465 bp->bind();
466466 vp->bind();
467467 prg->bind();
468- //GLfloat ff[2];
469- //bp->read(8, &ff, sizeof(GLfloat) * 2);
470- //printf("%d %f %f\n", number, ff[0], ff[1]);
471-
468+ QMatrix2x2 rot;
469+ switch(p_config->rotate_type) {
470+ case 0:
471+ rot = QMatrix2x2(rot0);
472+ break;
473+ case 1:
474+ rot = QMatrix2x2(rot90);
475+ break;
476+ case 2:
477+ rot = QMatrix2x2(rot180);
478+ break;
479+ case 3:
480+ rot = QMatrix2x2(rot270);
481+ break;
482+ default:
483+ rot = QMatrix2x2(rot0);
484+ break;
485+ }
486+ prg->setUniformValue("rotate_mat", rot);
472487 prg->setUniformValue("color", color);
473488 prg->enableAttributeArray("vertex");
474489 int vertex_loc = prg->attributeLocation("vertex");
475490
476491 extfunc->glViewport(0, 0, p_wid->width(), p_wid->height());
477- //extfunc->glOrtho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0, 1.0);
478- //extfunc->glEnable(GL_BLEND);
479- //extfunc->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
480- //extfunc->glBlendFunc(GL_SRC_ALPHA, GL_ONE);
481492 extfunc->glVertexAttribPointer(vertex_loc, 3, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 3, 0);
482493 extfunc->glEnableVertexAttribArray(vertex_loc);
483494
484- //extfunc->glEnableClientState(GL_VERTEX_ARRAY);
485- //extfunc->glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
486495 extfunc->glLineWidth(lineWidth);
487- //extfunc->glVertexPointer(3, GL_FLOAT, 0, 0);
488496 extfunc->glDrawArrays(GL_LINES, 0, (number + 1) * 2);
489- //extfunc->glDisableClientState(GL_VERTEX_ARRAY);
490- //extfunc->glDisable(GL_BLEND);
491497 prg->release();
492498 vp->release();
493499 bp->release();
@@ -587,6 +593,31 @@ void GLDraw_ES_2::renderToTmpFrameBuffer_nPass(GLuint src_texture,
587593 if(ringing_phase > 1.0) ringing_phase = ringing_phase - 1.0;
588594 shader->setUniformValue(ii, ringing_phase);
589595 }
596+ QMatrix2x2 rot;
597+ /*
598+ * Note : Not rotate within renderer.
599+ */
600+ /*
601+ switch(p_config->rotate_type) {
602+ case 0:
603+ rot = QMatrix2x2(rot0);
604+ break;
605+ case 1:
606+ rot = QMatrix2x2(rot90);
607+ break;
608+ case 2:
609+ rot = QMatrix2x2(rot180);
610+ break;
611+ case 3:
612+ rot = QMatrix2x2(rot270);
613+ break;
614+ default:
615+ rot = QMatrix2x2(rot0);
616+ break;
617+ }
618+ */
619+ rot = QMatrix2x2(rot0);
620+ shader->setUniformValue("rotate_mat", rot);
590621 //if(!(((gl_major_version >= 3) && (gl_minor_version >= 1)) || (gl_major_version >= 4))){
591622 //ii = shader->uniformLocation("luma_filter");
592623 //if(ii >= 0) {
@@ -619,9 +650,8 @@ void GLDraw_ES_2::renderToTmpFrameBuffer_nPass(GLuint src_texture,
619650 shader->setUniformValue(ii, GL_FALSE);
620651 }
621652 }
622- //shader->setUniformValue("tex_width", (float)w);
623- //shader->setUniformValue("tex_height", (float)h);
624653 }
654+
625655 shader->enableAttributeArray("texcoord");
626656 shader->enableAttributeArray("vertex");
627657
Show on old repository browser