Quantcast
Viewing all 4929 articles
Browse latest View live

How to get accurate float PI constant?

@cuinjune wrote:

Hi, I'm trying to use PI as float.

I wonder if it is safe to just cast PI to float constant like below.

static_cast< float >(PI)

If I print the value, it prints 3.14159

Would this be accurate enough to use PI as float or should I create another float constant?

Thank you!

Posts: 4

Participants: 3

Read full topic


To Learn C++ First or Learning as You GO? That is the question

@popa wrote:

I was wondering if I should learn C++ first or if I could learn it as im working through OF. I know that it would be a whole lot easier know C++ before coming in. It's just I would rather learn it as im working through OF.
popa

Posts: 3

Participants: 2

Read full topic

Camera projector calibration

Vectors is there a difference

@cyrstem wrote:

hi i been wondering if there is any difference between writing a vector like this :
std::vector<float> myPositions; or vector<float> myPost
and
std::size_t i = 0; i < myPositions.size(); i++ or int i = 0 < myPositions.size(); i++
i wonder because i saw this recently in some examples and i wonder if there is any reason for doing it like this

Posts: 2

Participants: 2

Read full topic

ofFbo, clear just a section of the area with transparency

@dimitre wrote:

Hello, I wanted to clear out and redraw just a small area of an ofFbo.
I've tried to draw a rectangle with transparency but it obviously blend with the actual content. same thing for a transparent image. I'm pretty confident it can be done quickly with a shader, but just wondering if is there a way of cutting off a rectangle from an arbitrary area inside an ofFbo.

Thank you!

Posts: 1

Participants: 1

Read full topic

How to create a round corner window?

What is Cairo (as in ofCairoRenderer)?

@Drazinut wrote:

I read that basic questions are welcome, and questions about what isn't clear to new users, so here's one.

What is Cairo? I am studying what is under OpenFrameworks/documentation/graphics, and I see there is a section on something (a class, apparently) called ofCairoRenderer, but like much of the documentation there, it is extremely sparse on explaining what many things are or what one might do with them, or how exactly. In this case, I see:

Extends
This class extends others, you can call their methods on an instance of ofCairoRenderer too:
ofBaseRenderer

Which implies to me that it's either a new system that is somehow different from ofGraphics, or something. It mentions ofBaseRenderer, but that class is not mentioned in the documentation/graphics subsection. Is there anyplace I might go to find out what Cairo is, other than trying to deduce it by reading the also-sparse documentation on the methods and comparing and contrasting them to the methods of the other classes?

Is there more verbose documentation somewhere else?

Thanks!

Posts: 1

Participants: 1

Read full topic

Can't get stenciling to work

@rjlwest wrote:

All I'm trying to do at the moment is to get one ofRectangle to stencil the other, but it's not working. I've set the stencilbits to 8. I've searched the forum and other people have always managed to get it working, I've tried their solutions but it just doesn't work for me.

glEnable(GL_STENCIL_TEST|GL_DEPTH_TEST);
glClearStencil(0);
glClearDepth(0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

glStencilFunc(GL_ALWAYS, 1, 0);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);

ofSetColor(0, 255, 0);
ofDrawRectangle(ofRectangle(20,380,100,100));

glStencilFunc(GL_EQUAL, 1, 0);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);

ofSetColor(255, 0, 0);
ofDrawRectangle(ofRectangle(40,400,100,100));

glDisable(GL_STENCIL_TEST);

Posts: 1

Participants: 1

Read full topic


OfSoundStream - get buffer length from device

@Daniel_Bennett wrote:

Hi,
is it possible to retrieve the settings (buffer, sample rate etc.) from the audio device?

the audio examples in OF show buffer length defined ahead of time, hard coded in the program. I had been working this way and it worked fine until I changed my ASIO driver today.

I have a audio-event timing things running in the audio thread, and now if my ASIO driver is not set to the same buffer length I hard-coded in the program, audio events either speed up or slow down - presumably because the device is not using the buffer length requested by OF.

