npisanti/ofxDotFrag

should work in Windows?

Closed this issue · 4 comments

Hey @npisanti ,
Just testing on Windows with current OF GitHub but I am having these errors.
The app compiles and opens, but no process at all.

[notice ] [ofx::dotfrag::Base] disabling ARB textures for shaders

[ error ] ofShader: setupShaderFromSource(): GL_FRAGMENT_SHADER shader failed to compile
[ error ] ofShader: GL_FRAGMENT_SHADER shader reports:
0(1) : error C0105: Syntax error in #ifdef
0(1) : error C7102: unmatched #if

[ error ] ofShader: GL_FRAGMENT_SHADER, offending line 1 :
	    1	#ifdef GL_ES precision mediump float; #endif uniform vec2 u_resolution; uniform float u_time; uniform sampler2D u_tex0; uniform float u_pulse; void main (void) { vec2 st = gl_FragCoord.xy/u_resolution; vec4 source = texture2D( u_tex0, st ); float gate = step( u_pulse, fract( u_time*0.8 ) ); vec3 invert = 1.0 - source.rgb; vec3 color = mix( invert, source.rgb, gate ); gl_FragColor = vec4( color, source.a ); }

[ error ] ofShader: checkProgramLinkStatus(): program failed to link
[ error ] ofShader: ofShader: program reports:
Fragment info
-------------
0(1) : error C0105: Syntax error in #ifdef
0(1) : error C7102: unmatched #if
(0) : error C2003: incompatible options for link

This is the line that trigs the Syntax Error in InvertStrobe.cpp:

    //#ifdef GL_ES
    //precision mediump float;
    //#endif

I changed to another fx and does the same.
The error makes the image to be just black, no fx applied.

The solution is to comment this lines in all fx's.
We need to comment this #ifdef on every fx to avoid the error.

I made it work with this main.cpp:

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

int main() {

	ofGLFWWindowSettings settings;

	settings.setGLVersion(2, 1);  // Fixed pipeline

	//settings.setGLVersion(3, 2);  
	//settings.stencilBits = 8;
	//settings.numSamples = 4;

	int w = 1300;
	int h = 1050;
	settings.setSize(w, h);

	ofCreateWindow(settings);
	ofRunApp(new ofApp());
}

I tried to set GL to 3.2, but it seems that the addon does not support GL 3.2.
Default PG main.cpp works fine too:

#include "ofApp.h"
int main() {
	ofSetupOpenGL(1920, 1080, OF_WINDOW);
        ofRunApp(new ofApp());
}

Your example's main.cpp works fine too:

int main(int argc, char *argv[]){

#ifdef __ARM_ARCH
    ofGLESWindowSettings settings;
    settings.glesVersion = 2;
    settings.setSize( 640, 700 );
    ofCreateWindow(settings);
#else        
    ofSetupOpenGL(640, 700, OF_WINDOW);	        
#endif

	ofApp *app = new ofApp();
	app->arguments = vector<string>(argv, argv + argc);
        ofRunApp( app );
}

i don't know if this is my fault ( my style of shader coding ) or ofShader, actually i'm just much more writing shaders and live reloading instead than using ofxDotFrag

thanks @npisanti ,

I never tried to code any shader yet, so I am limited to chain/combine some add-ons around.

Do you mean ofxDotFrag it's outdated or you suggest that I use other alternatives?

i'm not actively mantain ofxDotFrag anymore, as i'm just using ofShader, but i think the other alternatives are still much more outdated and difficult to make it work again than ofxDotFrag. I would probably udpate ofxDotFrag once and then when it's required to make an old project work again. I would suggest to keep using ofxDotFrag if you don't want to start managing ofShader directly.