Quantcast
Channel: beginners - openFrameworks
Viewing all 4929 articles
Browse latest View live

Are Projects Portable Amongst Platforms?

$
0
0

@Malveka wrote:

Hi all,

I’m just getting started with openFrameworks and would appreciate any advice on the best ways to develop/package projects. I’m currently developing on Windows 10 using Visual Studio 2017. I’ve installed openFrameworks, played with many of the examples, worked through some of the oF book and created a couple of my own toy projects. All that has been wonderful. :grinning:

My ultimate target platform is a single board computer running Linux. The specific board is yet to be determined, but current contenders include ARM-based processors. My question is… If I develop my project on Windows, what will I be faced with when I ultimately want to move that project to my target platform?

I understand there will be performance considerations based the differing capabilities of my development machine vs. the the target machine. But what other “porting” issues am I likely to face? And what would the porting process look like?

Would it be a matter of installing openFrameworks on the target machine, setting up a new project there, and moving my source into that project? Or…?

Is it better to develop on the target platform to avoid the porting process altogether? But what if one needs to deploy to multiple platforms?

All insights welcomed!

Thanks,
James

Posts: 5

Participants: 3

Read full topic


In OF, Is there any addon looks like "ListView"

$
0
0

@bemoregt wrote:

Hi, All.

In OF, Is there any addon looks like “ListView” that has clickable & sortable array items?

I wonder.

Thanks.

Posts: 1

Participants: 1

Read full topic

Exhibiting Sketches

$
0
0

@Okliis wrote:

Hi all,

Curious as to what everyone does to exhibit several sketches (interactive or not) without the use of several laptops?
If you can point me in the right direction it would be much appreciated.

Cheers.

Posts: 1

Participants: 1

Read full topic

Graphics Fade in/out based on time

$
0
0

@micamac wrote:

Hello I am pretty new to OF I am trying to create a simple 10 minute experience where different graphics fade in and out at specific times within the 10 minutes. I was looking into scheduler and timer but I am not sure if they make the most sense for my use case. Does anyone have any ideas or similar project to help me get this set up?

Posts: 2

Participants: 2

Read full topic

Objects and draw instances

$
0
0

@pxt wrote:

Hey there!
ive a question about instanced in openGL. i want to do instanced drawing in post to getting better perfomance. right now ive a system, a very tipical particle system:

    vector<Obj*>objects;
class Obj{
public:
    
    Obj(float x, float y, float z, int radio, int vertexCount);

     ofSpherePrimitive sphere;

    bool visible;
    void display();
};

as you can see, i keep track every obj position, size, radio, and vertexCount. also, i ve a boolean value to determine if the object are drawing or not.

how can i port this system into a “instanced style” ?
its possible to draw geometry instanced but also keep track every value individually?
what do you think?

Posts: 1

Participants: 1

Read full topic

Using classes to draw shapes

$
0
0

@sunshine wrote:

I’m having trouble setting up my class to draw 4 Rectangles X 6 Rectangles.
This is my Rectangles.hpp

class Rectangles{
public:
    
    int x;
    int y;
    int width;
    int height;
    
    Rectangles();
    Rectangles(int x_in, int y_in, int width_in, int height_in);
    ~Rectangles();
    void setRectangles(int x_in, int y_in, int width_in, int height_in);
    void print(string label);
    
};

This is my Rectangles.cpp

#include "Rectangles.hpp"

Rectangles::Rectangles()
{
    x = 0;
    y = 0;
    width = 0;
    height = 0;
}
void Rectangles::setRectangles(int x_in, int y_in, int width_in, int height_in)
{
    x = x_in;
    y = y_in;
    width = width_in;
    height = height_in;
}
Rectangles::~Rectangles()
{
    
}
void Rectangles::print(string lable)
{
    cout<<"\nRectangle: "<<lable<<endl;
    cout<<"\n x: "<<x;
    cout<<"\n y: "<<y;
    cout<<"\n width: "<<width;
    cout<<"\n height: "<<height;
}

This is my draw()

void ofApp::draw(){

    for (int i = 0; i<25; i++) {
        ofDrawRectangle(i+180, i + 100, 40, 80);
    }
}

