On top of that, GL drivers on Windows are known to be flaky or downright bugged unless you use code paths that games might use. This means that there are differences in how the GL driver might decide to perform texture format conversions. The main difference between GLFW and GtkGLArea is that GtkGLArea is rendering to a FBO, whereas GLFW will render to an on screen buffer. GlfwSetWindowShouldClose(window,GLFW_TRUE) If (glfwGetKey(window,GLFW_KEY_ESCAPE) = GLFW_PRESS) GLFWwindow* win = glfwCreateWindow(1920,1080,"picplayer",NULL,NULL) GlfwWindowHint(GLFW_OPENGL_PROFILE,GLFW_OPENGL_COMPAT_PROFILE) GlfwWindowHint(GLFW_CONTEXT_VERSION_MINOR,3) GlfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,3) G_signal_connect(gl_area,"realize",G_CALLBACK(on_realize),NULL) īuild command: gcc -o gtk_picplayer main.c `pkg-config -cflags -libs glew cairo gtk+-3.0` -lopengl32 \n", cairo_status_to_string(surface_status)) If (surface_status != CAIRO_STATUS_SUCCESS) Static gboolean render(GtkGLArea *area, GdkGLContext *context)Ĭairo_status_t surface_status = cairo_surface_status(surface) If (gtk_gl_area_get_error (area) != NULL) What’s wrong with it ? the gtk3-opengl demo draw triangle is ok,and the above code on glfw works well GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP) GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP) Status = g_application_run(G_APPLICATION(app), argc, argv) Īnd i also test the follow code, use texture, but not work static gboolean render(GtkGlArea *area, GdkGlContext *content)Ĭairo_surface_t* surface = cairo_image_surface_create_from_png("./test.png") G_signal_connect(app, "activate", G_CALLBACK(activate), NULL) G_signal_connect(gl_area,"render",G_CALLBACK(render),NULL) Īpp = gtk_application_new("", G_APPLICATION_FLAGS_NONE) Gtk_container_add(GTK_CONTAINER(window),gl_area) Gtk_window_set_default_size(GTK_WINDOW(window), 1920, 1080) Gtk_window_set_title(GTK_WINDOW(window), "picplayer-gl") Window = gtk_application_window_new(app) Static void activate(GtkApplication *app, gpointer user_data) Unsigned char* data= cairo_image_surface_get_data(surface) I’m new to opengl, i use GtkGLArea widget to display a image on win32 platform, but it didn’t work, the window’s background color is changed, but image not display, main code as follow: static gboolean render(GtkGLArea *area, GdkGLContext *context)Ĭairo_surface_t* surface = cairo_image_surface_create_from_png("./test.PNG")
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |