Setting Icons in 0.8.0

I managed to get a custom icon working under Linux in 0.8.0

First I have to make the setWindowIcon() function public. Then I did the following (after putting an icon.png in my data folder). It would be good if there was an easier way to do this in future…icons are rad!

#include "ofAppGLFWWindow.h"  
ofSetup() {	  
ofAppGLFWWindow* win;  
win = dynamic_cast<ofAppGLFWWindow *> (ofGetWindowPtr());  

yes i made this private because there was some problems with having it as public, don’t remember exactly what but the idea is to have them as public at some point

There’s something weird that happens to the colour palette of the icon when it’s loaded though. Maybe the colours are downscaled from 24bit to 16bit or something like that. I haven’t had a chance to investigate yet. Black and white is of course fine.

Also not all .png’s seemed to work, even at the same size. Didn’t figure out this either.

Hi @arturo,

any chance you will make it public in the next releases?

yes please +1

@arturo hi arturo does this works this days and how ?
i see this lines but wonder if can used it

void ofAppGLFWWindow::setWindowIcon(const string & path){

ofPixels iconPixels;




I was struggling setting a custom icon in linux today. I found that this code has the needed update (setwindowsIcon in public instead of private)-

As of writing this, the change is not in the stable build 11.2 , but was available in the nightly build. I just replaced ofAppGLFWWindow.h in 11.2 with the more updated one from the nightly build and that worked fine.

1 Like

hi so changing those lines and then how did you implemented?

After updating the source code of OF ( could also just switch entirely to the nightly build) I did exactly what was described in the original post in ofApp.cpp.


1 Like