I’m confused on how to set up my class in a way that I am able to use the member functions in my draw() to make 4 Rectangles X 6 Rectangles.

Posts: 2

Participants: 1

Read full topic

RGB color is strange and green colored saturated

$
0
0

@bemoregt wrote:

HI, All.

//--------------------------------------------------------------
void ofApp::setup(){

decoder.decode("/Users/mun/Desktop/cat.gif");

file = decoder.getFile();

}
//--------------------------------------------------------------
void ofApp::draw(){

float normalX = float(ofGetMouseX()) /ofGetWidth();
file.drawFrame(normalX * file.getNumFrames(),
               0,0,file.getWidth()*2,  file.getHeight()*2);

}

I’ve tested ofxGIFDecoder addon.
But, Like above picture, RGB color is strange and green colored saturated for all gif files.

So, I want to Color Convert.
But, This code use ofxGif file structure instead of ofImage or cv::Mat.
So I cant convert color.
And, Unfortunately, ofxGifDecoder site doesn’t have issue board.

How can I rearrange the color for GIF files in this code?

Thanks.

Posts: 1

Participants: 1

Read full topic

vidGrabber with shader

$
0
0

@Koji_Kanao wrote:

I’m trying to manipulate frames from webcam but seems my input has issues.
I could pass texture from oF to shader, but the input is flipped and a little bit glitchy

Any suggestions are really appreciated.

Also would like to get advice about u_resolution.
I’m writing this, but feel this isn’t a good way.

    float fw =ofMap(w, 0, w, .0, 1.0);
    float fh =ofMap(h, 0, h, .0, 1.0);
    shader.setUniform2f("u_resolution", fw, fh);

My code is the following

ofApp.cpp

//--------------------------------------------------------------
void ofApp::setup(){
    w = ofGetWidth();
    h = ofGetHeight();
    vidGrabber.setDeviceID(0);
    vidGrabber.initGrabber(w, h);
}

//--------------------------------------------------------------
void ofApp::update(){
    vidGrabber.update();
}

//--------------------------------------------------------------
void ofApp::draw(){
    shader.load("", "test.frag");
    shader.begin();
    shader.setUniform1f("u_time", ofGetElapsedTimef());
    float fw =ofMap(w, 0, w, .0, 1.0);
    float fh =ofMap(h, 0, h, .0, 1.0);
    shader.setUniform2f("u_resolution", fw, fh);
    shader.setUniformTexture("tex0",vidGrabber.getTexture(),0);
    ofDrawRectangle(0,0, ofGetWidth(), ofGetHeight());
    shader.end();
}

fragment shader

uniform vec2 u_resolution;
uniform sampler2DRect tex0;

void main(){
    vec2 uv=gl_FragCoord.xy/u_resolution.xy;
    gl_FragColor=texture2DRect(tex0, uv);
}

Posts: 7

Participants: 4

Read full topic


[Spectrogram] No member named 'draw' in 'ofxFft'

How can I remain the drawn boxes?

$
0
0

@bemoregt wrote:

Hi, All.

I have made Spectrogram of mp3 files.

But, in draw() method, drawn boxes are not remained.
How can I remain the drawn boxes ?

//--------------------------------------------------------------
void ofApp::setup(){
dog.load("/Users/mun/Desktop/woman.mp3");
j=0;
ofBackground(55);
}
//--------------------------------------------------------------
void ofApp::update(){
// by taking maximums, as peaks and then smoothing downward
float * val = ofSoundGetSpectrum(nBandsToGet);
for (int i = 0;i < nBandsToGet; i++){
// let the smoothed value sink to zero:
fftSmoothed[i] *= 0.96f;

	// take the max, either the smoothed or the incoming:
	if (fftSmoothed[i] < val[i]) fftSmoothed[i] = val[i];
}

}
//--------------------------------------------------------------
void ofApp::draw(){
float width = (float)(512) / nBandsToGet;
//
for (int i = 0;i < nBandsToGet; i++){
col= fftSmoothed[i]*125000;
if(col>255) col=255;
ofSetColor(col);
ofDrawRectangle(j, i, 1, 1);
}
j+=1;
if(j > 512) j=0;
}

