Hi all, I am a beginner to OF, i am currently following this tutorial series on youtube:
In this particular short episode, it teaches how to draw an image and have it follow your mouse cursor. I followed the steps but instead of the image following my mouse cursor, it now duplicates and creates one instance every frame on my cursor’s xy coordinates.
I tried searching the forums, google, and can’t find anything on this(maybe wrong terminology?). I even tried using
ofSetBackgroundAuto(true);
on setup() but it doesn’t do anything. the image is a png. On OF_WINDOW the entire canvas kept blinking like its trying to refresh every frame but the duplicated images remained. On OF_FULLSCREEN the images remains on the screen. Any help would be appreciated. Thanks!
main.ccp below:
#include "ofApp.h"
//========================================================================
int main( ){
ofSetupOpenGL(1920,1080, OF_FULLSCREEN); // <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp(new ofApp());
}
#pragma once
#include "ofMain.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
/*void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void mouseEntered(int x, int y);
void mouseExited(int x, int y);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);*/
ofImage image;
};
This code works to me, as expected. I have tried it with OF_FULLSCREEN and OF_WINDOW mode and both works.
On which platform are you? are you using the last version of OF? the 0.10 one?
Im using a laptop with Intel Geforce 940MX. Is there a list of compatible or incompatible graphics card?
On a side note, I tried installing visual studios and OF on my home pc, and I wrote the same 3 lines of code,
ofImage image;
image.load();
image.draw();
And it worked perfectly as per the tutorial without duplicates. So Im not too sure if theres something that I missed, or project generator settings, or visual studios settings. If anyone has any idea how to troubleshoot pls I still need help! Thanks!
Sorry I double posted for this, I thought I should make a new post of the actual answer. While typing up the above I took arturo’s advice and updated my graphics driver. turns out that solved the issue. Credits to arturo and edapx for helping out!