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

ofVideoGrabber, new camera connected


Light in imported obj files

$
0
0

@edapx wrote:

Hello, I'm having some doubts understanding how openFrameworks is parsing the obj file and positioning the light from it.
I've the Cornell Box scene saved as .obj file, when I open it wit blender, I see that it contains the 2 boxes, the walls AND the light, as you can see from this screenshot.

When I import the file in openFrameworks, without setting any ofLight

void ofApp::setup(){
    ofBackground(255,255,255);
    ofSetVerticalSync(true);
    ofEnableDepthTest();

    model.loadModel("CornellBox-Original.obj", 20);
    model.setRotation(0, 180, 0, 0, 1);
}

//--------------------------------------------------------------
void ofApp::draw(){
    cam.begin();
    model.drawFaces();
    cam.end();
    ofDrawBitmapString(ofToString(ofGetFrameRate(),0), 20, 20);

}

My app shows this image:

I assume that a light it is present in the scene, otherwise I could not see the red and green wall, but it is not clear to me if openFrameworks create an istance of ofLight automatically, independently from the .obj file, or if the light that is there is the Lamp object that was visible in Blender.

Posts: 5

Participants: 2

Read full topic

Emscripten, browser file dialog?

$
0
0

@chuckleplant wrote:

I'm playing with emscripten to put some oF stuff online. I tried running the ofSystemLoadDialog but it just fails.

I think it's because that call works only for desktop OS. I'm looking into using the emscripten api directly, but maybe there's a simpler way? I see a few classes in the ofxEmscripten addon, but I'm not even sure where the emscripten.h file is.

Thanks!

Posts: 2

Participants: 2

Read full topic

How to hide the text of a slider in the ofxUI library?

$
0
0

@Julian_Puppo wrote:

Hello !

Im using ofXUI to make my UI of a software, yet i wasn´t able to find how to hide the text of each slider, it is always been displayed.

This is the library : https://github.com/rezaali/ofxUI

Im using this library has it has a feature that none of the other library has, wich is the range slider, so. . change to another library may not be a good idea.

I´ve can´t find the function for it, wasn´t able to found it in the examples

Posts: 3

Participants: 3

Read full topic

How can I pass 2D array or 1D array as parameters to shader

$
0
0

@Kevin97 wrote:

Hi there,

How can I pass 2D array or 1D array as parameters to shader?
I want to know if I could use UBO or texture to do this.
And, how can declare these stuff in fragment shader?

I have search a lot of resources but nothing, hope someone can help me.

Thanks a lot.

ex:

float *p = new float[arraysize];

or

int p1[][];
int p2[];

Posts: 1

Participants: 1

Read full topic

How to use QT UI with OF?

$
0
0

@haggi wrote:

Hi, I'm quite new to OpenFrameworks. I was able to setup msys2 with qtcreator under Windows10 and compile some examples. Now I'd like to try to use a QT to build a of application. But I have no idea how to do it. Simple example: You usually create a qt widget and display something in it. How can I use a qt widget to show my content created in of?

Posts: 1

Participants: 1

Read full topic

Msys2 and qtcreator 64bit?

$
0
0

@haggi wrote:

I was able to install msys2 and compile the openFrameworks libs with following the instructions on the website. If I now compile an of example, a 32bit application is created. Can I somehow build a 64bit version? I used the C:\msys64\mingw32\bin\g++ to compile the OpenFarmeworks libs simply because the 64bit version silently failed. So I fear without 64bit libs I cannot build a 64bit application, is that correct?

Posts: 1

Participants: 1

Read full topic

OF_RECTMODE_CORNER on ofDrawCircle

$
0
0

@antocreo wrote:

Hi everyone,
apologies if this question sounds stupid but it seems I can't find a way to make the circle drawing from the corner rather than the centre, without using a manual translation.

I've tried ofSetRectMode(OF_RECTMODE_CORNER); in setup and draw but it doesn't change anything.
I've a vague memory of a ofSetEllipseMode function but I can't find anything in the documentation or on the forum. Maybe it's just my imagination...

Also, a genuine question: is there a reason why this changed? I remember the default rectMode was corner for every graphic polygon that was quite intuitive.

Cheers

Posts: 1

Participants: 1

Read full topic


Have an issue with flickering on when trying to draw arc shapes

$
0
0

@Anthony_Dunphy wrote:

I keep getting a weird flickering effect on my shapes when I attempt to draw them

I took a video which is show here of what happen -

What could be causing this issue?

I can post code if needed

Thanks

Posts: 1

Participants: 1

Read full topic

Degrees and Radians

$
0
0

@ayruos wrote:

Hey! Always thought that C++/openFrameworks dealt everything (at least most?) stuff in degrees and been using degrees for a while without any issues for things like laying out stuff in polar coordinates. Today, noticing that there was some erratic behaviour on a new piece of code, it looked like degrees wasn't working and voila, ofDegToRad fixed it.

Just for future reference, what's in degrees and what's in radians?

For example, if I want to lay down a bunch of circles in a circular layout, at every 10 degree intervals, which one is correct?

for(int i = 0; i<360; i+=10){
ofDrawCircle(radius * cos(i), radius * sin(i), circleRadius);
}

OR,

for(int i = 0; i<360; i+=10){
ofDrawCircle(radius * cos(ofDegToRad(i)), radius * sin(ofDegToRad(i)), circleRadius);
}

The second one seems to be correct, but ofRotate is in degrees, right? So is there a handy reference, or a rule of thumb as to what's should be in degrees and what should be in radians?

PS. Seems like a bunch of code I've written in the last few months have this rather basic, stupid error in them :frowning:

Posts: 4

Participants: 3

Read full topic

QT Creator not letting me set compiler for Desktop Kit

Rotating an fbo

$
0
0

@robotPatrol wrote:

i am trying to rotate an fbo.

i have tested the following code in ofapp::draw() {}

layer.bind();
layer.getTexture().getTextureMatrix().newRotationMatrix(ofRandom(360), 30, 50, 78);
layer.draw(0, 0);
layer.unbind();

layer.draw(0, 0); draws, but
layer.getTexture().getTextureMatrix().newRotationMatrix(ofRandom(360), 30, 50, 78); has no effect

nothing renders when i use layer.bind(); and layer.unbind();

thanks,
01

Posts: 1

Participants: 1

Read full topic

How to set correctly sendBundle()

$
0
0

@Dazzid_of wrote:

I have a very basic question. I need to send a package of messages using OSC Bundle. Something similar to this example:

osc::OutboundPacketStream p(buffer, OUTPUT_BUFFER_SIZE);
		p << osc::BeginBundleImmediate
			<< osc::BeginMessage("/qtm/data")
			<< (int64_t)time << (int)time << frameNumber << 0 << 0 << 6 << osc::EndMessage
			<< osc::BeginMessage("/features/timeMS")
			<< (float)time << osc::EndMessage
			<< osc::BeginMessage("/features/bowVioDist")
			<< (float)bowVioDist << osc::EndMessage
			<< osc::BeginMessage("/features/WhichStringAngle")
			<< (float)bowAngle2Violin << osc::EndMessage
...(etc)
            << osc::EndBundle;
		transmitSocket.Send(p.Data(), p.Size());

But using ofxOsc sendBundle(). Searching for examples on OF I still don't find how to properly set the bundle message. I guess I first need to define a ofxOscBundle myMessage but then how to populate the message to be sent by sendBundle(myMessage)?

Posts: 5

Participants: 2

Read full topic

ofImage.setColor() not working

$
0
0

@JackKalish wrote:

I guess this should be pretty simple, but when I draw the image I'm getting a short white line followed by a bunch of random pixel colors. Can someone explain to me why / what I'm doing wrong? Thanks. Screenshot attached below.

//header
ofImage strip;

//cpp file
//--------------------------------------------------------------
void VisualSystem::setup(){
    strip.allocate(75, 1, OF_IMAGE_COLOR);
}

//--------------------------------------------------------------
void VisualSystem::update(){
   //set pixels of image object
    for(int i=0; i<strip.getWidth(); i++){
        ofColor c;
        c.set(255, 0, 0);
        strip.setColor(i, c);
    }
    strip.update();
}

//--------------------------------------------------------------
void VisualSystem::draw(int x, int y){
    strip.draw(x, y);
}

Posts: 3

Participants: 3

Read full topic

ofxTwitter -> Threading?

$
0
0

@ankerr wrote:

Hey,

I'm writing a small sentiment analysis program from ofxTwitters stream features.

Basically, the way I have it set up at the moment is that when a tweet comes in, it sends a GET request of the text to an analysis server that I have set up which returns raw JSON of valence/arousal scores, estimating the emotion conveyed within the tweet.

The problem I'm having is that in the draw() function, I'm plotting these scores as circles on a 2D axis. When I use a particularly active stream filter, the frames drop hugely. Would threading the function that handles the tweet analysis help prevent this?

At the moment, this is what I have:

void ofApp::onStatus(const ofxTwitter::Status& status)
{
string txt = status.text();
ofApp::find_and_replace(txt, " ", "%20");
Tweet tweet;
tweet.text = txt;
bool parsingSuccessful = result.open(urlHeader+ txt +urlFooter);

if (parsingSuccessful)
{
    tweet.rawJSON = result;
    tweet.parse();
    tweets.push_back(tweet);
}
else
{
    ofLogNotice("ofApp::setup")  << "Failed to parse JSON" << endl;
}

}

The draw() function loops through the tweets vector, drawing circles based on the parsed JSON values returned.

Thanks!

Posts: 1

Participants: 1

Read full topic


Asus Xtion Pro Live + odxOpenNI2Grabber addon problem

$
0
0

@zongone wrote:

I'd like to play a bit with Asus Xtion Live and OpenNi lib.
I found odxOpenNI2Grabber addon and compiled example Xtion project but it seems working not properly.
Thats what I see on black backgrund with devault settings:
http://pl.tinypic.com/r/afc9cj/9
When I change default camera width and height it starts to grab same picture but the size of drawn object doesn't match width and height I set:
http://pl.tinypic.com/r/27xkrxf/9

Did anybody have same problem with that addon?
I'd like to see fullscreen xtion preview, but have no idea how to make it happen.

Posts: 1

Participants: 1

Read full topic

Sharing variables/values between windows

$
0
0

@d128 wrote:

Hi everyone, I'm trying to figure out how to share values between two windows. My intention is to create a GUI on the second one to control settings of the first one. I'm working on 0.9.8. This is the code on my main file.

Thanks!

int main( ){
ofGLFWWindowSettings settings;

settings.width = 300;
settings.height = 300;
settings.setPosition(ofVec2f(0,0));
settings.windowMode = OF_WINDOW;
auto guiWindow = ofCreateWindow(settings);


settings.shareContextWith = guiWindow;
settings.setPosition(ofVec2f(1280, 0));
settings.windowMode = OF_FULLSCREEN;
auto mainWindow = ofCreateWindow(settings);

auto guiApp = make_shared<appGUI>();
auto mainApp = make_shared<app>();

ofRunApp(guiWindow, guiApp);
ofRunApp(mainWindow, mainApp);
ofRunMainLoop();

}

Posts: 1

Participants: 1

Read full topic

Cannot convert 'const glm::tvec3 ' to 'float'

$
0
0

@edapx wrote:

Hello, I'm trying to modify the value of a vector by reference, and I'm having this error:

type_vec3.inl:80:5: error: cannot convert 'const glm::tvec3<float, glm::precision::highp>' to 'float' without a conversion operator
                x(static_cast<T>(a)),

This is my method:

void PinholeCamera::getPrimaryRay(float x, float y, int width, int height, glm::vec3& P, glm::vec3& w) const {
    const float side = -2.0f * tan(verticalFieldOfView / 2.0f);

    //the error comes from this line
    P = glm::vec3( z_near * (x / width - 0.5f) * side * width / height,
               z_near * -(y / height - 0.5f) * side,
               z_near);
    glm::vec3 dir = P - centerOfProjection;
    w = glm::normalize(dir);
}

Do you have an idea about what am I doing wrong?

Posts: 2

Participants: 1

Read full topic

Who wrote ofxThreadedImageLoader addon?

$
0
0

@cuinjune wrote:

Hi, I'm using ofxThreadedImageLoader addon for my project.
But I can't find the name of author or copyright info of the source code.

Are the addons that is included in OF_release also MIT licensed?
If so, don't I need to state the code was originally written by someone and not myself above the source file?

Thank you in advance!

Posts: 3

Participants: 2

Read full topic

We take out x, y, z in ofVec3f set by ofParameter individually

$
0
0

@taketori7616 wrote:

We take out x, y, z in ofVec3f set by ofParameter individually.

ofParameter <ofVec3f> position

If you do, extracting x in position is

position.x

So I get an error, what should I do?

Posts: 2

Participants: 2

Read full topic

Viewing all 4929 articles
Browse latest View live