Re: [osg-users] PowerVR OpenGL ES on Linux

2011-12-27 Thread David Fries
On Fri, Dec 23, 2011 at 11:21:37AM -0700, Chris 'Xenon' Hanson wrote:
>   Trying to run OSG/osgviewer (and the GLES2 osgvertexattributes test 
> program) on Linux,
> under Ubuntu with the PowerVR emulator.
> 
>   It's not clear why eglChooseConfig is failing.
> 
>   This post:
> http://www.imgtec.com/forum/forum_posts.asp?TID=1378

The Nokia N900 (Maemo Linux) has a PowerVR and I had to make some
changes for it to get to initialize OpenGL ES there.  At one point in
time I had the hang glider up.  I included the patches related to
GraphicsWindowX11.cpp and skipped the rest.  I haven't looked at them
in a while, so I'm not sure exactly what the status of them is.  I
don't expect some of them to make any difference for you, like the one
preventing osgviewer from going full screen or the one relating to
input, I just included them in case the later patches failed without
them applied.  You might not apply the last patch, it might work
better without it.  These are off svn revision 12737.

Please Cc: me on any replies.

-- 
David Fries PGP pub CB1EE8F0
http://fries.net/~david/
>From a6699b411eccca28bbe497d690fc4dca26c4f60d Mon Sep 17 00:00:00 2001
From: David Fries 
Date: Fri, 22 Jan 2010 12:16:42 -0600
Subject: [PATCH 08/23] osgviewer changes to not go full screen

It is very annoying for it to startup full screen and when you resize
it doesn't add the window handles.
---
 include/osgViewer/Viewer|2 +-
 src/osgViewer/GraphicsWindowX11.cpp |   20 ++--
 src/osgViewer/Viewer.cpp|   14 --
 src/osgViewer/ViewerBase.cpp|7 ---
 4 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/include/osgViewer/Viewer b/include/osgViewer/Viewer
index 998e249..6b46efd 100644
--- a/include/osgViewer/Viewer
+++ b/include/osgViewer/Viewer
@@ -120,8 +120,8 @@ class OSGVIEWER_EXPORT Viewer : public ViewerBase, public osgViewer::View
 virtual void viewerInit() { init(); }
 
 osg::observer_ptr  _cameraWithFocus;
-
 
+bool _grabFocus;
 };
 
 
diff --git a/src/osgViewer/GraphicsWindowX11.cpp b/src/osgViewer/GraphicsWindowX11.cpp
index d9eef95..c46e483 100644
--- a/src/osgViewer/GraphicsWindowX11.cpp
+++ b/src/osgViewer/GraphicsWindowX11.cpp
@@ -485,7 +485,11 @@ bool GraphicsWindowX11::setWindowRectangleImplementation(int x, int y, int width
 
 checkAndSendEventFullScreenIfNeeded(display, x, y, width, height, _traits->windowDecoration);
 
-XMoveResizeWindow(display, _window, x, y, width, height);
+// Let the window manager specify the position if x and y are -1.
+if(x==-1 && y==-1)
+XResizeWindow(display, _window, width, height);
+else
+XMoveResizeWindow(display, _window, x, y, width, height);
 
 XFlush(display);
 XSync(display, 0);
@@ -911,6 +915,16 @@ bool GraphicsWindowX11::createWindow()
 }
 }
 
