Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/of.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ jobs:
- name: Install dependencies
run: ./scripts/ci/msys2/install.sh --msystem=${{ matrix.msystem }}

- name: LS
- name: List Directories
shell: bash
run: ls -alfR
run: find . -type d

- name: Build
run: ./scripts/ci/msys2/build.sh
Expand Down
33 changes: 16 additions & 17 deletions libs/openFrameworks/app/ofAppEGLWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <assert.h>
// x11
#include <X11/Xutil.h>
#include <EGL/egl.h>

// include includes for both native and X11 possibilities
#include <libudev.h>
Expand All @@ -33,7 +32,7 @@ struct udev* udev;
struct udev_monitor* mon;
static int udev_fd = -1;

typedef map<string, int> device;
typedef std::map<std::string, int> device;
static device inputDevices;

// minimal map
Expand Down Expand Up @@ -76,8 +75,8 @@ typedef struct {
int mouseButtonState;
} MouseState;

typedef map<int, int> TouchState;
typedef map<int, ofVec2f> TouchPosition;
typedef std::map<int, int> TouchState;
typedef std::map<int, ofVec2f> TouchPosition;

// TODO, make this match the upcoming additions to ofWindow
#define MOUSE_BUTTON_LEFT_MASK 1
Expand Down Expand Up @@ -150,7 +149,7 @@ static const struct {
#define CASE_STR(x,y) case x: str = y; break

static const char* eglErrorString(EGLint err) {
string str;
std::string str;
switch (err) {
CASE_STR(EGL_SUCCESS, "no error");
CASE_STR(EGL_NOT_INITIALIZED, "EGL not, or could not be, initialized");
Expand Down Expand Up @@ -412,7 +411,7 @@ void ofAppEGLWindow::setup(const ofAppEGLWindowSettings & _settings) {
// pDisplay = ofGetEnv("DISPLAY");
// bool bIsX11Available = (pDisplay != NULL);

bool bIsX11Available = ofGetEnv("DISPLAY") != NULL;
bool bIsX11Available = !empty(ofGetEnv("DISPLAY"));

if(settings.eglWindowPreference == OF_APP_WINDOW_AUTO) {
if(bIsX11Available) {
Expand Down Expand Up @@ -899,7 +898,7 @@ ofCoreEvents & ofAppEGLWindow::events(){
}

//------------------------------------------------------------
shared_ptr<ofBaseRenderer> & ofAppEGLWindow::renderer(){
std::shared_ptr<ofBaseRenderer> & ofAppEGLWindow::renderer(){
return currentRenderer;
}

Expand Down Expand Up @@ -1033,7 +1032,7 @@ void ofAppEGLWindow::pollEvents(){
}
}
} else {
queue<ofMouseEventArgs> mouseEventsCopy;
std::queue<ofMouseEventArgs> mouseEventsCopy;
instance->lock();
mouseEventsCopy = instance->mouseEvents;
while(!instance->mouseEvents.empty()){
Expand All @@ -1046,7 +1045,7 @@ void ofAppEGLWindow::pollEvents(){
}

// KEYBOARD EVENTS
queue<ofKeyEventArgs> keyEventsCopy;
std::queue<ofKeyEventArgs> keyEventsCopy;
instance->lock();
keyEventsCopy = instance->keyEvents;
while(!instance->keyEvents.empty()){
Expand All @@ -1058,7 +1057,7 @@ void ofAppEGLWindow::pollEvents(){
keyEventsCopy.pop();
}

queue<ofTouchEventArgs> touchEventsCopy;
std::queue<ofTouchEventArgs> touchEventsCopy;
instance->lock();
touchEventsCopy = instance->touchEvents;
while(!instance->touchEvents.empty()){
Expand All @@ -1083,7 +1082,7 @@ void ofAppEGLWindow::showCursor(){
}

//------------------------------------------------------------
void ofAppEGLWindow::setWindowTitle(string title) {
void ofAppEGLWindow::setWindowTitle(std::string title) {
ofLogNotice("ofAppEGLWindow") << "setWindowTitle(): not implemented";
}

Expand Down Expand Up @@ -1528,7 +1527,7 @@ void ofAppEGLWindow::processInput(int fd, const char * node){
while(nBytesRead >= 0){
if(ev.type == EV_KEY){
if(ev.code == BTN_LEFT){
ofLogNotice("ofAppEGLWindow") << "BTN_LEFT" << endl;
ofLogNotice("ofAppEGLWindow") << "BTN_LEFT" << std::endl;
if(ev.value == 0){ // release
mouseEvent.button = OF_MOUSE_BUTTON_LEFT;
mouseEvent.type = ofMouseEventArgs::Released;
Expand All @@ -1541,7 +1540,7 @@ void ofAppEGLWindow::processInput(int fd, const char * node){
pushMouseEvent = true;
}
}else if(ev.code == BTN_MIDDLE){
ofLogNotice("ofAppEGLWindow") << "BTN_MIDDLE" << endl;
ofLogNotice("ofAppEGLWindow") << "BTN_MIDDLE" << std::endl;
if(ev.value == 0){ // release
mouseEvent.button = OF_MOUSE_BUTTON_MIDDLE;
mouseEvent.type = ofMouseEventArgs::Released;
Expand All @@ -1554,7 +1553,7 @@ void ofAppEGLWindow::processInput(int fd, const char * node){
pushMouseEvent = true;
}
}else if(ev.code == BTN_RIGHT){
ofLogNotice("ofAppEGLWindow") << "BTN_RIGHT" << endl;
ofLogNotice("ofAppEGLWindow") << "BTN_RIGHT" << std::endl;
if(ev.value == 0){ // release
mouseEvent.button = OF_MOUSE_BUTTON_RIGHT;
mouseEvent.type = ofMouseEventArgs::Released;
Expand Down Expand Up @@ -1749,7 +1748,7 @@ void ofAppEGLWindow::processInput(int fd, const char * node){
axisValuePending = true;
break;
default:
ofLogNotice("ofAppEGLWindow") << "readMouseEvents(): unknown mouse axis (perhaps it's the scroll wheel?): axis " << axis << " amount " << amount << endl;
ofLogNotice("ofAppEGLWindow") << "readMouseEvents(): unknown mouse axis (perhaps it's the scroll wheel?): axis " << axis << " amount " << amount << std::endl;
break;
}
}else if (ev.type == EV_ABS){
Expand Down Expand Up @@ -1807,7 +1806,7 @@ void ofAppEGLWindow::processInput(int fd, const char * node){
touchAxisValuePending = true;
break;
default:
ofLogNotice("ofAppEGLWindow") << "EV_ABS unknown axis: axis " << axis << " amount " << amount << endl;
ofLogNotice("ofAppEGLWindow") << "EV_ABS unknown axis: axis " << axis << " amount " << amount << std::endl;
break;
}
}else if(ev.type == EV_MSC){
Expand Down Expand Up @@ -2265,7 +2264,7 @@ void ofAppEGLWindow::handleX11Event(const XEvent& event){
instance->coreEvents.notifyMouseEvent(mouseEvent);
break;
case MotionNotify:
//cout << "motion notify" << endl;
//cout << "motion notify" << std::endl;
mouseEvent.x = static_cast<float>(event.xmotion.x);
mouseEvent.y = static_cast<float>(event.xmotion.y);
mouseEvent.button = event.xbutton.button;
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/app/ofAppEGLWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <queue>
#include <map>
#include <X11/Xlib.h>
#include <EGL/egl.h>

enum ofAppEGLWindowType {
OF_APP_WINDOW_AUTO,
Expand Down
13 changes: 6 additions & 7 deletions libs/openFrameworks/gl/ofTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,12 @@ class ofTextureData {
glInternalFormat = GL_RGB8;
textureTarget = GL_TEXTURE_RECTANGLE_ARB;
#elif defined(TARGET_OPENGLES)
if(ofGLESVersionFromGL() >= 300) {
glInternalFormat = GL_RGB16F;
textureTarget = GL_TEXTURE_2D;
} else {
glInternalFormat = GL_RGB;
textureTarget = GL_TEXTURE_2D;
}
#if defined(GL_RGB16F)
glInternalFormat = GL_RGB16F;
#else
glInternalFormat = GL_RGB;
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like this would maybe be a safer change as it keeps the original logic, but also checks for the define

		if(ofGLESVersionFromGL() >= 300) {
				#if defined(GL_RGB16F)
						glInternalFormat = GL_RGB16F;
				#else
						glInternalFormat = GL_RGB;
				#endif
			textureTarget = GL_TEXTURE_2D;
		} else {
			glInternalFormat = GL_RGB;
			textureTarget = GL_TEXTURE_2D;
		}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main idea was depart from ofGLESVersionFromGL which is very imprecise.
if you read the function it tries to parse from a string (that greatly varies from platform, video card) and I am suspecting this function returns both false positives and negatives.

a more deterministic way of define would be get this info from glGetString(GL_SHADING_LANGUAGE_VERSION);

but the simpler way would be just checking the presence of the define. if it exists it can be set.

OF uses this approach a lot in ofCubeMap

			#if defined(GL_RGBA16F)

cc: @NickHardeman

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - I think I was just imagining possible regressions where it might now default to GL_RGB16F instead of GL_RGB - one is a floating point texture and the other is unsigned char.

So that could mean some shaders might behave a little differently - curious if that would be very noticeable or not really an issue.

I think in general bug fixes should correct breaking bugs or existing issues without changing behavior, hence my caution.

textureTarget = GL_TEXTURE_2D;
#endif

tex_t = 0;
Expand Down
3 changes: 2 additions & 1 deletion libs/openFrameworks/utils/ofConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ enum ofTargetPlatform{
#elif defined (__ANDROID__)
#define TARGET_ANDROID
#define TARGET_OPENGLES
#elif defined(__ARMEL__)
//#elif defined(__ARMEL__)
#elif defined(__ARM__)
#define TARGET_LINUX
#define TARGET_OPENGLES
#define TARGET_LINUX_ARM
Expand Down
Loading