Quantcast
Channel: advanced - openFrameworks
Viewing all 1244 articles
Browse latest View live

Judder on high framerate cameras

$
0
0

@marsman12019 wrote:

Problem: Slight judder/jitter/stepping when panning cameras

Pipeline: A pair of 60fps color machine vision cameras feeding live video simultaneously over USB 3.0 to 64-bit OF application. Textures straight from the cameras are broadcast via a Syphon server. A Syphon client in a separate OF app (32-bit) receives then draws the videos to an Oculus Rift.

System: Mac OSX 10.10; iMac (Mid 2011), Mac Pro (Late 2013)

Steps taken: Oculus Rifts are notorious for judder, particularly on OSX, so we've done some major experimentation and had a good deal of success in reducing it. The problem seems to still persist when no Rift is present and the window is running on the main display, however, regardless of if video is running through the Oculus SDK.

Plea: Any ideas? The judder is slight, but noticeable, and really detracts from the VR experience.

Posts: 1

Participants: 1

Read full topic


ofImage covers ofVideoplayer?

$
0
0

@jingpe wrote:

hello,

I want to have a video playback on top of the background.. however, the video is always below the background.. any idea?

void SceneInstruction::setup() {
	ofBackground(0,0,0);
    ofEnableSmoothing();
	
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE);
	bg.loadImage("ui/instruction_bg.jpg");

	player.loadMovie("ui/Man_handshake.mp4");
	player.setLoopState(OF_LOOP_NORMAL);
	player.play();
		
	unsigned delay = 500;
	unsigned duration = 1000;	
}

void SceneInstruction::update() {
	player.update();
}

void SceneInstruction::draw() {
	
	bg.draw(0,0);
	if (player.isFrameNew()){
		player.draw(360, 260, 585, 330);
	}
}

Posts: 1

Participants: 1

Read full topic

Poco StreamConverter produces C4250 warning

$
0
0

@Marcio_Pamplona wrote:

When compiling of 0.8.4 in VS2012, the 11.0 compiler produce the C4250 warning.
Described in this link: https://connect.microsoft.com/VisualStudio/feedback/details/733720/

Solution:
Modify the StreamConverter.h.

Add this 2 mocks, in the InputStreamConverter and OutputStreamConverter:

class Foundation_API InputStreamConverter: public StreamConverterIOS, public std::istream
{
public:
InputStreamConverter(std::istream& istr, const TextEncoding& inEncoding, const TextEncoding& outEncoding, int defaultChar = '?');
void Addvtordisp1() { } // Required to avoid VC++ warning C4250
void Addvtordisp2() { } // Required to avoid VC++ warning C4250
~InputStreamConverter();
};

class Foundation_API OutputStreamConverter: public StreamConverterIOS, public std::ostream
{
public:
OutputStreamConverter(std::ostream& ostr, const TextEncoding& inEncoding, const TextEncoding& outEncoding, int defaultChar = '?');
void Addvtordisp1() { } // Required to avoid VC++ warning C4250
void Addvtordisp2() { } // Required to avoid VC++ warning C4250
~OutputStreamConverter();
};

Posts: 1

Participants: 1

Read full topic

Issues with capturing a remote video stream

$
0
0

@NaBUru38 wrote:

Hello, I'm developing a program on OpenFrameworks on Windows 8 to capture and play an RTSP remote video stream.

I have no access to the actual stream yet, so I'm testing the program by streaming an H.264 video with VLC. I've opened another VLC instance on a remote computer and the VLC stream works fine, so the issue must be on the OF program.

Since the program isn't working, I've tried both RTSP and HTTP. The respective addresses are:

streamRtspUrl = "rtsp://localhost:8554/video_address";
streamHttpUrl = "http://localhost:8080/video_address";

First I tried by loading an ofVideoPlayer with "vidPlayer.loadMovie ()" with either address.

With RTSP, the OF program prints that the vidPlayer has loaded, but then it freezes (white window, loading cursor, no exceptions).

With HTTP, the OF program returns an error:

"createMovieFromURL(): couldn't load url "http://localhost:8080/video_address": eOSERR -2048"

, and shows nothing (grey screen, arrow cursor).

Therefore, my second try was to install the Arturo's ofGstVideoPlayer. So before loading the video stream I added:

vidPlayer.setPlayer (ofPtr <ofGstVideoPlayer> (new ofGstVideoPlayer));

With HTTP, the OF program prints that the vidPlayer has loaded and plays the video. If I reload the program, it plays the video again.

But if I restart the stream and reload the program, it prints that the vidPlayer has loaded, but then it shows nothing (grey screen, arrow cursor), and after a few secons it throws an exception at some GStreamer hidden funcion called "feeefeee()".

With RTSP, the OF program prints that the vidPlayer has loaded and plays the video. But if I reload the program, it prints that the vidPlayer has loaded, then prints several errors:

"GStream-CRITICAL **: gst_segment_clip: assertion 'segment -> format == format' failed"

, and shows nothing (grey screen, arrow cursor). Also, if I reload the stream, the same issue happens. The program only starts playing again when I recompile it.

So I'm baffled that there's so many different use cases with this ofVideoPlayer. Any idea of what is happening? Is it an issue with my program or with the addons? Thanks!

Posts: 3

Participants: 2

Read full topic

Enttec usb pro help needed

$
0
0

@rak_multi wrote:

hey there,

i am trying to get the enttec usb pro to work under linux and of 8.4. i am using kyles ofxDmx https://github.com/kylemcdonald/ofxDmx but i am getting some errors:

[notice ] ofSerial: opening /dev/ttyUSB0 @ 57600 bps
[ error ] ofSerial: unable to open /dev/ttyUSB0
[ error ] ofSerial: writeBytes(): serial not inited

Anyone experiences on this? Do i need something more?

lsusb gives me the following, which seems to tell that the device drivers seem to work correctly:

Bus 003 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC

Posts: 2

Participants: 1

Read full topic

ofPolyline getResampledByCount unpredictable behavior

$
0
0

@dimitre wrote:

I’m using ofPolyline getResampledByCount to subdivide a path in equal parts, but sometimes it makes a closed path (first and last points at the same location) and sometimes an opened path (equidistant points in all path).
is there a way of subdividing it equally all the time?
Thank you

EDIT: 0.8.4 in OS X

Posts: 1

Participants: 1

Read full topic

Cleaning up pointers and quitting app

$
0
0

@Venetian wrote:

hi,

suppose in a class I create an array
float *myarray

and initialise it
myClass() {
myarray = new float[10];
}

and the destructor calls:
~myClass (){
delete[] myarray;
}

when I run the app, and quit (apple-Q) I find I get a pointer freed was not allocated error. But pressing stop (top left in X-Code is fine).

Is what I'm doing correct?

How should I understand what quitting the app is doing? Clearly some kind of error here, but I don't see what's wrong yet in this way of doing it.

Posts: 2

Participants: 2

Read full topic

Wrong load of indices with assimp addon and collada file

$
0
0

@taprik wrote:

Hi there,

I'm having an issue loading collada files with the assimp addon.
this the dae file

I'm loading the file correctly but when I try to get the indices, stranger numbers appears.
This code put in the setup function

for (int i=0; i<30; i++){
	cout<<model.getMesh(0).getIndex(i) <<"  ";
	if (i%3 ==2) cout<<endl;
}

give me that :
0 1 2
303 11 0
10 304 0
2 483 0
0 483 303
1 0 304
0 11 10
477 303 476
11 303 477
476 303 483

the correct indices are
47 1223 1224
372 1228 1229
46 1180 1181
1309 1310 410
371 1185 1186
512 1226 1227
49 61 388
425 1221 1222
427 426 411
370 369 359

It seems that assimp is loading the faces and get the indices from faces. And there are not the ones that you can find in the dae file when you edit it with a text editor.
Is there a way to load the correct indices.

Posts: 1

Participants: 1

Read full topic


Equirectangular Projection Shader

$
0
0

@aferriss wrote:

Hi all,

I was wondering if anyone has any experience with generating equirectangular projections from 3d scenes on the fly in glsl. Imagine you have a camera inside a sphere, and want to record the entire sphere into one 2d texture. It seems like this is something that would likely already exist.

The projections look something like these


Some more info on these.

There is also this library for generating the image from a 6 cubemap textures, but it would be nice to just go straight from the 3d scene to the projection without the cube map in between.
https://github.com/madwyn/libcube2cyl

