openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

Examples - Update

Open NickHardeman opened this issue 1 year ago • 4 comments

Some of the examples could be removed or refreshed / updated. Below are some that I think could use some attention and I plan to update. Will submit a PR per example.

3d

  • [ ] 3d / cameraRibbonExample
  • [x] 3d / meshFromCameraExample ( spins too fast ). #7091
  • [x] 3d / ofNodeExample #7086
  • [x] 3d / quaternionArcballExample #7090
  • [x] 3d / quaternionLatLongExample #7089

communication

  • [ ] communication / serialExample

gl

  • [x] ~~gl / alphaMaskingShaderExample~~ ( remove, duplicate of shader / 07_fboAlphaMask) #7087
  • [x] gl / areaLightExample #7078
  • [x] gl / geometryShaderExample #7085
  • [ ] gl / multiTextureShaderExample
  • [x] gl / singleLightExample > change to gl/pointLightExample #7080
  • [x] gl / transformFeedbackExample ( not included in OSX download? ) #7095
  • [x] add animated transform feedback example to gl / transformFeedbackExampleAnimated #7094
  • [ ] gl / computeShaderParticlesExample

shader

  • [x] shader / 07_fboAlphaMask #7081

Thoughts on any other examples?

NickHardeman avatar Sep 16 '22 15:09 NickHardeman

Great @NickHardeman! One example I really wanted to change is serialExample. It can be more inviting for beginners to work with serial communication, withtout memset, memcpy etc.

dimitre avatar Sep 16 '22 16:09 dimitre

@dimitre oh yeah! I'll add it to the list. I haven't done serial communication in a while. Maybe someone can help out with that one ;)

NickHardeman avatar Sep 16 '22 18:09 NickHardeman

I can work in an alternative approach, I use something like this

void ofApp::setup(){
	int baud = 9600;
	serial.listDevices();
	vector <ofSerialDeviceInfo> deviceList = serial.getDeviceList();
	// this should be set to whatever com port your serial device is connected to.
	// (ie, COM4 on a pc, /dev/tty.... on linux, /dev/tty... on a mac)
	// arduino users check in arduino app....
	serial.setup(0, baud); //open the first device
}

void ofApp::update(){
	if (serial.available()) {
		serial.readBytes(buffer, serial.available());
		serialData += buffer.getText();
		serial.flush();
	}
}

dimitre avatar Sep 16 '22 19:09 dimitre

That definitely seems more approachable.

NickHardeman avatar Sep 16 '22 19:09 NickHardeman

Going to ping @ofZach @LingDong @golanlevin on this thread and see if there are any examples that students often ask for.

ofTheo avatar Sep 26 '22 18:09 ofTheo

I'll think about this, but off the top of my head, some demos my students always really appreciate:

  • drawing into a high res fbo for high res image output
  • examples that help explain how to do custom meshes / geometry and texture map them (ie, cut up a webcam into triangles, etc)
  • converting paths -> polylines, polylines to meshes, etc

also if useful, @LingDong made this recently -- https://docs.google.com/spreadsheets/u/1/d/1cY0y377O5_fCWIJpXBNPofY-CCQq942r-sAb6SwKhkI/edit#gid=0 -- about conversions between different raster formats.... maybe some demo ideas there?

ofZach avatar Sep 26 '22 21:09 ofZach

other things that may be cool --

  • using offset shader (using a grain texture to add noise to drawing)
  • texture feedback with shader (ie, ping ponging fbos and pushing colors via a shader)

ofZach avatar Sep 26 '22 21:09 ofZach

Thanks @ofZach these are great! 👍

Been thinking that we should maybe just integrate the FBO read back from: https://github.com/satoruhiga/ofxFastFboReader into ofFbo.

The code is quite minimal and it would allow for realtime read back of high res FBOs.

converting paths -> polylines, polylines to meshes, etc

Oh this would be a great one!!

thanks!!

ofTheo avatar Sep 27 '22 15:09 ofTheo

Edit: updated in this PR - https://github.com/openframeworks/openFrameworks/pull/7119 videoGrabber, maybe change resolution to 640x480 once macOS doesn't support 320x240 anymore in builtin webcam

dimitre avatar Sep 28 '22 02:09 dimitre

Thank you for the insight @ofZach :) I added a few examples based on some of your suggestions

drawing into a high res fbo for high res image output

Simple saving of high res fbo #7104

converting paths -> polylines, polylines to meshes, etc

Paths to meshes from font #7109

NickHardeman avatar Sep 28 '22 19:09 NickHardeman

I can work in an alternative approach, I use something like this

void ofApp::setup(){
	int baud = 9600;
	serial.listDevices();
	vector <ofSerialDeviceInfo> deviceList = serial.getDeviceList();
	// this should be set to whatever com port your serial device is connected to.
	// (ie, COM4 on a pc, /dev/tty.... on linux, /dev/tty... on a mac)
	// arduino users check in arduino app....
	serial.setup(0, baud); //open the first device
}

void ofApp::update(){
	if (serial.available()) {
		serial.readBytes(buffer, serial.available());
		serialData += buffer.getText();
		serial.flush();
	}
}

@dimitre see #7101 :)

NickHardeman avatar Sep 28 '22 19:09 NickHardeman

@ofZach - some thoughts on fbo readback here. Found an approach that seems faster than the ofxFastFboReader addon.

https://github.com/openframeworks/openFrameworks/issues/7111

ofTheo avatar Sep 28 '22 21:09 ofTheo

Hi @NickHardeman Thanks for those great examples! Regarding the transformFeedbackExample I think is safe to include it in macos download right? I saw you build the examples using that platform.

The removal of the example from the downloads in macos, is before we merged the fix for transform feedback in macos. #6473

So I think after the fix we could include it in macos download.

eduardfrigola avatar Oct 04 '22 07:10 eduardfrigola

@eduardfrigola yes I created the example on macOS 12.5.1 with M1 chip. So it should be good to go on macOS

NickHardeman avatar Oct 04 '22 14:10 NickHardeman

@eduardfrigola thank you! I had been doing transform feedback with all GL calls prior to making this example and discovered that it had been integrated into OF. It's really great. Makes it much more straight forward.

NickHardeman avatar Oct 07 '22 03:10 NickHardeman

Hi! Already sent one PR but then realised that all the shader examples are currently missing a ; on line 18, ofRunMainLoop() in main.cpp. Might be already on your list but just dropping in a comment :)

sourya-sen avatar Oct 27 '22 06:10 sourya-sen