+// How do you specify the window settings on startup?  Hack it for now.
+if(_traits->x == 0 && _traits->y == 0 &&
+	_traits->width == 3200 && _traits->height == 1200)
+{
+	_traits->x = -1;
+	_traits->y = -1;
+	_traits->width = 320;
+	_traits->height = 200;
+}
+
 _window = XCreateWindow( _display, _parent,
  x,
  y,
@@ -937,7 +951,9 @@ bool GraphicsWindowX11::createWindow()
 sh.flags = 0;
 sh.flags |= USSize;
 sh.flags &= 0x7;
-sh.flags |= USPosition;
+// Let the window manager specify the position if x and y are -1.
+if(_traits->x!=-1 || _traits->y!=-1)
+sh.flags |= USPosition;
 sh.flags &= 0xB;
 sh.x = _traits->x;
 sh.y = _traits->y;
diff --git a/src/osgViewer/Viewer.cpp b/src/osgViewer/Viewer.cpp
index 7469268..7ce47ed 100644
--- a/src/osgViewer/Viewer.cpp
+++ b/src/osgViewer/Viewer.cpp
@@ -34,6 +34,7 @@ using namespace osgViewer;
 Viewer::Viewer()
 {
 _viewerBase = this;
+_grabFocus = false;
 
 constructorInit();
 }
@@ -41,6 +42,7 @@ Viewer::Viewer()
 Viewer::Viewer(osg::ArgumentParser& arguments)
 {
 _viewerBase = this;
+_grabFocus = false;
 
 constructorInit();
 
@@ -121,6 +123,15 @@ Viewer::Viewer(osg::ArgumentParser& arguments)
 
 int x = -1, y = -1, width = -1, height = -1;
 while (arguments.read("--window",x,y,width,height)) {}
+
+if(const char *ptr = getenv("OSG_GRAB"))
+{
+if(!strcmp(ptr, "OFF"))
+_grabFocus=false;
+else if(!strcmp(ptr, "ON"))
+_grabFocus=true;
+}
+while (arguments.read("--grab")) { _grabFocus=true; }
 
 bool ss3d = false;
 bool wowvx20 = false;
@@ -519,8 +530,7 @@ void Viewer::realize()
 // attach contexts to _incrementalCompileOperation if attached.
 if (_incrementalCompileOperation) _incrementalCompileOperation->assignContexts(contexts);
 
-bool grabFocus = true;
-if (grabFocus)
+if (_grabFocus)
 {
 for(Contexts::iterator citr = contexts.begin();
 c

[osg-users] PowerVR OpenGL ES on Linux

2011-12-23 Thread Chris 'Xenon' Hanson
  Trying to run OSG/osgviewer (and the GLES2 osgvertexattributes test program) 
on Linux,
under Ubuntu with the PowerVR emulator.

  I know cow.osg won't display, but just as a test to see if the GLES/EG stuff 
was working:

osgviewer cow.osg
GraphicsWindowX11::init() - eglInitialize() succeded eglMajorVersion=1 
iMinorVersion=3
GraphicsWindowX11::init() - window created =1
GraphicsWindowX11::init() - eglChooseConfig() failed.
  GraphicsWindow has not been created successfully.
Viewer::realize() - failed to set up any windows
GraphicsWindowX11::init() - eglInitialize() succeded eglMajorVersion=1 
iMinorVersion=3
GraphicsWindowX11::init() - window created =1
GraphicsWindowX11::init() - eglChooseConfig() failed.
  GraphicsWindow has not been created successfully.
Viewer::realize() - failed to set up any windows
max@UBU1:~/Dev/OSG/data$
max@UBU1:~/Dev/OSG/data$ osgvertexattributes cow.osg
GraphicsWindowX11::init() - eglInitialize() succeded eglMajorVersion=1 
iMinorVersion=3
GraphicsWindowX11::init() - window created =1
GraphicsWindowX11::init() - eglChooseConfig() failed.
  GraphicsWindow has not been created successfully.
Viewer::realize() - failed to set up any windows
GraphicsWindowX11::init() - eglInitialize() succeded eglMajorVersion=1 
iMinorVersion=3
GraphicsWindowX11::init() - window created =1
GraphicsWindowX11::init() - eglChooseConfig() failed.
  GraphicsWindow has not been created successfully.
Viewer::realize() - failed to set up any windows


  It's not clear why eglChooseConfig is failing.

  This post:
http://www.imgtec.com/forum/forum_posts.asp?TID=1378

  seems similar, but an excerpt of the glxinfo output:

server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
server glx extensions:
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig,
GLX_SGIX_pbuffer, GLX_SGI_video_sync, GLX_SGI_swap_control,
GLX_EXT_swap_control, GLX_EXT_texture_from_pixmap, GLX_ARB_create_context,
GLX_ARB_create_context_profile, GLX_EXT_create_context_es2_profile,
GLX_ARB_create_context_robustness, GLX_ARB_multisample,
GLX_NV_float_buffer, GLX_ARB_fbconfig_float, GLX_EXT_framebuffer_sRGB
client glx vendor string: NVIDIA Corporation
client glx version string: 1.4
client glx extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_visual_info,
GLX_EXT_visual_rating, GLX_EXT_import_context, GLX_SGI_video_sync,
GLX_NV_swap_group, GLX_NV_video_out, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
GLX_SGI_swap_control, GLX_EXT_swap_control, GLX_ARB_create_context,
GLX_ARB_create_context_profile, GLX_NV_float_buffer,
GLX_ARB_fbconfig_float, GLX_EXT_fbconfig_packed_float,
GLX_EXT_texture_from_pixmap, GLX_EXT_framebuffer_sRGB,
GLX_NV_present_video, GLX_NV_copy_image, GLX_NV_multisample_coverage,
GLX_NV_video_capture, GLX_EXT_create_context_es2_profile,
GLX_ARB_create_context_robustness
GLX version: 1.4
GLX extensions:
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig,
GLX_SGIX_pbuffer, GLX_SGI_video_sync, GLX_SGI_swap_control,
GLX_EXT_swap_control, GLX_EXT_texture_from_pixmap, GLX_ARB_create_context,
GLX_ARB_create_context_profile, GLX_EXT_create_context_es2_profile,
GLX_ARB_create_context_robustness, GLX_ARB_multisample,
GLX_NV_float_buffer, GLX_ARB_fbconfig_float, GLX_EXT_framebuffer_sRGB,
GLX_ARB_get_proc_address
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 260/PCI/SSE2/3DNOW!
OpenGL version string: 3.3.0 NVIDIA 280.13


  Shows we do have real NVidia drivers with GL3.3 support.


  I'm at a loss to think of what else might be going wrong. Is anyone else 
running a
similar setup, who might be able to suggest what we're overlooking?

  I'll follow-up for posterity if we figure it out here.


-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
"There is no Truth. There is only Perception. To Perceive is to Exist." - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org