2016-05-30 4 views
0

Я заканчиваю свой второй семестр программирования на C++ и хочу оживить мой вывод. Я довольно знаком с C++, но очень новичок в oF. Я слежу вместе с учебниками в книге oF с сайта и в главе «Шейдеры», работающими с текстурами: http://openframeworks.cc/ofBook/chapters/shaders.html#addingtexturesОшибка: класс «ofTexture» не имеет значения «getTextureReference»

В этом разделе я получаю сообщение об ошибке (я использую Visual Studio): класс «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 и делал поиск в Google, но я не вижу четкой картины того, что должен делать этот вызов, чтобы увидеть, есть ли работа или другая функция, которую я должен звонить. Имеет ofTexture :: getTextureReference заменено чем-то другим? Благодаря!

ответ

1

Если я правильно истолковываю источник openframeworks, вы можете позвонить bind прямо на ваш ofTexture.

Если его экземпляр ofVideoGrabber вам нужно позвонить getTexture