Hello
This is more of a C++ question: I want to draw a group of cubes twice, once as solids, and once as wireframes. I have created a typedef type called drawMode, and now I am trying to use the switch block so that the application decides when to use glutSolidCube() and when to use glutWireCube().
But apparently the switch block complains “solid(my typedef variable) cannot appear in a contan-expression”.
Why?
Definition of my typedef variables (testApp.h)
typedef unsigned int drawMode;
drawMode lines;
drawMode solid;
void drawCubes(drawMode dMode);
Using these variables to determine draw Mode (switch block)
void testApp::drawCubes(drawMode dMode){
for (int i=0; i<ARRAYSIZE; i++){
ofSetColor(myCube[i].col.r,
myCube[i].col.g,
myCube[i].col.b,
128);
ofPushMatrix();
ofTranslate(myCube[i].pos.x,
myCube[i].pos.y,
myCube[i].pos.z);
ofRotateX(myCube[i].rot.x);
ofRotateY(myCube[i].rot.y);
ofRotateZ(myCube[i].rot.z);
switch(dMode) {
case solid:
glutSolidCube(myCube[i].size);
break;
case lines:
myCube[i].col.r -= 20;
myCube[i].col.g -= 20;
myCube[i].col.b -= 20;
glutWireCube(myCube[i].size);
myCube[i].col.r += 20;
myCube[i].col.g += 20;
myCube[i].col.b += 20;
break;
}
ofPopMatrix();
if(rotOnOff) {
myCube[i].rot.x += myCube[i].incRot;
myCube[i].rot.y += myCube[i].incRot;
myCube[i].rot.z += myCube[i].incRot;
};
};
}
//--------------------------------------------------------------
void testApp::draw(){
ofSetWindowTitle("Cubes");
drawCubes(solid);
drawCubes(lines);
ofSetColor(253, 253, 253);
ofDrawBitmapString("FPS :: "+ ofToString(ofGetFrameRate()), 50, 50);
}
Thanks in advance!
Beatriz :mrgreen: