2016-05-30 39 views
0

我正在完成我的第二學期的C++編程,並且想要增加我的輸出。我對C++非常熟悉,但是對於oF來說卻很新穎。我一直在使用本書中的教程以及使用紋理的着色器章節:http://openframeworks.cc/ofBook/chapters/shaders.html#addingtextures錯誤:類「ofTexture」沒有成員「getTextureReference」

在本節中,我遇到了一個錯誤(我正在使用Visual Studio): class「ofTexture」沒有成員「getReferenceTexture」。

#include "ofApp.h" 

void ofApp::setup() { 
    // setup 
    plane.mapTexCoordsFromTexture(img.getTextureReference()); 
} 

void ofApp::draw() { 

    // bind our texture. in our shader this will now be tex0 by default 
    // so we can just go ahead and access it there. 
    img.getTextureReference().bind(); 

    // start our shader, in our OpenGL3 shader this will automagically set 
    // up a lot of matrices that we want for figuring out the texture matrix 
    // and the modelView matrix 
    shader.begin(); 

    // get mouse position relative to center of screen 
    float mousePosition = ofMap(mouseX, 0, ofGetWidth(), plane.getWidth(), -plane.getWidth(), true); 

    shader.setUniform1f("mouseX", mousePosition); 

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

    shader.end(); 
    img.getTextureReference().unbind(); 

} 

我打開了ofTexture.h和.cpp文件果然沒有叫getTextureReference成員。我瀏覽了oF網站和論壇,瀏覽了Stack Exchange,並進行了谷歌搜索,但是我沒有清楚地瞭解這個調用應該做什麼,以查看是否有解決方法或者應該執行其他功能在打電話。 hasTexture :: getTextureReference是否被替換爲其他東西?謝謝!

回答

1

如果我正確解釋了openframeworks源代碼,可以直接撥打bindofTexture上。

如果其ofVideoGrabber一個實例,你需要調用getTexture

相關問題