2006-11-29 Matthew Allum <mallum@openedhand.com>

* clutter/clutter-stage.c: (clutter_stage_realize):
        Set colormap on stage window - should fix issues
        with indirect rendering.
This commit is contained in:
Matthew Allum 2006-11-29 12:14:41 +00:00
parent 382edccf6d
commit 25b8dec464
2 changed files with 52 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2006-11-29 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-stage.c: (clutter_stage_realize):
Set colormap on stage window - should fix issues
with indirect rendering.
2006-11-23 Matthew Allum <mallum@openedhand.com> 2006-11-23 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-debug.h: * clutter/clutter-debug.h:

View File

@ -402,14 +402,42 @@ clutter_stage_realize (ClutterActor *actor)
return; return;
} }
CLUTTER_NOTE(GL, "visual id's %li vs %li",
priv->xvisinfo->visualid,
XVisualIDFromVisual(DefaultVisual(clutter_xdisplay(),
clutter_xscreen())));
if (priv->xwin == None) if (priv->xwin == None)
priv->xwin = XCreateSimpleWindow(clutter_xdisplay(), {
XSetWindowAttributes swa;
if (priv->xvisinfo->visualid
== XVisualIDFromVisual(DefaultVisual(clutter_xdisplay(),
clutter_xscreen())))
{
swa.colormap = DefaultColormap(clutter_xdisplay(),
clutter_xscreen());
}
else
{
swa.colormap = XCreateColormap(clutter_xdisplay(),
clutter_root_xwindow(),
priv->xvisinfo->visual,
AllocNone);
}
priv->xwin = XCreateWindow(clutter_xdisplay(),
clutter_root_xwindow(), clutter_root_xwindow(),
0, 0, 0, 0,
priv->xwin_width, priv->xwin_height, priv->xwin_width, priv->xwin_height,
0, 0, 0,
WhitePixel(clutter_xdisplay(), priv->xvisinfo->depth,
clutter_xscreen())); InputOutput,
priv->xvisinfo->visual,
CWColormap, &swa);
}
XSelectInput(clutter_xdisplay(), XSelectInput(clutter_xdisplay(),
priv->xwin, priv->xwin,
StructureNotifyMask StructureNotifyMask
@ -432,6 +460,12 @@ clutter_stage_realize (ClutterActor *actor)
priv->xvisinfo, priv->xvisinfo,
0, 0,
True); True);
if (priv->gl_context == None)
{
g_critical ("Unable to create suitable GL context.");
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
return;
}
glXMakeCurrent(clutter_xdisplay(), priv->xwin, priv->gl_context); glXMakeCurrent(clutter_xdisplay(), priv->xwin, priv->gl_context);
} }
@ -443,11 +477,14 @@ clutter_stage_realize (ClutterActor *actor)
"GL_RENDERER: %s\n" "GL_RENDERER: %s\n"
"GL_VERSION: %s\n" "GL_VERSION: %s\n"
"GL_EXTENSIONS: %s\n" "GL_EXTENSIONS: %s\n"
"Is direct: %s\n"
"===========================================", "===========================================",
glGetString (GL_VENDOR), glGetString (GL_VENDOR),
glGetString (GL_RENDERER), glGetString (GL_RENDERER),
glGetString (GL_VERSION), glGetString (GL_VERSION),
glGetString (GL_EXTENSIONS)); glGetString (GL_EXTENSIONS),
glXIsDirect(clutter_xdisplay(), priv->gl_context) ? "yes" : "no"
);
sync_gl_viewport (stage); sync_gl_viewport (stage);
} }