Thanks.

Posts: 2

Participants: 2

Read full topic

Bzero : identifier not found in ofxAccelerometerHandler?

$
0
0

@Drazinut wrote:

I’m trying to use ofxAccelerometerHandler (though it sounds like it’s not going to work when I get to iOS?), but it throws a build error:

bzero : identifier not found

Searching the OF directories, it looks like ofxAccelerometerHandler is the only source file mentioning bzero.

I’m wondering if this is just me not knowing I need to #include something else, or if I should define bzero as some other memory-zeroing function, or if this is a sign that ofxAccelerometerHandler has been abandoned and I should be using something else for acceleration & tilt data?

Posts: 2

Participants: 1

Read full topic

How do I use touch functions in a webview

$
0
0

@pjb438458200 wrote:

I want to add webview as UI on the 3d scene,

By setting the WebView. SetBackgroundColor (android. R.c olor. Transparent), i can see the 3 d scene

But OfEasyCam, ofApp: : touchDown, ofApp: : touchUp cannot trigger, who can help me

Posts: 1

Participants: 1

Read full topic

Gradually Growing Shape

$
0
0

@micamac wrote:

I would like to make a shape smoothly and slowly gradually grow in size. I have tried to use ofScale(); but it moves too quickly and not as smooth as I would like. Any ideas on another approach?

Posts: 1

Participants: 1

Read full topic

SVG not showing

$
0
0

@eduzal wrote:

Hi, I’m trying to get a visualization of a simple SVG file but ofX is not rendering.
I have an svg file, with 860 polygons in it, not paths. is there an issue with svg polygons in ofX?

the code is very simple at this moment. getNumPath() is working. is giving me the correct answer, but it’s not rendering. what is the problem?

class ofApp : 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 mouseEntered(int x, int y);
		void mouseExited(int x, int y);
		void windowResized(int w, int h);
		void dragEvent(ofDragInfo dragInfo);
		void gotMessage(ofMessage msg);
    
        ofxSVG svg;
		
};
void ofApp::setup(){

    ofBackground(255);
    ofSetColor(0);
    
    svg.load("tijolos2.svg");
    cout<<svg.getNumPath(); 
}

void ofApp::draw(){
    ofDrawBitmapString(ofToString(ofGetFrameRate()),20,20);
  
    svg.draw();
}

Posts: 1

Participants: 1

Read full topic

Issue with Arabic Type

$
0
0

@Okliis wrote:

Hi all,
Trying to display Arabic text and I’m not getting the correct letter forms (initial, medial and final).
All it displays is the “detached” form of the letters.

I have added the unicode ranges that I thought would take care of them (ArabicPresFormsA & B), but it still isn’t working.
Here’s a snippet:

ofTrueTypeFontSettings settings("DubaiRegular.ttf", 155);
    settings.addRange(ofUnicode::Arabic);
    settings.addRange(ofUnicode::ArabicPresFormsA);
    settings.addRange(ofUnicode::ArabicPresFormsB);
    
    ttf.load(settings);
    s = "دبي";

The text should look like what I initialized the above string (s), however it ends up looking like this (detached form only):

Anybody have an idea, or experience with Arabic type?

Thanks in advance,
O

Posts: 5

Participants: 2

Read full topic


Project cannot be built with ofxSVG because of error: undefined reference to 'svgtiny_create'

$
0
0

@Pradeep_Jayasinghe wrote:

I am trying to load a simple svg to my android project using ofxSVG addon. But I cannot build the project when ofxSVG addon is added. It shows multiple errors.

addons/ofxSvg/src/ofxSvg.cpp:24: error: undefined reference to 'svgtiny_create'
addons/ofxSvg/src/ofxSvg.cpp:25: error: undefined reference to 'svgtiny_parse'
addons/ofxSvg/src/ofxSvg.cpp:55: error: undefined reference to 'svgtiny_free'

I am using OF version 0.10.1 for android.

Here is my ofApp.cpp code

void ofApp::setup(){
    svg.load("example.svg");
	ofBackground(255,255,255);
	ofSetColor(255,255,255);
}

void ofApp::draw(){
	svg.draw();
}

Posts: 1

