Skip to content

Instantly share code, notes, and snippets.

View willbetheone's full-sized avatar
🧐
机器表达、理解、分析与决策

William willbetheone

🧐
机器表达、理解、分析与决策
View GitHub Profile
@zhangzhensong
zhangzhensong / cvgltexture.cpp
Last active October 11, 2022 20:52
Converting OpenCV Mat to OpenGL texture
// don't forget to include related head files
void BindCVMat2GLTexture(cv::Mat& image, GLuint& imageTexture)
{
if(image.empty()){
std::cout << "image empty" << std::endl;
}else{
//glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glGenTextures(1, &imageTexture1);
glBindTexture(GL_TEXTURE_2D, imageTexture1);
@caojianhua
caojianhua / OpenGLToCVPixelBuffer.m
Created January 27, 2016 09:29
Create CVPixelBufferRef from OpenGL
@interface SREAGLContext : NSObject
+ (EAGLContext*)sharedContext;
+ (EAGLContext*)newContext: (EAGLRenderingAPI) api;
@end
@implementation SREAGLContext
@stephanedeluca
stephanedeluca / main.dart
Last active June 6, 2023 04:07
Create an non existant enum in dart
/// Shows what to do when creating an enum value from a integer value
enum ThemeColor { red, green,}
void main() {
try {
final nonExistent = ThemeColor.values[3];
print("Non existent enum is $nonExistent");