You need to be using GraphicsWindowEmbedded, and your call to
eglGetDisplay() should use EGL_DEFAULT_DISPLAY .

On Fri, Sep 26, 2014 at 12:10 PM, joey pedroza <jpedr...@thex1.com> wrote:

> Hi Team,
>
> It was decided that it is a priority to get this project to run on
> windows.  So I went down the path of trying to get it to work. That is my
> life right now.
>
> Unfortunately they don't want to use SDL 2.
>
> Here is where I'm at currently, I have been able to successfully compile
> the latest OSG with OpenGLES2.0 by removing the two files suggested
> GraphicsWindowWin32 and PixelBufferWin32.  I am using PowerVR open gl
> libraries.  This is an emulator.  It currently works for the overlay
> project so I know this will work here.
>
> Now I need to pass a graphic context to my code but the samples I saw do
> this. and I no longer have GraphicsWindowWin32? how else can I get a gc?
>
> osg::ref_ptr<osg::Referenced> windata = new
> osgViewer::GraphicsWindowWin32::WindowData( hwnd );
> /** WindowData is used to pass in the Win32 window handle attached the
> GraphicsContext::Traits structure.*/
> osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
> osg::GraphicsContext::Traits;
> traits->x = 0;
> traits->y = 0;
> traits->width = 800;
> traits->height = 600;
> traits->windowDecoration = false;
> traits->doubleBuffer = true;
> traits->inheritedWindowData = windata;
> osg::ref_ptr<osg::GraphicsContext> gc =
> osg::GraphicsContext::createGraphicsContext( traits.get() );
> osg::ref_ptr<osg::Camera> camera = new osg::Camera;
> camera->setGraphicsContext( gc );
> camera->setViewport( new osg::Viewport(0, 0, traits->width,
> traits->height) );
> camera->setClearMask( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
> camera->setClearColor( osg::Vec4f(0.2f, 0.2f, 0.4f, 1.0f) );
> camera->setProjectionMatrixAsPerspective(
> 30.0f,(double)traits->width/(double)traits->height,1.0,1000.0 );
> g_viewer = new osgViewer::Viewer;
> g_viewer->setCamera( camera.get() );
> g_viewer->setSceneData( osgDB::readNodeFile("cessna.osg") );
> g_viewer->setKeyEventSetsDone( 0 );
> g_viewer->setCameraManipulator( new osgGA::TrackballManipulator );
>
> In our overlay project which is where we get the graphic context that we
> want to pass on to osg the code is like so
> case WM_CREATE:
>             egl_window = hWnd;
>
>             //Store the device context.
>             hDC = GetDC(hWnd);
>
>             //Get the default display.
>             egl_display = eglGetDisplay(hDC);
>             //eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
>
>             //Initialize EGL.
>             eglInitialize(egl_display, &egl_major_version,
> &egl_minor_version);
>
>             //Make OpenGL ES the current API.
>             eglBindAPI(EGL_OPENGL_ES_API);
>
>             //Find a configuration that matches all requirements.
>             eglChooseConfig(egl_display, egl_config_attributes,
> &egl_config, 1, &configs);
>
>             //Create a drawing surface.
>             egl_surface = eglCreateWindowSurface(egl_display, egl_config,
> egl_window, NULL);
>
>             //Create a context.
>             egl_context = eglCreateContext(egl_display, egl_config, NULL,
> egl_context_attributes);
>
>             //Bind the context to the current thread and use window
> surface for drawing.
>             eglMakeCurrent(egl_display, egl_surface, egl_surface,
> egl_context);
>
>             //Specify the minimum number of video frame periods per buffer
> swap.
>             //If interval is set to a value of 0, buffer swaps are not
> synchronized to a video frame,
>             //and the swap happens as soon as the render is complete.
>             eglSwapInterval(egl_display, 1);
>             //eglSwapInterval(egl_display, 0);
>
>             //Get the version of OpenGL ES and GL Shading Language.
>             opengl_es_version = glGetString(GL_VERSION);
>             glsl_version = glGetString(GL_SHADING_LANGUAGE_VERSION);
>
>             //Set the clear values for the color buffer.
>             glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
>
>             //Set the OpenGL display settings.
>             glEnable(GL_BLEND);
>             glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
>
>             glEnable(GL_DEPTH_TEST);
>             glDepthMask(GL_TRUE);
>             glDepthFunc(GL_LEQUAL);
>             glClearDepthf(1.0f);
>             glDepthRangef(0.0f, 1.0f);
>
>             //Load the default shader program.
>             shader.load_default_shader();
>             default_shader_program = shader.get_default_shader_program();
>
>             //Generate texture names.
>             generate_texture_names(texture_id);
>
> Thank you!
>
> Cheers,
> joey
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=61182#61182
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Digital Imaging • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography
• Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS •
Android
@alphapixel <https://twitter.com/alphapixel> facebook.com/alphapixel (775)
623-PIXL [7495]
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to