I just started playing with the dragevent. But the driveletter seems to be chopped off in the paths of the dropped files.
I tested the example “of_v0.8.4_win_cb_release\examples\utils\dragDropExample” and same problem, the example doesn’t work. And you I get an opengl error “…drawing unallocated texture…”.
“C:/users/myusername/…” ends up as “/users/myusername/…”
Thanks for the reply.
Just to make sure. Did you try dropping files that weren’t in the data folder or on the same drive as where you have openframeworks installed (not on “c:”)?
Some additional info. I initially tried it from another folder on the main c:\ drive (where openFrameworks is also installed), which worked. When I try to grab an image from another drive, I run into the same ‘unallocated texture’ error you got. As found above, it seems the dragEvent currently doesn’t return the drive letter, so the example application only works when the image is on the main drive. As you said, the conclusion is that dragInfo does not return the full absolute path, indeed a bug I would say (given that the description states it should return an absolute path).
Ok, I’ve managed to get some time to further investigate this.
I have found the source of the problem and managed to fix it (atleast on windows 7 x64).
The problem is with GLFW and I have 2 fixes:
Using Glut instead of GLFW solves the problem. Then driveletters aren’t chopped off. But I assume of is switching to GLFW for a reason?
.
ofAppBaseWindow* win;
//win = new ofAppGLFWWindow();
win = new ofAppGlutWindow();
ofSetupOpenGL(win, 400, 400, OF_WINDOW);
Use GLFW and modify the file “openframeworks\of_v0.8.4_win_cb_release\libs\openFrameworks\app\ofAppGLFWWindow.cpp” like below:
.
void ofAppGLFWWindow::drop_cb(GLFWwindow* windowP_, int numFiles, const char** dropString) {
ofDragInfo drag;
drag.position.set(ofGetMouseX(), ofGetMouseY());
drag.files.resize(numFiles);
for(int i=0; i<(int)drag.files.size(); i++){ //drag.files[i] = Poco::URI(dropString[i]).getPath(); // COMMENT THIS LINE OUT
drag.files[i] = dropString[i]; // ADD THIS LINE
}
ofNotifyDragEvent(drag);
}
I don’t know the implications of changing:
drag.files[i] = Poco::URI(dropString[i]).getPath();
to
drag.files[i] = dropString[i];
But it seems like it should be easy to solve permanently.