Participants: 1

Read full topic

Cannot hear sound when running audioOutputExample using Emscripten

$
0
0

@cuinjune wrote:

I could successfully build audioOutputExample using emmake make.

And when I run the project using emrun --browser chrome bin/audioOutputExample.html, I see the following screen:

But I can neither hear any sound nor see the graphs move.

I also have the following warning in the console:

[warning] ofSoundStream::getDeviceList() not supported in emscripten

Is it possible to properly run ofSoundStream based examples using Emscripten?

Posts: 1

Participants: 1

Read full topic

Creating a grid like mesh and texturing it

$
0
0

@RealHuman wrote:

Hello. Still learning openframeworks and getting used to how it works. I want to build a simple 2d mesh, pretty much a grid, and then texture it. It seems like the resources out there to do this are a bit limited. I followed as many forum posts as I could, but I am still unsure how to exactly go about it.

Comments are other things I tried and tested around with.

Any help is appreciated, thank you.

//--------------------------------------------------------------
void ofApp::setup(){
    
    ofBackground(0);
    ofDisableArbTex();
    
    int W = 100; //Grid size
    int H = 100;
    int meshSize = 6;
    
    texture.load("ichi.jpg");
    //texture.getTexture().setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
    //texture.getTexture().setTextureWrap(GL_REPEAT, GL_REPEAT);

    
    for (int y=0; y<H; y++) {
        for (int x=0; x<W; x++) {
            mesh.addVertex(ofPoint(x * meshSize, y * meshSize, 0 ));
            mesh.addTexCoord(ofVec2f(x * meshSize, y * meshSize));
        }
    }
    
    /*
     for (int y=0; y<H; y++) {
     for (int x=0; x<W; x++) {
     mesh.addVertex(ofPoint((x - W/2) * meshSize, (y - H/2) * meshSize, 0 ));
     mesh.addTexCoord(ofVec2f(x * (550 / W), y * (768 / H)));
     }
     }
    */

}

//--------------------------------------------------------------
void ofApp::draw(){
    //ofSetColor(0);
    //mesh.drawWireframe();
    
    ofSetColor(255);
    texture.bind();
    mesh.draw();
    texture.unbind();
}

Posts: 1

Participants: 1

Read full topic

Missing .dll file on executing compiled windows app

$
0
0

@Sam_McElhinney_io wrote:

Hello all

I have an app that I’m compiling for both Mac and Windows. On the windows compile, I’ve learnt that I need to include a series of dll files in order for the .exe file to run. I include these in the /bin folder by simply copying them across.

For what seems like the majority of windows users, this works fine - the .exe file runs no problem. But, with one or two users, they get a persistent message reading *‘The code execution could not proceed because ***.dll was not found. Reinstalling the program may fix this problem’

Does anyone know why this is happening and how we might fix it?

In hope
Sam

Posts: 3

Participants: 3

Read full topic

Inhale/Exhale Particles

$
0
0

@micamac wrote:

I want to make a system of particles that move in a way that make them appear to inhale/exhale. In other words, have particles floating then slowing come together, then slowly spread out once again. Whats the easiest way I could do this? I have some circles already coded that slowly are moving back and forth but I am not sure how to make them move in the manner I would like. Here is what I have so far:

for (int i = 0; i < 800; i++) {

    ofPoint point(ofMap(ofNoise(ofRandom(50) + ofGetFrameNum() * 0.00003), 0, 1, width * -0.5, width * 1.5),
                  ofMap(ofNoise(ofRandom(50) + ofGetFrameNum() * 0.00001), 0, 1, height * -0.5, height * 1.5));
    float radius = ofRandom(1, 2);
    ofColor circle_color;
    circle_color.setHsb(0, 0, 300);
    
    if (timer < 60) {
        ofSetColor(255, 255, 255, 255 * ofGetElapsedTimef()/70);
        ofDrawCircle(point, radius);
    }
    else {
        ofPushMatrix();
        ofFill();
        ofSetColor(255, 255, 255);
        ofDrawCircle(point, radius);
        ofFill();
        
    }

Posts: 1

Participants: 1

Read full topic

Viewing all 4929 articles
Browse latest View live