Sorry I cannot give you a more clear headline, but i just don’t understand it better.
I use:
OSX 10.6.8
oF 007 (also tested in 0071)
Xcode 3.2.4
When I try to run my project, it crashes after several seconds (sometimes it takes longer, sometimes shorter), and then I get this message:
Assertion failed: (LEQ( **(i+1), **i )), function pqInit, file /Users/theo/Documents/CODE/__OPENFRAMEWORKS/SANDBOX/COMPILE_LIBRARIES/tess/src/Sources/priorityq.c, line 413.
Program received signal: SIGABRT.
sharedlibrary apply-load-rules all
warning: Could not find object file "/Users/theo/Documents/CODE/__OPENFRAMEWORKS/gitOF/openFrameworks/apps/devApps/macDragDropExample/buildGlutFrameworkHackedWindowLevel10.4/libForeground.a(macx_foreground.o)" - no debug information available for "/Users/mcast/Code/GLUT-ToPost/macx_foreground.m".
I searched for the file “priorityq.c” and couldn’t find it anywhere. Also I have no user named “theo”.
Is this maybe a relict from a library theo made?
I use ofxVectorGraphics & ofxSVGTiny.
The weird thing is, that even code that was compiled yesterday without any issue, gets the same error now. (wtf?)
I downloaded and installed a several fresh versions of openframeworks (007 & 0071), because i assumed that i might broke it somehow.
But it is weird, because i never got the error before.
Could it be a memory-issue? I checked my arrays and variables, and could not find something that could blow the code up. Also, then it must have happened before, too, because my code did not change.
Strange! I feel like it must be obvious and simple, but i just cannot see it!
Maybe someone can provide me with some insight?
In case you want to know what my application does:
I load svg-fonts and interpolate them on the fly, so that i can morph a serif-font into a sans-serif-font smoothly from the beginning of a page to the end.
here’s my main.cpp:
// this file sets up the box
#include "ofMain.h"
#include "testApp.h"
#include "ofAppGlutWindow.h"
//========================================================================
int main( ){
ofAppGlutWindow window;
ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp( new testApp());
}
testApp.h
#pragma once
#include "ofMain.h"
#include "ofBall.h"
class testApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed (int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
// here some variables are introduced, they will be explained when used
int screenWidth;
int screenHeight;
int dimspX;
int dimspY;
int lettercount;
int msX;
int msY;
ofxVectorGraphics output;
bool savePDF;
bool savePDF1;
private:
ofBall** myBallA;
int nBallsX; // amount rows
int nBallsY; // amount lines
int nBalls; // amount balls
};
testApp.cpp
// In this file, all variables and functions used
#include "testApp.h"
#include "ofxVectorGraphics.h"
#include "ofxSVGTiny.h"
ofxSVGTiny svg;
ofxSVGTiny svg2;
ofxSVGTiny font1;
ofxSVGTiny font2;
ofxSVGTiny font3;
//--------------------------------------------------------------
void testApp::setup()
{
svg.load("svg_r_2.svg"); // this is font1
svg2.load("svg_r_1.svg"); //this is font2
ofSetVerticalSync(true);
ofSetFrameRate(30);
ofBackground(255);
ofSetColor(0);
screenWidth = ofGetScreenWidth();
screenHeight = ofGetScreenHeight();
dimspX = 60; // Character space
dimspY = 100; // Lineheight
nBallsX = (screenWidth/dimspX)-6; //*2 because i will translate screenwidth for smaller textsize
nBallsY = (screenHeight/(dimspY))-1;
nBalls = nBallsX*nBallsY;
// red balls
int k = 0;
myBallA = new ofBall*[nBalls];
for (int i = 0; i < nBallsY; i++){
for (int j = 0; j < nBallsX; j++) {
float x = (dimspX*j);
float y = ((dimspY)*i);
myBallA[k] = new ofBall(x,y,nBalls);
k++;
}
}
lettercount=0;
savePDF = false;
savePDF1 = false;
}
//--------------------------------------------------------------
void testApp::update()
{
for (int i = 0; i < nBalls; i++){
myBallA[i]->update(1);
}
}
//--------------------------------------------------------------
void testApp::draw()
{
if( savePDF ){
ofBeginSaveScreenAsPDF("screenshot-"+ofGetTimestampString()+".pdf", true);
}
//
// string msg = string("This");
// msg += "\nfps: " + ofToString(ofGetFrameRate(), 2);
// ofSetHexColor(0xFF8080);
// ofDrawBitmapString(msg, 10, 20);
for (int i = 0; i < nBalls; i++){
myBallA[i]->draw(i,0,0,0,6,nBalls,svg,svg2);
}
if( savePDF ){
ofEndSaveScreenAsPDF();
savePDF = false;
// endsavePDF = false;
}
}
//--------------------------------------------------------------
void testApp::keyPressed(int key)
{
if(key!='0'){
myBallA[lettercount]->keyPressed(key, lettercount);
lettercount++;
}
if (lettercount>=nBalls){
lettercount=0;
}
if(key=='0'){
savePDF = true;
}
}
//--------------------------------------------------------------
void testApp::keyReleased(int key)
{
}
//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y)
{
myBallA[lettercount]->mouseMoved(x, y);
}
//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button)
{
}
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button)
{
}
//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button)
{
}
//--------------------------------------------------------------
void testApp::windowResized(int w, int h)
{
}
//--------------------------------------------------------------
void testApp::gotMessage(ofMessage msg)
{
}
//--------------------------------------------------------------
void testApp::dragEvent(ofDragInfo dragInfo)
{
}
ofBall.h // yes, I did not rename it after raping its ingredients
#ifndef _OF_BALL // by using this if statement you prevent the class to be called more than once - in other words what we're saying here is
#define _OF_BALL //if the class has NOT been defined then define it
#include "ofxVectorGraphics.h"
#include "ofMain.h"
#include "ofxSVGTiny.h"
class ofBall {
public:
// methods
void update(int col);
void draw(int num, int r, int g, int b, float dick, int ran, ofxSVGTiny svg, ofxSVGTiny svg2);
void mouseMoved(int x, int y );
void keyPressed(int key, int lettercount);
//constructor
ofBall(float pX, float pY, int dim);
// variables
float pX;
float pY;
int letterAmount;
float speedX;
float speedY;
float msX; // mouse X
float msY; // mouse Y
int range; // range of mouse magnetics
char letter[];
char randomness[];
int lettercount;
bool snapBack; // toggle drawing mode
ofxVectorGraphics output;
bool capture;
bool bFill;
// my super variables
float vvHereX;
float vvHereY;
float vvHereZ;
float tweenCount;
bool countUp;
bool svgLoad;
int svgNum;
bool savePDF;
bool endPDF;
//int timeCount;
bool aniSinus;
private:
}; //don't forget the semicolon in the end of the class definition
#endif
ofBall.cpp
#include "ofBall.h"
#include "ofxSVGTiny.h"
ofBall::ofBall(float posX, float posY, int _letterAmount)
{
pX = posX; // this tells me, where to place the letter x-wise
pY = posY; // this tells me, where to place the letter y-wise
//
letterAmount = _letterAmount; // this tells me how many letters there are
msX=0; // unnecessary yet
msY=0; // unnecessary yet
//
// range = 60; // magnet range // unnecessary yet
// capture = false; // necessary yet
bFill = true; // not working yet
tweenCount = 0; // necessary? yes! yes! this is the value controlling interpolation
// countUp=true; // necessary? no!
// svgLoad=true; // necessary? not anymore
for (int i=0; i<letterAmount; i++){ // "letter" is the array that stores which letter should be on which position.
letter[i] = ' '; // it starts with emptiness everywhere
}
savePDF = false; // trying to export as pdf, not working yet
endPDF = false; // trying to export as pdf, not working yet
aniSinus=false; // if set to "true", the interpolation is animated in a loop
}
void ofBall::update(int col){
}
void ofBall::draw(int num, int r, int g, int b, float dick, int ran, ofxSVGTiny svg, ofxSVGTiny svg2){
//do we want filled shapes or outlines? -> does not work yet
// if(bFill)output.fill();
// else output.noFill();
if(aniSinus){
float sinum = num+10*ofGetElapsedTimef();
tweenCount = (sin(sinum/6)+1)/2; // ... +1)/2 -> schiebt sinus nach oben und halbiert, damit 1 das maximum ist fürs interpolieren
} else {
float sinum = num;
tweenCount = 1-(sinum/ran); // interpolating from start to end
}
svgNum=toascii(letter[num])-96; // here i am converting the value i get from the keyboard to ascii, for getting the right letter
if (svgNum>=27||svgNum<=0){ // if the value is out of range
svgNum=0; // make it emptiness
}
for (int i = 0; i < svg.getNumPath(); i++)
{
ofPath &p = svg.getPathAt(svgNum); // first font: svgNum toggles svg-layer/letter
ofPath &p2 = svg2.getPathAt(svgNum); // second font: dito
vector<ofPolyline>& lines = p.getOutline(); // getOutline() says it. store it in "line" and "line2"
vector<ofPolyline>& lines2 = p2.getOutline();
for (int k = 0; k < lines.size(); k++) // there are a lot of lines. size tells you how many
{
ofPolyline line = lines[k]; // for every line in "lines", the loop will run once
ofPolyline line2 = lines2[k]; // same here
// int num = ((1-tweenCount)*line.size())+(tweenCount*line2.size()); //former attempt of interpolation // original: int num = step * line.size();
// glBegin(GL_LINE_STRIP); // enable openGL rendering, later hopefully able to render filled letters
ofFill();
// ofNoFill();
ofEnableAlphaBlending();
ofSetColor(255,255,255);
if(k==0){
ofSetColor(0,0,0);
}
// ofSetLineWidth(2);
ofBeginShape();
for (int j = 0; j < line.size(); j++)
{
ofVec3f &vv = line[j];
ofVec3f &vv2 = line2[j];
vvHereX = pX+((1-tweenCount)*vv.x)+(tweenCount*vv2.x); // simple interpolation from one
vvHereY = pY+((1-tweenCount)*vv.y)+(tweenCount*vv2.y);
vvHereZ = 0; // experimental 3Dimensional value
ofVertex(vvHereX, vvHereY); // actually draw the letter
} // experimantel 3d: vvHereZ+ofRandom(msX));
ofEndShape();
ofDisableAlphaBlending();
// glEnd();
}
}
}
void ofBall::mouseMoved(int x, int y ){
// mouseposition for later interaction
msX = x;
msY = y;
cout << "msX" << msX << endl;;
}
//--------------------------------------------------------------
void ofBall::keyPressed (int key, int lettercount){
letter[lettercount] = key;
}
Thanks a lot!