@@ -183,12 +183,13 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CM
183
183
uint8_t *w = img_data[0 ].ptrw ();
184
184
memcpy (w, dataY, new_width * new_height);
185
185
img[0 ].instantiate ();
186
+ img[0 ]->set_data (new_width, new_height, 0 , Image::FORMAT_R8, img_data[0 ]);
186
187
#else
187
188
GodotUInt8Vector::Write w = img_data[0 ].write ();
188
189
memcpy (w.ptr (), dataY, new_width * new_height);
189
190
img[0 ].instance ();
190
- #endif
191
191
img[0 ]->create (new_width, new_height, 0 , Image::FORMAT_R8, img_data[0 ]);
192
+ #endif
192
193
}
193
194
194
195
{
@@ -202,18 +203,18 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CM
202
203
img_data[1 ].resize (2 * new_width * new_height);
203
204
}
204
205
206
+ // /TODO GLES2 doesn't support FORMAT_RG8, need to do some form of conversion
205
207
#if VERSION_MAJOR == 4
206
208
uint8_t *w = img_data[1 ].ptrw ();
207
209
memcpy (w, dataCbCr, 2 * new_width * new_height);
208
210
img[1 ].instantiate ();
211
+ img[1 ]->set_data (new_width, new_height, 0 , Image::FORMAT_RG8, img_data[1 ]);
209
212
#else
210
213
GodotUInt8Vector::Write w = img_data[1 ].write ();
211
214
memcpy (w.ptr (), dataCbCr, 2 * new_width * new_height);
212
215
img[1 ].instance ();
213
- #endif
214
-
215
- // /TODO GLES2 doesn't support FORMAT_RG8, need to do some form of conversion
216
216
img[1 ]->create (new_width, new_height, 0 , Image::FORMAT_RG8, img_data[1 ]);
217
+ #endif
217
218
}
218
219
219
220
// set our texture...
0 commit comments