leadedge / ofxNDI

An Openframeworks addon to allow sending and receiving images over a network using the NewTek Network Device Protocol.
GNU General Public License v3.0
134 stars 48 forks source link

RPI 4 support (OpenGL ES 2.0) #33

Closed rytai closed 2 years ago

rytai commented 2 years ago

Hi! Thanks for the amazing addon.

I ran into problems when trying to build this on Raspberry Pi 4. OS is 32-bit Raspbian (armv7l). Only OpenGL ES 2.0 is supported currently on this hardware.

Any chance of making this compatible with the raspberry?

/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIreceiver.cpp: In member function ‘bool ofxNDIreceiver::GetPixelData(ofTexture&)’:
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIreceiver.cpp:501:105: error: ‘GL_BGRA’ was not declared in this scope; did you mean ‘GL_RGBA’?
  501 |   texture.loadData((const unsigned char *)videoData, (int)texture.getWidth(), (int)texture.getHeight(), GL_BGRA);
      |                                                                                                         ^~~~~~~
      |                                                                                                         GL_RGBA
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp: In member function ‘bool ofxNDIsender::CreateSender(const char*, unsigned int, unsigned int)’:
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:111:18: error: ‘GL_PIXEL_UNPACK_BUFFER_ARB’ was not declared in this scope; did you mean ‘GL_PIXEL_UNPACK_BUFFER_NV’?
  111 |  glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, ndiPbo[0]);
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                  GL_PIXEL_UNPACK_BUFFER_NV
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:111:2: error: ‘glBindBufferARB’ was not declared in this scope; did you mean ‘glBindBuffer’?
  111 |  glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, ndiPbo[0]);
      |  ^~~~~~~~~~~~~~~
      |  glBindBuffer
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:112:67: error: ‘GL_STREAM_READ’ was not declared in this scope; did you mean ‘GL_STREAM_DRAW’?
  112 |  glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, width*height * 4, 0, GL_STREAM_READ);
      |                                                                   ^~~~~~~~~~~~~~
      |                                                                   GL_STREAM_DRAW
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:112:2: error: ‘glBufferDataARB’ was not declared in this scope; did you mean ‘glBufferData’?
  112 |  glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, width*height * 4, 0, GL_STREAM_READ);
      |  ^~~~~~~~~~~~~~~
      |  glBufferData
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp: In member function ‘bool ofxNDIsender::UpdateSender(unsigned int, unsigned int)’:
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:144:18: error: ‘GL_PIXEL_UNPACK_BUFFER_ARB’ was not declared in this scope; did you mean ‘GL_PIXEL_UNPACK_BUFFER_NV’?
  144 |  glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, ndiPbo[0]);
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                  GL_PIXEL_UNPACK_BUFFER_NV
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:144:2: error: ‘glBindBufferARB’ was not declared in this scope; did you mean ‘glBindBuffer’?
  144 |  glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, ndiPbo[0]);
      |  ^~~~~~~~~~~~~~~
      |  glBindBuffer
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:145:67: error: ‘GL_STREAM_READ’ was not declared in this scope; did you mean ‘GL_STREAM_DRAW’?
  145 |  glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, width*height * 4, 0, GL_STREAM_READ);
      |                                                                   ^~~~~~~~~~~~~~
      |                                                                   GL_STREAM_DRAW
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:145:2: error: ‘glBufferDataARB’ was not declared in this scope; did you mean ‘glBufferData’?
  145 |  glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, width*height * 4, 0, GL_STREAM_READ);
      |  ^~~~~~~~~~~~~~~
      |  glBufferData
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp: In member function ‘bool ofxNDIsender::ReadFboPixels(ofFbo, unsigned int, unsigned int, unsigned char*)’:
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:516:2: error: ‘glReadBuffer’ was not declared in this scope; did you mean ‘glBindBuffer’?
  516 |  glReadBuffer(GL_FRONT);
      |  ^~~~~~~~~~~~
      |  glBindBuffer
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:519:15: error: ‘GL_PIXEL_PACK_BUFFER’ was not declared in this scope; did you mean ‘GL_PIXEL_PACK_BUFFER_NV’?
  519 |  glBindBuffer(GL_PIXEL_PACK_BUFFER, ndiPbo[PboIndex]);
      |               ^~~~~~~~~~~~~~~~~~~~
      |               GL_PIXEL_PACK_BUFFER_NV
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:528:48: error: ‘GL_READ_ONLY’ was not declared in this scope; did you mean ‘GL_RED_NV’?
  528 |  pboMemory = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
      |                                                ^~~~~~~~~~~~
      |                                                GL_RED_NV
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:528:14: error: ‘glMapBuffer’ was not declared in this scope; did you mean ‘glIsBuffer’?
  528 |  pboMemory = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
      |              ^~~~~~~~~~~
      |              glIsBuffer
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:532:3: error: ‘glUnmapBuffer’ was not declared in this scope
  532 |   glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
      |   ^~~~~~~~~~~~~
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp: In member function ‘bool ofxNDIsender::ReadTexturePixels(ofTexture, unsigned int, unsigned int, unsigned char*)’:
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:566:2: error: ‘glReadBuffer’ was not declared in this scope; did you mean ‘glBindBuffer’?
  566 |  glReadBuffer(GL_FRONT);
      |  ^~~~~~~~~~~~
      |  glBindBuffer
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:569:15: error: ‘GL_PIXEL_PACK_BUFFER’ was not declared in this scope; did you mean ‘GL_PIXEL_PACK_BUFFER_NV’?
  569 |  glBindBuffer(GL_PIXEL_PACK_BUFFER, ndiPbo[PboIndex]);
      |               ^~~~~~~~~~~~~~~~~~~~
      |               GL_PIXEL_PACK_BUFFER_NV
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:578:48: error: ‘GL_READ_ONLY’ was not declared in this scope; did you mean ‘GL_RED_NV’?
  578 |  pboMemory = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
      |                                                ^~~~~~~~~~~~
      |                                                GL_RED_NV
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:578:14: error: ‘glMapBuffer’ was not declared in this scope; did you mean ‘glIsBuffer’?
  578 |  pboMemory = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
      |              ^~~~~~~~~~~
      |              glIsBuffer
/home/agentti/of_v0.11.2_linuxarmv7l_release/addons/ofxNDI/src/ofxNDIsender.cpp:582:3: error: ‘glUnmapBuffer’ was not declared in this scope
  582 |   glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
      |   ^~~~~~~~~~~~~
leadedge commented 2 years ago

Hi @rytai

Maybe you can get some leads or contacts from this issue.

It could be a simple definition problem. These thngs are defined in :

Openframweworks\libs\glew\include\GL\glew.h

Try putting in the definitions directly :

ifndef GL_BGRA

define GL_BGRA 0x80E1

endif

ifndef GL_PIXEL_PACK_BUFFER

define GL_PIXEL_PACK_BUFFER 0x88EB

endif

ifndef GL_PIXEL_UNPACK_BUFFER

define GL_PIXEL_UNPACK_BUFFER 0x88EC

endif

Otherwise you could remove the PBO functions entirely. There is an option "SetReadback" to use PBOs. The flag "m_bReadback" default is false in any case.

leadedge commented 2 years ago

I think the problem could be that the RPI might not support Pixel buffer objects. In that case, remove or comment out these functions to see if that resolves it. I can't help much without a unit to develop with.