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

OF setup with Qt Creator on windows

$
0
0

@fthrfrl wrote:

Hi all,

I come from a VVVV background and I’m looking to explore OpenFrameworks, but unfortunately I haven’t been able to get any of the examples to compile in order to start getting my bearings.

I’ve installed msys2 & qt creator following the guide on the setup page, but I’ve clearly done something wrong as I’m getting heaps of compile errors like

“…libs\poco\lib\msys2\libPocoNetSSL.a(HTTPSClientSession.o):-1: error: duplicate section `.rdata$_ZTIN4Poco3Net4Impl17SocketAddressImplE[__ZTIN4Poco3Net4Impl17SocketAddressImplE]’ has different size”

and others.

I’m keen to troubleshoot this error, but I’m new to the world of OF, C++ and IDEs and I haven’t been able to find any information I can use to learn what I need to know to fix the problem.

In the setup guide, this line describes adding a compiler:

“To use QtCreator with msys2 go to Qt Creator > Preferences > Build and Run > Compilers and if it’s not there add a compiler that points to c:\msys64\mingw32\bin then in the Kits tab configure the Desktop Kit to use gcc from msys2.”

Unfortunately, I’m prompted to select a specific file within the bin directory, but the information here doesn’t specify which I need to choose. Likewise, I’m not completely sure how to interpret how to specify the right settings in the Kits tab.

If there’s any information that goes into a bit more detail on how to set this up and get running from start to finish, I’d love to check it out. I’ve done a bit of googling, but it seems like just about everyone’s using linux or macs.

Thanks,

F

Posts: 1

Participants: 1

Read full topic


ofPath getVertices, possible with an open path like a line?

$
0
0

@dimitre wrote:

I’ve already understood I have to use line width > 0 to be able to use getVertices command
but I can’t convert a simple line (two points) to ofPolyline. Is there some way to do that? if not, is this the intended usage of getVertices? only for closed polygons or 3 or more points?
Anyway I’ll try to make some rectangles and use the first two points for now.

Thank you

Posts: 1

Participants: 1

Read full topic

Get audio from ofVideoPlayer

$
0
0

@changlongzj wrote:

Hi all,

I was wondering if it is possible to get the audio stream from a video player, I wanted to process the audio from the video that is being played.

Thanks.

Posts: 1

Participants: 1

Read full topic

ofxVideoRecorder save video with effects not working

$
0
0

@Jhovarie_Guiang wrote:

Hello I need help. I am trying to add effects to a video what I did is first

  1. load and play video.
  2. then apply shader to add effects to video.
  3. save video using ofxVideoRecorder…

My problem is I cannot save the video with shader effects … I can only save video without effects whats wrong with my code?

#include "ofApp.h"

ofShader shader;    //Shader
ofFbo fbo;            //Buffer for intermediate drawing
ofImage image;
ofVideoPlayer video; //Declare video player object
ofPixels recordPixels;

void ofApp::setup(){
    shader.load("shaderVert.c",
                "shaderFrag.c" );
   // fbo.allocate( ofGetWidth(), ofGetHeight() );
    fbo.allocate(ofGetWidth(), ofGetHeight(), GL_RGB);
    video.load("300.mp4");
    video.play();
    
    //recording setup ----------------------
    sampleRate = 44100;
    channels = 2;
    ofSetFrameRate(60);
    ofSetLogLevel(OF_LOG_VERBOSE);
    fileName = "testMovie";
    fileExt = ".mov"; // ffmpeg uses the extension to determine the container type. run 'ffmpeg -formats' to see supported formats
    
    // override the default codecs if you like
    // run 'ffmpeg -codecs' to find out what your implementation supports (or -formats on some older versions)
    vidRecorder.setVideoCodec("mpeg4");
    vidRecorder.setVideoBitrate("800k");
    vidRecorder.setAudioCodec("mp3");
    vidRecorder.setAudioBitrate("192k");
    
    ofAddListener(vidRecorder.outputFileCompleteEvent, this, &ofApp::recordingComplete);
    soundStream.setup(this, 0, channels, sampleRate, 256, 4);
    ofEnableAlphaBlending();
    
    //start recording------------------------------------
    
    bRecording = true;
    //vidRecorder.setup(fileName+ofGetTimestampString()+fileExt, ofGetWidth(), ofGetHeight(), 30, sampleRate, channels);
              vidRecorder.setup(fileName+ofGetTimestampString()+fileExt, ofGetWidth(), ofGetHeight(), 30); // no audio
    //            vidRecorder.setup(fileName+ofGetTimestampString()+fileExt, 0,0,0, sampleRate, channels); // no video
    //          vidRecorder.setupCustomOutput(vidGrabber.getWidth(), vidGrabber.getHeight(), 30, sampleRate, channels, "-vcodec mpeg4 -b 1600k -acodec mp2 -ab 128k -f mpegts udp://localhost:1234"); // for custom ffmpeg output string (streaming, etc)
    
    // Start recording
    vidRecorder.start();
    
    fbo.begin();
    ofClear(0, 0, 0, 255);
    fbo.end();
}

//--------------------------------------------------------------
void ofApp::update(){
    fps.updateStartProcess();
    video.update();
    if(video.isFrameNew() && bRecording) {
        //saved video but no shader effects...
        ofPixels pixels; // this is used to store the pixels read from the fbo
        fbo.readToPixels(pixels);
        vidRecorder.addFrame(pixels);
        /*
        //save video with shader effects but it doest not work properly and it run very slow
        ofImage img;
        img.grabScreen(0, 0, ofGetWidth(), ofGetHeight());
        vidRecorder.addFrame(img.getPixels());
        */
    }
    fps.updateEndProcess();
}

void ofApp::draw(){
    fbo.begin();
    ofClear(0, 0, 0, 255);
    video.draw(0,0,1024,768);
    fbo.end();
    
    shader.begin();
    ofSetColor( 255, 255, 255 );
    fbo.draw( 0, 0 );
    shader.end();
    /*
    save video but there is no shader effects
    ofPixels pixels;
    fbo.readToPixels(pixels);
    vidRecorder.addFrame(pixels);
    */
}

Posts: 2

Participants: 2

Read full topic

Qt Creator on mac

Openframework app with hidden window?

$
0
0

@Jhovarie_Guiang wrote:

Hi I am looking for a code that hide window during runtime…
I am looking for a code like the fallowing. I need code that runs on openframework 9.8

//This is for 0.8.0
#include "ofAppNoWindow.h"  
  
int main(){  
    ofAppNoWindow window;  
    ofSetupOpenGL(&window,1024,768,OF_WINDOW);  
    ofRunApp(new testApp);  
}  

I dont want a code like this because it doest not have a window.

#include "ofMain.h"  
#include "ofApp.h"  

int main( ){  
     ofApp * app = new ofApp();  
     app->setup();  
     while(1){  
       app->update();  
     }  
}  

Any help?

Posts: 1

Participants: 1

Read full topic

Polyline with different weights

$
0
0

@snosenzo wrote:

Is there a way to give a specific weight to different segments of an ofPolyline object?
I’m currently using polyline to represent the path of an object in 3D space through time, and I’d like to make the weight of the line at that point in time vary with the speed (i.e. the length of the segment corresponding with the weight).
I know how I would do it with a regular line function, but I’m just curious as to how this would be accomplished with ofPolyline (if it’s possible)

Thanks!

Posts: 2

Participants: 2

Read full topic

How to convert texture2DRect to texture2D shader

$
0
0

@Jhovarie_Guiang wrote:

Hello friends… I am trying to convert texture2DRect to texture2D but it doest not work…
Currently I have a shader that works… it looks like this.

//Fragment shader 
#version 120
#extension GL_ARB_texture_rectangle : enable
#extension GL_EXT_gpu_shader4 : enable

uniform sampler2DRect texture0;

void main(){
	//Getting coordinates of the current pixel in texture
	vec2 pos = gl_TexCoord[0].xy;
	vec4 color = texture2DRect(texture0, pos);
	gl_FragColor = color;
}
//Vertex Shader
#version 120
#extension GL_ARB_texture_rectangle : enable
#extension GL_EXT_gpu_shader4 : enable

void main() {
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
	gl_TexCoord[0] = gl_MultiTexCoord0;
	gl_FrontColor = gl_Color;
}

The above shader code works… but I am trying to convert it like this but ti doest not work.

//Fragment Shader
#version 120

uniform sampler2D texture0;
varying vec2 tex_coords;

void main() {
	vec4 color = texture2D(texture0, tex_coords);
	gl_FragColor = color;
}
//Vertex Shader
#version 120

attribute vec3 vertices;
attribute vec2 textures;

varying vec2 tex_coords;

void main() {
	tex_coords = textures;
	gl_Position = vec4(vertices, 1);
}

How to fixed this?

Posts: 1

Participants: 1

Read full topic


Shader cannot move texture x, y location

$
0
0

@Jhovarie_Guiang wrote:

Crossposted https://computergraphics.stackexchange.com/questions/7557/shader-cannot-move-texture-x-y-location

Hello I am trying to move the x y location of the texture using this code but it doest not work.

//Fragment shader
#version 120
#extension GL_ARB_texture_rectangle : enable
#extension GL_EXT_gpu_shader4 : enable

uniform sampler2DRect texture0;

void main(){
    //Getting coordinates of the current pixel in texture
    vec2 pos = gl_TexCoord[0].xy;

    // pos.x = (pos.x/0.5); //working
    pos.x += 0.2 //<-- not working how to fixed this?

    //Getting the pixel color from the texture texture0 in pos
    vec4 color = texture2DRect(texture0, pos);

    //Changing the color - invert red, green, blue components
    //color.r = 1.0 - color.r;
    color.g = 1.0 - color.g; //working..
    //color.b = 1.0 - color.b;

    //Output the color of shader
    gl_FragColor = color;
}
//Vertex shader
#version 120
#extension GL_ARB_texture_rectangle : enable
#extension GL_EXT_gpu_shader4 : enable

void main() {
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_FrontColor = gl_Color;
}

whats wrong with this code? pos.x += 0.2 //not working how to fixed this?

Posts: 1

Participants: 1

Read full topic

Update OpenSSL version in OF_v0.9.8_android

$
0
0

@Nilupul_Sandeepa wrote:

Hello, I’m using OF_v0.9.8_android in an android app. Play store do not allow me to publish my application because of an OpenSSL 1.02f/1.01r vulnerability. I downloaded one of the nightly builds but it looks different than the current version. Therefore i may have to change a lot in my completed project to integrate nightly build. So could you please let me know is there any way to upgrade OpenSSL version in OF_v0.9.8 to a later version? Any help will be really appreciated. Thank you!

Posts: 1

Participants: 1

Read full topic

Lasso Selection Tool

$
0
0

@molo32 wrote:

someone knows an example to make a lasso tool in processing, I would like to select a group of pixels and drag them as in photoshop

Posts: 1

Participants: 1

Read full topic

Trivial problem with ofRectangles and arrays

$
0
0

@antocreo wrote:

Hello everyone!
I am a bit rusty with C++ and OF and I am having trouble figuring this out, maybe the forum can help?
I created an array of "ofRectangles" and I want to draw them on stage.

in .h

        ofRectangle topLeft, topRight, bottomLeft, bottomRight;
        ofRectangle corners[4] = {topLeft, topRight, bottomLeft, bottomRight};

in .cpp

setup(){
//define corners
    topLeft.set(x0,y0,w,h);
    topRight.set(x1,y1,w,h);
    bottomLeft.set(x2,y2,w,h);
    bottomLeft.set(x3,y3,w,h);
}

draw(){
for (int i=0; i<sizeof(corners)/sizeof(corners[0]); i++) {
        ofPushStyle();
        ofSetColor(100,100,100);
        ofDrawRectangle(corners[i]);
        ofPopStyle();
    }
}

I don’t see them at all. So I guess it’s because in .h the ofRectangles are not defined yet.
So I thought to fill the array in setup() but can’t find a quick way.
Is there any way other than

corners[0] = topLeft;
corners[1] = topRight
//etc. etc..

It sounds trivial and I know it’s only 4 items but still it would be nice to have it automated.

Anyone, any idea?

Cheers :sunny:

Posts: 3

Participants: 2

Read full topic

Setting easycam interaction area

$
0
0

@fresla wrote:

Is there a way to set the interaction area for ofEasycam?
I want to draw the cam into an FBO and draw it to screen say a quarter the size of my screen, along with a bunch of other UI stuff drawn outside of the FBO containing the cam. I want the easycam mouse controls to work inside the quadrant (or area where I draw my FBO).

I can of course restrict the interaction by filtering the mouse position and toggling the mouseEnabled, but this does not give me the correct control, just a portion of the control. I have dealt with this a few times before, and pretty much just ignored it by dodging my UI elements and shutting of mouse interaction when I am over them. For this project I actually need to solve it though.

Any pointers would be great.

Cheers

Fred

Posts: 2

Participants: 2

Read full topic

Create Project - openFrameworks path is not correct

$
0
0

@pablomora wrote:

Hi! I´ma total beginner. Whenever I create a new project I get this message:

The selected project path is not 2 levels below the openFrameworks root folder. If this is not what you were intending, cancel this dialog now and set a new path. Otherwise, select the correct OpenFrameworks path in the following control. This will create the project using absolute paths which might prevent it from working on other computers or if you move the openFrameworks install to a different location. The openFrameworks path is not correct.

I have openFrameworks installed in Microsoft Visual Studio Community 2017.

How do I solve this problem and create a new project?

Posts: 2

Participants: 2

Read full topic

.AddListener with buttons in deque

$
0
0

@jjmaddila wrote:

Hello, I put a collection of buttons in a deque and I trying to use the same .addlistener for each button where the .addlistener would just return the name of the button. My code for calling the listener function is,

ofParameter<ofxButton> button = board_one[index];
button.addListener(this, &ofApp::button_pressed);

and for my listener function I have,

void ofApp::button_pressed(const void * sender) {
	ofxButton * button = (ofxButton*)sender;
	button->getName();
}

Looking at other posts I feel like this should work, and I have no idea what I am doing wrong, but I keep getting this error,
‘ofAddListener’: none of the 5 overloads could convert all the argument types.

Posts: 3

Participants: 3

Read full topic


ofxGui theming issue

$
0
0

@clem wrote:

I’ve noticed some strange behaviour in ofxGui…
If I have the following Gui…

11%20pm

and then open up a colour group, and close it again, then I end up with the selected colour as the header’s background colour:

25%20pm

I can see how that could be useful, but sometimes it just makes the Gui look ugly. If this is a feature rather than a bug, is there a simple way to disable it?

While I’m at it, it would be great if there were more ways to theme the Gui. :slight_smile: For example, is there an easy way to do any of the following…

  1. stop the awkward looking indentation of groups?
  2. give panels, groups, headers and sliders, the option of having rounded corners?
  3. make the whole header clickable to expand collapsed groups rather than having to click on the “+” sign ?
  4. customise the load and save icons (which look ridiculous if I change the default height)?

Posts: 5

Participants: 3

Read full topic

How to install openFrameworks properly?

$
0
0

@Jan wrote:

I can’t get oF to work. First I’ve tried the msys2 install for windows and followed the instructions on the website. I was able to compile the examples, but I couldn’t develop because the msys2 version doesn’t have the project builder. This forces me to use the Qt creator which is a huge install and not something I need or want.

Next I’ve tried using Visual Studio 2017, and after following instructions from their website I couldn’t compile any projects. I would get this error:

Cannot open include file: 'winnt.h': No such file or directory (C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h)

Although when I copy and paste the path into windows explorer it shows that the file is clearly there. At this point I checked all possible permissions and reinstalled all Visual Studio components. The error persisted.

After some digging I’ve found that apparently VS 2017 is not supported so I go ahead and download VS 2015. Do the same install process again only to get the error:

The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools.

So far I found nothing about this error related to oF. Actually some people say that this means I should update to VS 2017 which is a complete contradiction to my previous error.
If anyone can help it would be very much appreciated.

Jan

Posts: 4

Participants: 3

Read full topic

ofxVideoRecorder not working on ubuntu

$
0
0

@Jhovarie_Guiang wrote:

Hello guys I download the ofxVideoRecorder from this link https://github.com/Entropy/ofxVideoRecorder

At first I tried it on MAC OSX I run it and press R on my keyboard and it works…

Now I need to run it on UBUNTU I run it and press R but I get error message like.

[ error ] ofxVideoDataWriterThread: 17:17:20:456 - write to PIPE failed with error -> 9 - Bad file descriptor.
[ error ] ofxAudioDataWriterThread: 17:17:20:461 - write to PIPE failed with error -> 9 - Bad file descriptor.
[ error ] ofxAudioDataWriterThread: 17:17:20:467 - write to PIPE failed with error -> 9 - Bad file descriptor.
[ error ] ofxAudioDataWriterThread: 17:17:20:473 - write to PIPE failed with error -> 9 - Bad file descriptor.
[warning] The video recorder failed to write some frames!:
[warning] The video recorder failed to write some audio samples!:
[ error ] ofxVideoDataWriterThread: 17:17:20:474 - write to PIPE failed with error -> 9 - Bad file descriptor.
[ error ] ofxAudioDataWriterThread: 17:17:20:478 - write to PIPE failed with error -> 9 - Bad file descriptor.
[ error ] ofxAudioDataWriterThread: 17:17:20:484 - write to PIPE failed with error -> 9 - Bad file descriptor.
[warning] The video recorder failed to write some frames!:
[warning] The video recorder failed to write some audio samples!:

Is this a bug? or I need to do something?

Posts: 10

Participants: 3

Read full topic

How to build on Qt designer?

$
0
0

@Bestija wrote:

I followed the guide on the install page and installed oF (qt, msys2). In the mingw terminal examples compile just fine, however I can’t get qt designer to work. It has the “build” option grayed out and says that I have no files in my project even though I used the wizard to create a blank project and that very same blank project does compile under the mingw shell.

What am I doing wrong?
(Win 10, tried oF 0.9.8 and 0.10.0)

Posts: 1

Participants: 1

Read full topic

Reveal invisible characters in strings

$
0
0

@CCx266 wrote:

Hello,
I’m working between ofxNetwork and Pure-Data via TCP.
For checking if the data is passed correctly, you have to set a delimiter for messages.
I noticed that Pure Data is using by default a ‘;’ character, but also it look like there is also a line return like ‘\n’ or something. I want to catch that.

I can receive in OF the raw string from pure data, but how can I see what is invisible in the string ?
Maybe a conversion to Bytes that I can draw on screen and google ?

Thanks in advance.
C

Posts: 2

Participants: 1

Read full topic

Viewing all 4929 articles
Browse latest View live