There's lots of information about how to project the equirectangular texture on to a sphere, but very little that describes how the projection is generated in the first place. Any body have any leads?

There is also this page by Paul Bourke about different transformations, and in particular the section on "Converting to and from 6 cubic environment maps and a spherical map" seems like it might offer some hints if you want to do it from a cube map.
http://paulbourke.net/geometry/transformationprojection/

Thanks!

Posts: 2

Participants: 1

Read full topic

Adding vertices to mesh

$
0
0

@jag wrote:

Hi there, any mesh experts out there?

Im appending vertices to a mesh to extend it, like this:

The red dots are the vertices (most of which are covered by the fill).

This is the relevant code that resulted in that image (where bigMesh is the original large rectangle):

void ofApp::keyPressed(int key){

ofMesh mesh2;
mesh2.addVertex(ofVec3f(bigMesh.getVertices()[9].x+50, bigMesh.getVertices()[9].y,0));
mesh2.addVertex(ofVec3f(bigMesh.getVertices()[19].x+50, bigMesh.getVertices()[19].y,0));
mesh2.addVertex(ofVec3f(bigMesh.getVertices()[29].x+50, bigMesh.getVertices()[29].y,0));
mesh2.setMode(OF_PRIMITIVE_TRIANGLES);
bigMesh.append(mesh2);
bigMesh.addTriangle(9, 19, 100);
bigMesh.addTriangle(19, 100, 101);
}

I have a couple questions about the best way to do it.

  1. Do I need to call addTriangle on the mesh for every new vertex I add? Seems like if I dont add a triangle, the white fill will not cover the new vertex.

  2. Is there any way to add a column or row of vertices on an arbitrary side? Say, the left side for example; can I add vertices on the left without complicated mesh copying/ for loop vertex appending? I'm going to be using this logic in randomized terrain generation in a large application, so Im looking for the easiest way to do this.

Thanks!

Posts: 3

Participants: 2

Read full topic

Adding vertices to plane, no color showing

$
0
0

@jag wrote:

Hi there, I'm adding new vertices to a ofVboMesh (from a plane), then creating new triangles out of the vertices to stitch them to them original plane, like this:

void Surface::addVRow(){
float spacing = (seed.shapeSize/(seed.numCols-1));
int vecSize = vboMesh.getVertices().size();
for (int i = seed.numCols; i > 0; i--) {
    //add vertex
    ofVec3f temp = vboMesh.getVertices()[vecSize-i];
    temp = ofVec3f(temp.x, temp.y + spacing, temp.z);
    vboMesh.addVertex(temp);
    vboMesh.addNormal(temp);
}

//stitch new verts into the mesh
stitch();
}

void Surface::stitch(){
if (even){
    for (int i = 1; i < seed.numCols; i++) {
        vector<ofVec3f> meshVerts = vboMesh.getVertices();
        int mSize = meshVerts.size();
        vboMesh.addTriangle(mSize-i, mSize-i-seed.numCols,  mSize-i-seed.numCols-1);
        vboMesh.addTriangle(mSize-i, mSize-i-1, mSize-i-seed.numCols-1);
    }
}
else {
    for (int i = seed.numCols-1; i > 0 ; i--) {
        vector<ofVec3f> meshVerts = vboMesh.getVertices();
        int mSize = meshVerts.size();
        vboMesh.addTriangle(mSize-seed.numCols-i-1, mSize-seed.numCols-i, mSize-i-1);
        vboMesh.addTriangle(mSize-seed.numCols-i, mSize-i-1,  mSize-i);
    }
}
even = !even;
}

This works fine, except the newly added triangles do not reflect any color, it looks like this:

Does anyone know what's up? I thought maybe something to do with normals, but Im not sure...

Posts: 1

Participants: 1

Read full topic

ofVboMesh and ofNode [solved]

$
0
0

@jag wrote:

Hi there, is there any way to do something like giving an ofVboMesh a parent ofNode? I want a mesh of "shapes" to track an ofBoxPrimitive through space. I need to use an ofVboMesh because trying to render a vector of shapes of the size I want is not practical.

Writing my own function to transform each vertex in the mesh to track the box seems like overkill; someone must have had this same issue before? What's the standard way to get mesh vertices to transform according to the transformations of another object through space?

Thanks!

Posts: 9

Participants: 4

Read full topic

Max style utilities using ofThread

$
0
0

@michaelpromeo wrote:

Hello,
I had the idea today to attempt creating an addon of utility functions similar to those used in Max i.e. counter, slide, metro. The reason being that I very often come across situations in OF where it would make it much easier. The issue with this is that many times these functions need to be very precise, for example a drum sequencer that can't fall of beat. In OF even if you use something like 'System Time' it still is in the 60fps update() function. Could anyone recommend a way of breaking out of the update() function aside from using the audio stream? How fast would a separate thread run, is this an option? Thanks for any ideas.

Posts: 1

Participants: 1

Read full topic

Shader : Affect an effect on a texture before it is mapped

$
0
0

@NzNico wrote:

Hi !

A beginner question concerning shaders.

I'm trying to use a shader on a sphere.
I want to apply my shader on a square image I'm using that will be mapped around the sphere.
Once my flat texture has it's effet, I wanted this modified texture be maped around the sphere.

In the following code, the shader is affectig my whole render for an obivous reason.
I can't manage to do anything on my texture before it get's mapped around my shpere.

I'd like to know how to tread my incoming texture as a plane, knowing that it will be applied around my sphere after my "texture" function. This should be done in a same shader.

The vertex shader is ok
Here's the fragment shader

#version 150

uniform sampler2DRect tex0;
in vec2 varyingtexcoord;
uniform sampler2DRect My_image;
out vec4 outputColor;

void main()
{
    float windowWidth = 1024.0;
    float windowHeight = 768.0;
 
    vec4 inter = texture(tex0,varyingtexcoord);
    vec2 interp = gl_FragCoord.xy / vec2(windowWidth, windowHeight);
    
    outputColor = inter * sin(interp.y*2*3.14-0.5);
}

Thanks for your answers

Nicolas

Posts: 2

Participants: 1

Read full topic

ofFbo allocation stops after several seconds on macbook Air

$
0
0

@nosarious wrote:

I have a bit of code in which I allocate a new ofFBO based on whether I am using a movie or an image for this project.

I don't want to use a pre-allocated (in Setup) off because the dimensions will change based on what is being used (movie or image)

What is happening right now is that, after a few seconds of the program running the off is not being used, and I get an error message:
[ error ] ofFbo: FRAMEBUFFER_UNSUPPORTED


ofFbo saveThis;

if (!playMovie){
      saveThis.allocate(backDrop.width,backDrop.height, GL_RGBA);
} else {
       saveThis.allocate(theMovie.width,theMovie.height, GL_RGBA);
}
    
saveThis.begin();
   ofClear(0,0,0,255);
saveThis.end();

I suspect it is a problem with the paltry memory on the Air's graphic card. I am not using the movie allocation at this time, so it is just the image one which is causing problems at this point.

This code is basically preparing an FBO for drawing into to enable saving to a file at a higher resolution than a screen grab would do.

Any help would be appreciated. This code works flawlessly on a mac Mini.

Posts: 1

Participants: 1

Read full topic


Crashing in ofPixels::allocate

Can't find sources for external library GLFW

$
0
0

@Pablo_Gindel wrote:

Hi. I wanted to run OF 0.8.4 on my old VS2010 on Windows XP, so I have to re-compile all the 3rd party external libraries. I actually do it, and so far everything works (addons included!)... but, there is no keyboard capturing on OF apps.

After some researh, I found this problem is related to GLFW library. There is a mismatch between the sources used on OF 0.8.4 and both the 3.1 or 3.1.1, both github and sourceforge GLFW "official" sources.

Specifically, the issue is about the definition of the "GLFWkeyfun" function pointer type used for keyboard callbacks. In OF version it is defined this way:

/*! @brief The function signature for keyboard key callbacks.
 *
 *  This is the function signature for keyboard key callback functions.
 *
 *  @param[in] window The window that received the event.
 *  @param[in] key The [keyboard key](@ref keys) that was pressed or released.
 *  @param[in] scancode The system-specific scancode of the key.
 *  @param[in] codepoint The locale-specific unicode of the key or -1.
 *  @param[in] action @ref GLFW_PRESS, @ref GLFW_RELEASE or @ref GLFW_REPEAT.
 *  @param[in] mods Bit field describing which [modifier keys](@ref mods) were
 *  held down.
 *
 *  @sa glfwSetKeyCallback
 *
 *  @ingroup input
 */
typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,unsigned int,int,int);

while in ALL official GLFW versions, it is defined this way:

/*! @brief The function signature for keyboard key callbacks.
 *
 *  This is the function signature for keyboard key callback functions.
 *
 *  @param[in] window The window that received the event.
 *  @param[in] key The [keyboard key](@ref keys) that was pressed or released.
 *  @param[in] scancode The system-specific scancode of the key.
 *  @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
 *  @param[in] mods Bit field describing which [modifier keys](@ref mods) were
 *  held down.
 *
 *  @sa glfwSetKeyCallback
 *
 *  @ingroup input
 */
typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);

As you can see, when I build an app using OF code and link against the GLFW library compiled from its "official" sources, OF keyboard callback function ( ofAppGLFWWindow::keyboard_cb) actually gets called when I press a key, but the parameters passed to that function don't match, resulting in wrong behavior (by the way, keyReleased() seems to work anyway).

So I need to build GLFW library using the correct "OF" sources, which I can't find anywhere.

Regards,
P.G.

Posts: 1

Participants: 1

Read full topic

Saving/restoring opengl matrix stack

$
0
0

@chaosct wrote:

Hi all,

I am trying to allow unmanaged code (via ofxPython) to my application, that involves arbitrary user-gerenated sequences of drawing commands, such as ofPushMatrix, ofPopMatrix etc...

I am having the trouble that when the user leave unmatched ofPushMatrix / ofPopMatrix, all the program enters in a wrong state and can't draw anything.

Is there any way to save and restore the matrix stack, so I don't care if there are unmatched matrix push/pop operations?

Posts: 1

Participants: 1

Read full topic

Muliple ofShader passes using textures attached to ofFbo

$
0
0

@frauzufall wrote:

I want to implement this example of texture reduction. The idea is to have a set of textures and use one as an input for the shader while binding the result into the next one. This one is then the shader input texture for the next iteration, and so on. This is roughly what I came up with (leaving out some details):

vector<ofTexture> textures;
ofFbo fbo;
ofImage image;
ofShader shader;

image.load(..);

shader.load(..);

fbo.allocate(..);

for(int i = 0; i < steps; i++) {
    textures.push_back(ofTexture());
    textures.at(i).allocate(..);
}

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

    fbo.attachTexture(textures.at(i), GL_RGB, i);
    fbo.begin();

    shader.begin();

    if(i == 0)
        shader.setUniformTexture("tex", image.getTexture(), 0);
    else
        shader.setUniformTexture("tex", fbo.getTexture(i-1), 0);

    glBegin(GL_QUADS);
    ..
    glEnd();

    shader.end();

    fbo.end();       

}

Problem: The result of the shader is always drawn into the first texture. In the image you see the original at the left and the first texture (fbo.getTexture(0)) at the right.

The first iteration using the image texture is drawn to texures[0]. The second iteration using textures[0] is drawn to textures[0]. The third iteration using an empty textures[1] is also drawn to textures[0] (the black rectangle). How can I do this the right way?

Thanks, Deborah

Posts: 1

Participants: 1

Read full topic

Vectors vs Lists, Efficiency when dealing with rapid resizing and deletion

$
0
0

@AceSlowman wrote:

This is a more general c++ question I guess, but I am at the point in my project that I need to start thinking of efficiency.

Right now, I have a custom class, oscThread, which extends of3dPrimitives. Each thread goes into one braid, which is vector<oscThread>, and finally, each braid is organized in space, becoming vector< vector<oscThread> >. My "braids" are a collection of meshes that go between two points, and when the reach their destination point, they need to be removed from memory.

I have been pointed in the direction of using lists over vectors. I know this will take some effort to convert the whole system from utilizing vectors to lists, so I was wondering, does this sound like it would be worth it? The ability to remove and add at any point in the collection makes me feel like lists would be appropriate, but I have dealt with vectors much more often.

Posts: 4

Participants: 3

Read full topic

Viewing all 1244 articles
Browse latest View live


Latest Images