Quantcast
Viewing all articles
Browse latest Browse all 40524

Varying vec2 surfacePosition

RIght, so... I am not even sure how I did it but it works. I didn't use the addon but I will have a look at it.
The problem was that I needed to use gl_MultiTexCoord0.xy; instead of gl_TexCoord[0].xy

so in vert I got:

varying vec2 surfacePosition;

void main()
{
    gl_Position = ftransform();
    surfacePosition = gl_MultiTexCoord0.xy;
}

in cpp draw()

plane.mapTexCoords(0,0, 1, 1);
    ofPushMatrix();
    ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
    plane.draw();
    ofPopMatrix();

where the texture size has to be 1 and 1 and not ofGetWidth(), ofGetHeight().

I think I need to buy a book on GLSL soon! Image may be NSFW.
Clik here to view.
blush

Thanks for your help!


Viewing all articles
Browse latest Browse all 40524

Trending Articles