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

How to set position of box2dshape

$
0
0

@Keyu_Gong wrote:

I'm confused about ofxBox2dBaseShape::setPosition(float x, float y).
Is this method going to set polygon's center to desired point?
Here is my code that how I used this method:

ofVec2f personOrigin = persons[nPressedPersonIndex]->getOrigin();

triangles[nPressedPersonIndex].get()->setPosition(personOrigin);
ofVec2f point = triangles[nPressedPersonIndex]->getPosition();

However, the value of "point" is different from the value of "personOrigin".
That is, like, I want to set the position of a polygon to (567, 56), but it goes to (1654, 589).

If this method is not used to set polygon's center to desired position, how can I change my polygon's position?

Posts: 3

Participants: 2

Read full topic


Vertex deformation

$
0
0

@Regi wrote:

Hi All,

I'd like to reproduce a similar surface effect to the example below in a shader:

I'm specifically looking for the 'smoothness' in the noise of deformation.
Any ideas on formulas to look into for this?

Thanks!

Posts: 1

Participants: 1

Read full topic

Simple academic side scrolling game

$
0
0

@Taconito wrote:

Hello to all. I am a beginner with c++ and OpenFrameworks. I have to do a small task for school. I was thinking of creating a simple game similar to the offline google dinosaur. Instead of the dinosaur, a ball that has to jump the boxes.
Can someone help me?

Posts: 1

Participants: 1

Read full topic

Infinite scrolling background from image?

$
0
0

@Taconito wrote:

I have an imported background image.

imageInput.loadImage("background.bmp");

How can I create a animated background where this image moves from right to left in loop?

OF version: 0.8.4

Posts: 1

Participants: 1

Read full topic

Origin (0,0) is under windows title bar

$
0
0

@TimRolls wrote:

Working on an application that is 1280x720, with a Cam (also 1280x720) and GUI displayed at 0,0.
For some reason, it appears to be considering the space under the windows menu bar part of the canvas:

Anyone know why this is happening, or a possible fix? Google and forum searches aren't being much help.

Posts: 1

Participants: 1

Read full topic

projectGenerator-vs,JavaScript error occured,Windows10

I want to read images from a video camera using OpenCv

$
0
0

@samurai wrote:

Hello, Thank you always.

I am studying oF using technical books.
The code written for that book does not work well again.

I get an error [No matching member function for call to 'setFromPixels'] in [setFromPixels ()].

ofApp.h:
#pragma once

#include "ofMain.h"
#include "ofxOpenCv.h"

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);

ofVideoGrabber vidGrabber;
ofxCvColorImage colorImg;

};

ofApp.h:
#include "ofApp.h"

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

ofBackground(0, 0, 0);

vidGrabber.initGrabber(320, 240);

colorImg.allocate(320,240);

}

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

bool bNewFrame = false;
vidGrabber.update();
bNewFrame = vidGrabber.isFrameNew();

if(bNewFrame){
    colorImg.setFromPixels(vidGrabber.getPixels(), 320, 240);
}

}

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

colorImg.draw(10,10);

}

It is like this

please tell me.

Posts: 3

Participants: 2

Read full topic

V0.9.4 linux and Qt Creator

$
0
0

@what wrote:

Hi all, trying to just get OF running in Qt Creator and I'm having the hardest time. I had OF examples working in Qt Creator hours ago but new addons weren't appearing so I tried installing different versions and then everything broke. I've tried uninstalling and reinstalling multiple times to no avail. I keep getting over 30,000 errors. The top one saying

