7#include <QHyodaGLCell.h>
8#include <QOpenGLFunctions>
13QHyodaGLCell::QHyodaGLCell(QWidget *parent):
QHyodaGL(parent){
14 qDebug()<<
"\33[36m[QHyodaGLCell::QHyodaGLCell] NEW\33[m";
18void QHyodaGLCell::clear(){
23void QHyodaGLCell::add_node(
const QVector3D &node_coords,
const QColor color){
24 nodes.append(node_coords);
25 colors.append(QVector4D(color.redF(),color.greenF(),color.blueF(),color.alphaF()));
32void QHyodaGLCell::draw()
const{
34 const QColor color=QColor(Qt::green);
36 glEnableClientState(GL_VERTEX_ARRAY);
37 glEnableClientState(GL_COLOR_ARRAY);
40 glVertexPointer(3, GL_FLOAT, 0, nodes.constData());
41 glColorPointer(4, GL_FLOAT, 0, colors.constData());
47 glEnable(GL_LINE_STIPPLE);
48 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
49 if (cell_nb_nodes==3) glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, stdIdx);
50 if (cell_nb_nodes==4) glDrawElements(GL_QUADS, 4, GL_UNSIGNED_BYTE, stdIdx);
51 if (cell_nb_nodes==8) glDrawElements(GL_QUADS, 24, GL_UNSIGNED_BYTE, hexIdx);
55 glDisable(GL_LINE_STIPPLE);
56 glPolygonMode(GL_FRONT, GL_LINE);
57 glPolygonMode(GL_BACK, GL_POINT);
58 if (cell_nb_nodes==3) glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, stdIdx);
59 if (cell_nb_nodes==4) glDrawElements(GL_QUADS, 4, GL_UNSIGNED_BYTE, stdIdx);
60 if (cell_nb_nodes==8) glDrawElements(GL_QUADS, 24, GL_UNSIGNED_BYTE, hexIdx);
63 glDisableClientState(GL_COLOR_ARRAY);
64 glColor4f(color.redF(), color.greenF(), color.blueF(), color.alphaF());
65 glDrawElements(GL_POINTS, 8, GL_UNSIGNED_BYTE, stdIdx);
66 glEnableClientState(GL_COLOR_ARRAY);
70 glDisableClientState(GL_VERTEX_ARRAY);
71 glDisableClientState(GL_COLOR_ARRAY);