Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 10-08-08, 05:23 AM   #1
thomas001
Registered User
 
Join Date: Jun 2006
Posts: 3
Default Compiz + multiple OpenGL contexts per window = nvidia driver bug?

Hi,

I am working on an OpenGL application which uses several opengl subwindows within a single window, like a 3D modeller or CAD program. The subwindows can be resized against each other, which works fine until I use compiz as window manager. With compiz the opengl windows do not get redrawn at all,when i resize them. The whole screen flickers black while resizing and after a while the whole application simply crashs.
This is reported with at least 3 nvidia cards (6600,8500,8800) and on several linux distribution. The application uses GTK+ and gtkglext,so it could be a gtkglext or a compiz bug, but the opengl driver sounds more likely to me.

here is the code (run as gcc `pkg-config gtk+-2.0 gtkglext-1.0 --cflags --libs` code.c && ./a.out)
try to move the slider a bit around to get the described bug.
Code:
#include <gtk/gtk.h>
#include <gtk/gtkgl.h>
#include <GL/gl.h>



static gboolean expose (GtkWidget *da, GdkEventExpose *event, gpointer user_data)
{
  GdkGLContext *glcontext = gtk_widget_get_gl_context (da);
  GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (da);

  if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext))
    g_assert_not_reached ();

  glClear(GL_COLOR_BUFFER_BIT);
  if (gdk_gl_drawable_is_double_buffered (gldrawable))
    gdk_gl_drawable_swap_buffers (gldrawable);
  else glFlush ();

  gdk_gl_drawable_gl_end (gldrawable);

  return TRUE;
}



static gboolean configure (GtkWidget *da, GdkEventConfigure *event, gpointer user_data)
{
  GdkGLContext *glcontext = gtk_widget_get_gl_context (da);
  GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (da);

  if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext))
    g_assert_not_reached ();

  glLoadIdentity();
  glViewport (0, 0, da->allocation.width, da->allocation.height);
  glOrtho (-10,10,-10,10,-20050,10000);

  gdk_gl_drawable_gl_end (gldrawable);

  return TRUE;
}




int main (int argc, char *argv[])
{
  GtkWidget *window;
  GtkWidget *hpaned;
  GtkWidget *left;
  GtkWidget *right;
  GdkGLConfig *glconfig_left;
  GdkGLConfig *glconfig_right;

  gtk_init (&argc, &argv);
  gtk_gl_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "two OpenGL contexts");
  gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
  g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL);

  hpaned = gtk_hpaned_new ();
  gtk_container_add (GTK_CONTAINER (window), hpaned);
  gtk_widget_show (hpaned);

  left = gtk_drawing_area_new ();
  gtk_widget_set_events (left, GDK_EXPOSURE_MASK);

  glconfig_left = gdk_gl_config_new_by_mode ( (GdkGLConfigMode) (GDK_GL_MODE_RGB)); 
  if (!glconfig_left)
    g_assert_not_reached ();

  if (!gtk_widget_set_gl_capability (left, glconfig_left, NULL, TRUE, GDK_GL_RGBA_TYPE)) 
    g_assert_not_reached ();

  g_signal_connect (left, "configure-event", G_CALLBACK (configure), NULL);
  g_signal_connect (left, "expose-event", G_CALLBACK (expose), NULL);

  gtk_paned_add1 (GTK_PANED (hpaned), left);

  right = gtk_drawing_area_new ();
  gtk_widget_set_events (right, GDK_EXPOSURE_MASK);

  glconfig_right = gdk_gl_config_new_by_mode ( (GdkGLConfigMode) (GDK_GL_MODE_RGB)); 
  if (!glconfig_right)
    g_assert_not_reached ();

  if (!gtk_widget_set_gl_capability (right, glconfig_right, NULL, TRUE, GDK_GL_RGBA_TYPE)) 
    g_assert_not_reached ();

  g_signal_connect (right, "configure-event", G_CALLBACK (configure), NULL);
  g_signal_connect (right, "expose-event", G_CALLBACK (expose), NULL);

  gtk_paned_add2 (GTK_PANED (hpaned), right);

  gtk_widget_show (left);
  gtk_widget_show (right);
  gtk_widget_show (hpaned);
  gtk_widget_show (window);

  gtk_main ();

  return 0;
}
thomas001 is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
NVIDIA R302.80 Beta Driver for Windows 8, New OpenGL Extensions News Archived News Items 0 06-15-12 10:30 AM
OpenGL apps crashing in NVIDIA driver when switching desktop dinosaur NVIDIA Linux 0 06-01-12 07:09 PM
Need Help Installing NVIDIA Tesla M2070Q in Linux RHEL5 Ferianto85 NVIDIA Linux 0 05-18-12 08:35 PM
Getting the proprietary nvidia driver to run with Debian 3.0 r0 (woody) Katchina404 NVIDIA Linux 9 01-12-03 08:49 AM
Multiple OpenGL applications and NVidia gbrauer NVIDIA Linux 7 09-01-02 04:47 PM

All times are GMT -5. The time now is 12:36 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.