~/of_v0.9.4/libs/poco/lib/linux64/libPocoNetSSL.a(ConsoleCertificateHandler.o):-1: In function `Poco::Net::ConsoleCertificateHandler::onInvalidCertificate(void const*, Poco::Net::VerificationErrorArgs&)':

with a "File not found" error even though it is right there. I also cannot tell if the templates actually installed as Qt Creator is grayed out when I open the Project Generator.

Side question - why even when uninstalling Qt Creator does its icon remain on the dashboard?

Sorry for some many questions I am pretty lost.

Posts: 1

Participants: 1

Read full topic


Listen to ofEvent audioIn in custom class

$
0
0

@wunjeld wrote:

Hi,

How can I listen to the audioIn event in a custom class?

I tried to add the event by:

ofAddListener(ofEvent().audioIn, this, &MyClass::audioIn);

but it seem that audioIn is not a member of ofCoreEvents.

I am working with OF 0.9.4.

Thanks for help,
wun

Posts: 1

Participants: 1

Read full topic

"Main.h was not found" - issues building with ofProjectGenerator for OS X

$
0
0

@acgillette wrote:

I've been trying to get back into openframeworks using the xcode IDE. However I cannot build the first project from ofBook due to these errors. It seems like it's not finding a config file to build the library, but I'm not sure how to fix the issue.

EDIT: Figured it out, I had accidentally downloaded the ios not osx release of openframeworks. I shouldn't try and code at midnight :x

Posts: 2

Participants: 1

Read full topic

Basic shader query

$
0
0

@Sam_McElhinney_io wrote:

Hello all

I am trying to get used to using ofShaders and have a basic query.
Is it possible to set a uniform array, i.e. of points, that the shader can then run calculations with relative to the vertex coordinates? i.e. average distance from shader vertex to all points in the pre-set array?
How would it be best to go about the above?

Best
Sam

Posts: 1

Participants: 1

Read full topic

How change rgb color of background per second?

$
0
0

@Taconito wrote:

how can I change the color of the background, so that every second there is a different color?
The background is simply a single rgb color.

(i use 0.8.4. version)

Thanks!

Posts: 2

Participants: 2

Read full topic

Bind Image texture into a font mesh

$
0
0

@cuinjune wrote:

I tried using font.getFontTexture().bind() with image.bind() but it seems these don't work together.

How to put a texture into a font mesh?

Posts: 1

Participants: 1

Read full topic

How do I create a line or path to move from an object one ofVec3f/ofPoint position to another?

$
0
0

@Anthony_Dunphy wrote:

I have created an instance of ofMesh to create the shapes in the image attached.

I need to draw a circle that moves from the one vertex/vertices to the next?

How do I create a properly create a line that creates a path from one ofVec3f point to another.

e.g. ofVec3f point1(200, 200,0) to ofVec3f point2(400,400,0);

?

Posts: 1

Participants: 1

Read full topic

Wrap Text Around Image/Rect/Area

$
0
0

@dasoe wrote:

Hi all,

this is a "please point me to" question. I have been looking for text addons and I am happily using ofxFontStash for some projects. Now I need a little bit more flexibilty. Request is to define an area and let text flow around it automatically. If necessary, I'll do it myself by defining multiple columns, count the words, spilt the text...

BUT: if there is something like this already out there in a typography-addon, would you please point me to it?

(I am aware that I could also use an embedded browser and use HTML-rendering, which is a tempting workaround for Typography/Layout-problems. But it seems a bit over-the-top. Also I need a very stable product and don't trust in this technology too much. If you can add some experience (pros or cons) please do so also).

Thanks a lot and have a great day!
oe

Posts: 1

Participants: 1

Read full topic


Need help with windows7 touch

$
0
0

@Keyu_Gong wrote:

Hi,
I'm currently working on touch issues with windows7. I've been looking around for a long time. I found theses addons:
ofxWin7: which is a very old one; compatible with oF0.8.0


ofxWinTouch: compatible with oF0.8.0

ofxWinHook: work very well on windows 8 & 10, but I got problems on windows 7

ofxWin8Touch: for windows 8 & 10

For some reasons, I have to work my project on windows 7. But I cannot find a way to solve the "touch" problem on window 7. Can someone help me?

Posts: 1

Participants: 1

Read full topic

How to input a user's drawing

$
0
0

@said_zui wrote:

Hello community,
I need a tutorial on how to scan a physical child's drawing (e.g: a fish) and put it inside a virtual wirld/simulation.
I have done some googling and in this forum but with no lead.
Can you help me please?
Thanks :slight_smile:

Posts: 2

Participants: 2

Read full topic

MSAOpenCL re-initialise buffers

$
0
0

@Sam_McElhinney_io wrote:

Hello All

I am working with the msaOpenCl library on a sketch where I need to update/change the sizes of the buffers on the openCL device, during the running of the app.

I've tried just re-initialising the buffers on an event, (i.e. on a keypress), as follows:`

octreeGPU.initBuffer(octree.size());
for(int i = 0; i < octree.size(); i++) octreeGPU[i] = octree[i];
octreeGPU.writeToDevice();`

Where the octree array is based on a typedef struct as follows:

typedef struct{
float2 origin;
float2 size;
int count = 0;
int children;
int lines[10];
} node;

vector <node> octree;
msa::OpenCLBufferManagedT<node>	octreeGPU; // vector of GPU octree

But doing so crashes the app. Is there a 'correct' approach to resizing and updating the openCl buffers?

Posts: 1

Participants: 1

Read full topic

Vector of Textures is grayscale not RGB

$
0
0

@teganscott wrote:

Hello,

I am trying to create and store textures at runtime, and also recall previously saved textures from the same vector. The pixels being sent into the texture are allocated with GL_RGB, and the colours do show when they aren't being set to the array. When they are set to the array, the texture's glInternalFormat = 2 instead of a long string of numbers

It seems I have two options. Either everything works but it is in grayscale, or there is colour but textures are playing as is (not reading old ones saved in the array).

If anyone has any suggestions it would be much appreciated. I've attached some code for reference.

This is the error I'm getting: [ error ] ofGLUtils: ofGetGLFormatFromInternal(): unknown internal format 2, returning GL_RGBA

header file:

vector<ofTexture*> textures;

.cpp file (update):

int r = 255 * ofRandomuf() +10;
int g = 255 * ofRandomuf() +10;
int b = 255 * ofRandomuf() +10;

ofTexture* tex = new ofTexture();
ofPixels pixels;
pixels.allocate(200,200,OF_PIXELS_RGB);
tex->allocate(200,200,OF_PIXELS_RGB);

for (int i = 0; i < 200; i++){
    for (int j =0; j < 200; j++){

        pixels.setColor(i,j,ofColor((int)(ofRandom(r-10, r+10)),(int)(ofRandom(g-10, g+10)),(int)(ofRandom(b-10, b+10))));
    }
}

tex->loadData(pixels);
textures.push_back(tex);

.cpp file (draw):

textures[accessFrame]->draw(x,y);

Posts: 2

Participants: 1

Read full topic

Problem with OF tutorial code

Viewing all 4929 articles
Browse latest View live