I have reasons to want to use this new driver, so is it possible to retrieve the settings (buffer, sample rate etc.) from the device so I can set the buffer length correctly on startup and make sure my audio event timing is correct regardless of the device's buffer length?

Thanks

Posts: 3

Participants: 2

Read full topic

Space as a via XML

@antocreo wrote:

Hi all,
I am trying to pass the spacebar value as a char via xml with ofXML.
here is the OF code

if(settings.exists("//playButton")) {
        playKey = settings.getValue<char>("//playButton");
    } else {
        playKey = ' ';
    }

here is the XML code

<?xml version="1.0" encoding="UTF-8"?>
<settings>
<playButton>' '</playButton>
</settings>

things I tried already instead of ' ' (even if they don't make sense...)
& # 32; (without spaces between characters)
32
" "
GLFW_KEY_SPACE
one thing that works is using <int> 32 instead of <char>.
This will work but only with the space. As I want to have flexibility to choose any other character I'd like to stick to <char>
I am a bit stuck and I could really use some help on this.. maybe it's easy?

Cheers

Posts: 22

Participants: 2

Read full topic

[SOLVED] Remapping Color

@Rakasis wrote:

Hey, I'm trying to limit the colours in a composition to 4 specific colors. Is there a way to remap a grey scale composition to use a set of specific colors?

EDIT: Nevermind. I found what I was looking for.

Posts: 1

Participants: 1

Read full topic

Randomly generated points into mesh?

@Sam_McElhinney_io wrote:

Hello All,

Can anyone give me some tips on how to tesselate randomly generated points into an ofMesh?

I understand the principles of indices and winding, but if there isn't an underlying grid/image that the points are generated from, are there any examples of would you go about this? i.e. to produce a reasonably coherent mesh from a cloud of points?

The closest I can find on the forum is here but it isn't the same thing.

S

Posts: 1

Participants: 1

Read full topic

String with multiline in c++

@dimitre wrote:

I'm asking for an advice. I'm writing inline shaders this way in OFW.
Nice thing is you can actually read the multiline code.
Is there any downside of this kind of string declaration? maybe doesn't work on some compilers?
Thank you

	string vertShader =
	R"(
	varying vec2 texcoord0;
	void main() {
		gl_Position = ftransform();
		texcoord0 = vec2(gl_TextureMatrix[0] * gl_MultiTexCoord0);
	}
	)";
    string fragShader =
R"(
uniform int x, y, w, h;
uniform sampler2DRect tex0;
uniform sampler2DRect mask0;
varying vec2 texcoord0;

void main (void)
{
	vec4 cor = texture2DRect(tex0, texcoord0);
//		vec4 cor = texture2DRect(tex0, texcoord0).rgb;
//		cor.a = texture2DRect(mask0, texcoord0).r;
    	vec2 xy = gl_FragCoord.xy;
	int xx = int(xy.x);
	int yy = int(xy.y);
	bool limpa = false;
	if (xx > x && yy > y) {
		if (xx < (x+w) && yy < (y+h)) {
			limpa = true;
		}
	}
	gl_FragColor = limpa ? vec4(0.0, 0.0, 0.0, 0.0) : cor;
}
)";

Posts: 3

Participants: 3

Read full topic

Json::Value with int is ambiguous, but double and string are fine

@hamoid wrote:

After my latest OS update,

    Json::Value v;
    v["one"] = 123;

Shows error: conversion from int to 'const Json::Value' is ambiguous but

    Json::Value v;
    v["two"] = 123.0;
    v["three"] = "123.0";

is fine. Why doesn't it like ints?

Posts: 1

Participants: 1

Read full topic

Replacement for ofxTimeline?

@Datanoise wrote:

Hello everyone,

I wanted to use ofxTimeline for a timeline-based MIDI Sequencer and MIDI/CV/Lights Automation software I am working on in my spare time. I have noticed that the codebase for ofxTimeline has not been updated since 4 years, so my question is if there is any alternative?

Thanks

Posts: 2

Participants: 2

Read full topic


Myo addon for Windows (Visual Studio 2015)

@Dazzid_of wrote:

Hello
I downloaded a myo addon in of_0.9.8 and VisualStudio 2015 but it doesn't compile.
Someone knows a solution or has a version of the addon on Windows?
Thanks

Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol implibmyo_error_cstring referenced in function "public: _thiscall myo::ThrowOnError::~ThrowOnError(void)" (??1ThrowOnError@myo@@QAE@XZ) testMyo C:\ofv0.9.8_vs_release\apps\myApps\testMyo\ofxMyo.obj 1
Error LNK2019 unresolved external symbol implibmyo_error_kind referenced in function "public: _thiscall myo::ThrowOnError::~ThrowOnError(void)" (??1ThrowOnError@myo@@QAE@XZ) testMyo C:\ofv0.9.8_vs_release\apps\myApps\testMyo\ofxMyo.obj 1
Error LNK2019 unresolved external symbol implibmyo_free_error_details referenced in function "public: _thiscall myo::ThrowOnError::~ThrowOnError(void)" (??1ThrowOnError@myo@@QAE@XZ) testMyo C:\ofv0.9.8_vs_release\apps\myApps\testMyo\ofxMyo.obj 1
Error LNK2019 unresolved external symbol implibmyo_string_c_str referenced in function "public: class std::basic_string<char,struct std::char_traits,class std::allocator > _thiscall myo::Myo::macAddressAsString(void)const " (?macAddressAsString@Myo@myo@@QBE?AV?$basicstring@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) testMyo C:\of_v0.9.8_vs_release\apps\myApps\testMyo\ofxMyo.obj 1
Error LNK2019 unresolved external symbol implibmyo_string_free referenced in function "public: class std::basic_string<char,struct std::char_traits,class std::allocator > _thiscall myo::Myo::macAddressAsString(void)const " (?macAddressAsString@Myo@myo@@QBE?AV?$basicstring@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) testMyo C:\of_v0.9.8_vs_release\apps\myApps\testMyo\ofxMyo.obj 1

Posts: 1

Participants: 1

Read full topic

ofXml in child class

@dasoe wrote:

Hi all,

If I have a child class I can not use ofXml in this class.
The error I get is (when opening the App, compiling is OK)

Unhandled exception at 0x00CA28BD in XXX.exe: 0xC0000005: Access violation reading location 0x00000000.

Line of code mentioned is:

ofXml::ofXml(const ofXml & rhs){
    document = new Poco::XML::Document();
x   Poco::XML::Node *n = document->importNode(rhs.getPocoDocument()->documentElement(), true);
    document->appendChild(n);

    element = document->documentElement();
}

Here's the setting. (I do nothing but declare an ofXml in the header file of the class - that's the culprit):

ofApp.h:

#pragma once
#include "ofMain.h"
#include "myClass.h"

class ofApp : public ofBaseApp{
	public:
		void setup();
		void update();
		void draw();

		ofXml settingsXML;
		vector <myClass> content;
};

ofApp.cpp:

#include "ofApp.h"

//--------------------------------------------------------------
void ofApp::setup(){
	if (settingsXML.load("settings.xml")) {
	}

	content.assign(4, myClass());
	for (int i = 0; i < content.size();i++) {
		content[i].init();
	}
}

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

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

myClass.h:

#pragma once
#include "ofMain.h"

class ofApp;

class myClass : public ofBaseApp {
public:
	myClass();
	void init();

	ofXml classXML;
};

myClass.cpp:

#include "myClass.h"

myClass::myClass() {
}

void myClass::init() {
}

is it possible to use ofXml here? If someone can explain my error, I'd be happy!

thanks & have a good day
oe

Posts: 1

Participants: 1

Read full topic

Setting up ofxCV in VisualStudio 2015

@Charles_Lucien wrote:

Hi all,

I'm having a hard time setting everything up in Visual Studio especially ofxCV.

Here's the steps I took and it's still giving me some error:

  1. cd openFrameworks/addons/

  2. git clone https://github.com/kylemcdonald/ofxCv.git

  3. Right click on project> openframeworks add-on and selected both ofxOpenCv and ofxCv

  4. Added #include "ofxOpenCv.h" & #include "ofxCv.h" to ofApp.h

  5. #include "ofxCv.h" was underlined in red so I added the following paths in Properties>C/C++>General>Addition Include Directories which resolved that:
    C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\src
    C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include
    C:\of_v0.9.8_vs_release\addons\ofxCv\src

Here's the some of the 317 errors I get:

Error (active)		cannot open source file "myvec.h"	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Wrappers.h	39
Error (active)		declaration is incompatible with overloaded function "ofxCv::toCv" (declared at line 262 of "c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h")	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	260
Error (active)		name followed by '::' must be a class or namespace name	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	260
Error (active)		expected a ')'	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	260
Error (active)		name followed by '::' must be a class or namespace name	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	261
Error (active)		expected a ')'	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	261
Error (active)		declaration is incompatible with "cv::Point2f ofxCv::toCv" (declared at line 260)	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	262
Error (active)		name followed by '::' must be a class or namespace name	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	264
Error (active)		cannot overload functions distinguished by return type alone	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error (active)		name followed by '::' must be a class or namespace name	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error (active)		name followed by '::' must be a class or namespace name	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	321
Error (active)		name followed by '::' must be a class or namespace name	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	322
Error (active)		cannot open source file "imatrix.h"	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Wrappers.h	36
Error (active)		cannot open source file "ETF.h"	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Wrappers.h	37
Error (active)		cannot open source file "fdog.h"	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Wrappers.h	38
Error (active)		name followed by '::' must be a class or namespace name	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Wrappers.h	382
Error (active)		name followed by '::' must be a class or namespace name	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Wrappers.h	382
Error (active)		name followed by '::' must be a class or namespace name	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Wrappers.h	444
Error (active)		name followed by '::' must be a class or namespace name	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Wrappers.h	444
Error (active)		name followed by '::' must be a class or namespace name	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Wrappers.h	445
Error (active)		name followed by '::' must be a class or namespace name	emptyExample	c:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Wrappers.h	445
Error	C1083	Cannot open include file: 'ETF.h': No such file or directory	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\CLD\src\ETF.cpp	1
Error	C1083	Cannot open include file: 'ETF.h': No such file or directory	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\CLD\src\fdog.cpp	5
Error	C2653	'glm': is not a class or namespace name (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	260
Error	C2065	'vec2': undeclared identifier (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	260
Error	C2146	syntax error: missing ')' before identifier 'vec' (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	260
Error	C2653	'glm': is not a class or namespace name (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	261
Error	C2065	'vec3': undeclared identifier (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	261
Error	C2146	syntax error: missing ')' before identifier 'vec' (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	261
Error	C2653	'glm': is not a class or namespace name (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	264
Error	C2065	'vec2': undeclared identifier (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	264
Error	C2923	'std::vector': 'vec2' is not a valid template type argument for parameter '_Ty' (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	264
Error	C3203	'allocator': unspecialized class template can't be used as a template argument for template parameter '_Alloc', expected a real type (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	264
Error	C2653	'glm': is not a class or namespace name (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error	C2065	'vec3': undeclared identifier (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error	C2923	'std::vector': 'vec3' is not a valid template type argument for parameter '_Ty' (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error	C3203	'allocator': unspecialized class template can't be used as a template argument for template parameter '_Alloc', expected a real type (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error	C2556	'std::vector<cv::Point3f,std::allocator<_Ty>> ofxCv::toCv(const std::vector &)': overloaded function differs only by return type from 'std::vector<cv::Point2f,std::allocator<_Ty>> ofxCv::toCv(const std::vector &)'	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error	C2371	'ofxCv::toCv': redefinition; different basic types (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error	C2653	'glm': is not a class or namespace name (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	321
Error	C4430	missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	321
Error	C2146	syntax error: missing ';' before identifier 'toOf' (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	321
Error	C2653	'glm': is not a class or namespace name (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	322
Error	C4430	missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	322
Error	C2146	syntax error: missing ';' before identifier 'toOf' (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	322
Error	C1083	Cannot open include file: 'imatrix.h': No such file or directory (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\Calibration.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Wrappers.h	36
Error	C2653	'glm': is not a class or namespace name (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	260
Error	C2065	'vec2': undeclared identifier (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	260
Error	C2146	syntax error: missing ')' before identifier 'vec' (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	260
Error	C2653	'glm': is not a class or namespace name (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	261
Error	C2065	'vec3': undeclared identifier (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	261
Error	C2146	syntax error: missing ')' before identifier 'vec' (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	261
Error	C2653	'glm': is not a class or namespace name (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	264
Error	C2065	'vec2': undeclared identifier (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	264
Error	C2923	'std::vector': 'vec2' is not a valid template type argument for parameter '_Ty' (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	264
Error	C3203	'allocator': unspecialized class template can't be used as a template argument for template parameter '_Alloc', expected a real type (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	264
Error	C2653	'glm': is not a class or namespace name (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error	C2065	'vec3': undeclared identifier (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error	C2923	'std::vector': 'vec3' is not a valid template type argument for parameter '_Ty' (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error	C3203	'allocator': unspecialized class template can't be used as a template argument for template parameter '_Alloc', expected a real type (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error	C2556	'std::vector<cv::Point3f,std::allocator<_Ty>> ofxCv::toCv(const std::vector &)': overloaded function differs only by return type from 'std::vector<cv::Point2f,std::allocator<_Ty>> ofxCv::toCv(const std::vector &)'	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error	C2371	'ofxCv::toCv': redefinition; different basic types (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	265
Error	C2653	'glm': is not a class or namespace name (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	321
Error	C4430	missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample	C:\of_v0.9.8_vs_release\addons\ofxCv\libs\ofxCv\include\ofxCv\Utilities.h	321
Error	C2146	syntax error: missing ';' before identifier 'toOf' (compiling source file ..\..\..\addons\ofxCv\libs\ofxCv\src\ContourFinder.cpp)	emptyExample

Posts: 6

Participants: 2

Read full topic

Error regarding unknown OF pixel format

@Gil_Fuser wrote:

Hi everyone.

I'm getting errors with the following code, that although not critical, since the code runs, I would like to understand and correct what is causing it, if possible.

Every running frame gives me one of those:
[ error ] ofGLUtils: ofGetGLFormatFromPixelFormat(): unknown OF pixel format-1, returning GL_LUMINANCE

The code is making circular buffers and layering them.
Here is the code:

ofApp.h

#pragma once
#include "ofMain.h"
class circularPixelBuffer{
public:
    circularPixelBuffer(){
        currentIndex = 0;
    }
    void setup(int numFrames){
        frames.resize(numFrames);
        currentIndex = numFrames -1;
    }
    void pushPixels(ofPixels& pix){
        currentIndex--;
        if (currentIndex < 0) {
            currentIndex = frames.size() -1;
        }
        frames[currentIndex] = pix;
    }
    ofPixels& getDelayedPixels(size_t delay){
        if(delay < frames.size()){
            return frames[ofWrap(delay + currentIndex, 0, frames.size())];
        }
        return frames[0];
    }
protected:
    int currentIndex;
    deque<ofPixels> frames;
};
class ofApp : public ofBaseApp{
    public:
        void setup();
        void update();
        void draw();
        ofVideoGrabber vidGrabber;
        unsigned char* myVideo;
        deque<ofPixels> frames0;
        deque<ofPixels> frames1;
        deque<ofPixels> frames2;
        float yoff;  // 2nd dimension of perlin noise
        int delayTime;
        int nDelayFrames;
        int currFrame0;
        int currFrame1;
        int currFrame2;
        int camWidth;
        int camHeight;
        circularPixelBuffer buffer0;
        circularPixelBuffer buffer1;
        circularPixelBuffer buffer2;
        ofTexture tex0;
        ofTexture tex1;
        ofTexture tex2;
};

ofApp.cpp

#include "ofApp.h"
//-------------------------------------------------------------
void ofApp::setup(){
    camWidth = 640;  // try to grab at this size.
    camHeight = 480;
    vidGrabber.setDeviceID(0);
    vidGrabber.setDesiredFrameRate(30);
    vidGrabber.setPixelFormat(OF_PIXELS_BGRA);
    vidGrabber.initGrabber(camWidth, camHeight);
    ofSetVerticalSync(true);
    nDelayFrames = 720; //Set buffer size
    buffer0.setup(nDelayFrames);
    buffer1.setup(nDelayFrames);
    buffer2.setup(nDelayFrames);
    yoff = 50.0;
    currFrame0 = nDelayFrames-1;
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    tex0.allocate(vidGrabber.getPixels());
    tex1.allocate(vidGrabber.getPixels());
    tex2.allocate(vidGrabber.getPixels());
}
//-------------------------------------------------------------
void ofApp::update(){
    ofBackground(0);
    vidGrabber.update();
    if(vidGrabber.isFrameNew()){
        buffer0.pushPixels(vidGrabber.getPixels());
        buffer1.pushPixels(vidGrabber.getPixels());
        buffer2.pushPixels(vidGrabber.getPixels());
    }
    //review ofNoise to ajust that propperly
    yoff = fmod((yoff + 0.01), nDelayFrames);
    delayTime = int(ofClamp(ofMap(ofNoise(yoff)*10, 1, 7.1, 1, 480, 1), 1, 480));
    nDelayFrames = int(delayTime);
    currFrame0 = ( currFrame0 + nDelayFrames - 1 ) % nDelayFrames;
    currFrame1 = ( currFrame0 + 80 ) % nDelayFrames;
    currFrame2 = ( currFrame0 + 160 ) % nDelayFrames;
}
//-------------------------------------------------------------
void ofApp::draw(){
    ofSetColor(255, 255, 255, 255);
    vidGrabber.draw(0, 0, 1920, 1080);
    ofSetColor(255, 255, 255, 85);
    tex0.loadData(buffer0.getDelayedPixels(currFrame0));
    tex0.draw(1920, 1080, -1920, -1080);
    tex1.loadData(buffer1.getDelayedPixels(currFrame1));
    tex1.draw( 0, 1080, 1920, -1080);
    tex2.loadData(buffer2.getDelayedPixels(currFrame2));
    tex2.draw( 1920, 0, -1920, 1080);
}

that's all.
Thank you in advance and best regards,
Gil

edit: some more information: I'm using Linux Ubuntu 16.10, OF 0.9.8 and QT Creator.

Posts: 1

Participants: 1

Read full topic

.setAlphaMask and Shaders

@Miles wrote:

ayop!

i am trying to alphamask an image and then pass that through a shader, but the alphamask appears to stop the shader from working, here's my code:

for (int i=0; i<slices.size(); i++) {
    slices[i].img.bind();
    shader.begin();
    shader.setUniform4f( "color1", mGradientColors[2]);//can do this to make it static: slices[i].col1
    shader.setUniform4f( "color2", mGradientColors[3]);
    shader.setUniformTexture("sourceTex", slices[i].img.getTexture(), 0);
    slices[i].img.getTexture().setAlphaMask(alphaMask.getTexture());
    slices[i].img.update();
    slices[i].img.getTexture().draw(slices[i].centre);
    shader.end();
    slices[i].img.unbind();
}

This shows an unaffected but alphaMasked image, however if I remove the .setAlphaMask() then the shader works as expected. Anybody have any hints as to what might be going on here?
Thanks

Posts: 1

Participants: 1

Read full topic

Viewing all 4929 articles
Browse latest View live