Skip to content

Commit 29a9390

Browse files
committed
Various fixes
1 parent f7855d9 commit 29a9390

6 files changed

Lines changed: 29 additions & 12 deletions

File tree

src/fea/doc/RELEASE_NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Bug fixes:
88

99
- Do not display empty "()" in model info box area when no model comment is set
1010
- Do not allow to accept empty model name when renaming a model or creating a new model
11+
- Cannot pick hole edges
1112

1213
------------------------------------------------------------------
1314
Version 1.1.3

src/fea/src/gl_acion_event.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ void GLActionEvent::setMouseEvent(QMouseEvent *mouseEvent, bool release)
8585
{
8686
GLActionEvent::Type prevType = this->getType();
8787
this->buttons = release ? Qt::NoButton : mouseEvent->buttons();
88+
this->keyModifiers = mouseEvent->modifiers();
8889
GLActionEvent::Type currType = this->getType();
8990
this->actionChanged = (prevType != currType);
9091
emit this->changed(currType);

src/fea/src/gl_functions.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
#include <rbl_logger.h>
44

5+
#include <QOpenGLContext>
6+
#include <QOpenGLFunctions>
7+
58
#include "gl_functions.h"
69
#include "gl_vertex_buffer.h"
710

@@ -110,6 +113,11 @@ void GLFunctions::normal3f(GLfloat x, GLfloat y, GLfloat z)
110113
else
111114
{
112115
glNormal3f(x, y, z);
116+
// Also feed aNormal (location 1) so immediate-mode draws work with the GLSL shader.
117+
if (QOpenGLContext *ctx = QOpenGLContext::currentContext())
118+
{
119+
ctx->functions()->glVertexAttrib3f(1, x, y, z);
120+
}
113121
}
114122
}
115123

@@ -144,6 +152,12 @@ void GLFunctions::color4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a)
144152
else
145153
{
146154
glColor4ub(r, g, b, a);
155+
// Also feed aColor (location 2) so immediate-mode draws work with the GLSL shader.
156+
if (QOpenGLContext *ctx = QOpenGLContext::currentContext())
157+
{
158+
ctx->functions()->glVertexAttrib4f(2,
159+
r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
160+
}
147161
}
148162
}
149163

src/fea/src/gl_widget.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -464,13 +464,6 @@ void GLWidget::drawModel()
464464
this->modelDrawTime = modelDrawStopWatch.getMiliSeconds();
465465
}
466466

467-
// Release shader — subsequent non-model drawing uses fixed-function pipeline.
468-
if (this->mainShaderProgram.isValid())
469-
{
470-
this->mainShaderProgram.release();
471-
GLStateCache::instance().setShaderProgram(nullptr);
472-
}
473-
474467
if (this->clippingPlaneEnabled)
475468
{
476469
GL_SAFE_CALL(glDisable(GL_CLIP_PLANE0));
@@ -527,14 +520,21 @@ void GLWidget::drawModel()
527520
gGrid.paint();
528521
}
529522

530-
// Draw draw-engine objects
523+
// Draw draw-engine objects (shader must still be bound for VBO normal/lighting to work)
531524
RLogger::trace("Draw engine objects\n");
532525
const DrawEngine *pDrawEngine = Application::instance()->getSession()->getDrawEngine();
533526
for (uint i=0;i<pDrawEngine->getNObjects();i++)
534527
{
535528
pDrawEngine->getObject(i)->glDraw(this);
536529
}
537530

531+
// Release shader — draw-engine objects above need it, everything below uses fixed-function.
532+
if (this->mainShaderProgram.isValid())
533+
{
534+
this->mainShaderProgram.release();
535+
GLStateCache::instance().setShaderProgram(nullptr);
536+
}
537+
538538
// Draw nodes to move
539539
if (this->drawMoveNodes)
540540
{

src/fea/src/pick_list.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ bool PickList::registerItem(const PickItem &pickItem)
126126
{
127127
if ((*iter) == pickItem)
128128
{
129-
this->items.erase(iter);
129+
iter = this->items.erase(iter);
130130
itemErased = true;
131131
}
132132
else
@@ -208,7 +208,7 @@ void PickList::removeItem(const PickItem &pickItem)
208208
{
209209
if ((*iter) == pickItem)
210210
{
211-
this->items.erase(iter);
211+
iter = this->items.erase(iter);
212212
}
213213
else
214214
{
@@ -228,7 +228,7 @@ void PickList::removeItems(uint modelID)
228228
{
229229
if (iter->getEntityID().getMid() == modelID)
230230
{
231-
this->items.erase(iter);
231+
iter = this->items.erase(iter);
232232
}
233233
else
234234
{
@@ -250,6 +250,7 @@ bool PickList::hasItem(const PickItem &pickItem)
250250
{
251251
return true;
252252
}
253+
++iter;
253254
}
254255
return false;
255256
}

0 commit comments

Comments
 (0)