Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Hi Remo, On 14 March 2017 at 18:16, Remo Eichenbergerwrote: > The env variable doesn't help. I see such errors: > > With subloading enabled i see this: > > before Glyph::subload(): detected OpenGL error: invalid enumerant > Glyph::subload(): texture sub-image width and/or height of 0, ignoring > operation. I can't investigate these OSX specific issues. There is a limit to the amount of free support I can do on this, the rewrite of osgText has already cost me three weeks work, all unpaid. It's time that OSX users stood up to the plate and started resolving OSX specific issues. There are other pressing things I need to get on with. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
The env variable doesn't help. I see such errors: With subloading enabled i see this: before Glyph::subload(): detected OpenGL error: invalid enumerant Glyph::subload(): texture sub-image width and/or height of 0, ignoring operation. I've posted the log on the github issue. Remo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70493#70493 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
On 14 March 2017 at 17:38, Remo Eichenbergerwrote: > Without this setting I see only a blue screen/window without any text. Do you get any GL errors reported on the console? Could you try disabling the incremental subloading of the glyph texture by setting the env var OSG_TEXT_INCREMENTAL_SUBLOADING to OFF i.e. setenv OSG_TEXT_INCREMENTAL_SUBLOADING OFF osgtext Also have you tried OSG+GL3 on other platforms? Knowing whether this is a OSX specific bug or not will help us look for what the cause might be. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Without this setting I see only a blue screen/window without any text. Remo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70491#70491 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
On 14 March 2017 at 17:01, Remo Eichenbergerwrote: > Update: Stock sample "examples_osgtext" partial works with: > > font->setMinFilterHint(osg::Texture::LINEAR); > > on MacOSX GL3 Core Profile This will be disabling mipmapping. Surely OSX GL3 core profile supports mipmapping. this is a fundamental feature of texturing. Perhaps the driver is broken. Disabling mipmapping on text is not desirable as you'll end up with aliasing artefacts when the text on screen size results in the texel to pixel ratio less than one. What happens you don't use the font->setMinFilterHint(osg::Texture::LINEAR); hack? A screenshot would be useful. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Update: Stock sample "examples_osgtext" partial works with: font->setMinFilterHint(osg::Texture::LINEAR); on MacOSX GL3 Core Profile -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70487#70487 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Hi Robert I've tested the latest branch on MacOSX 10.11.6: https://github.com/openscenegraph/OpenSceneGraph/commit/f1f6d23eebda16a9d4560a0a130580d65edf7401 Non of the stock samples works because of not applied shader. MacOSX needs a default shader. But simple text works when i add a shader on my sample code. Then i've added the Statshandler. It doesn't show the statistics. Cheers, Remo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70465#70465 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Hi Remo, As a first step to resolving the osgText issues with VAO I have created a text_refactor branch off OSG master. All I have done so far is add the ability of osgText::TextBase to have NodeList _children that it traverses automatically, this _children list is intended for the Text and Text3D classes to populate with standard scene graph elements such as osg::Geometry/osg::StateSet to render the text in conventional ways rather the the custom render code that these classes currently have. The next step will be to adapt osgText::Text to create the appropriate subgraph to render the text and add this into the _children list. osgText::Text is not a straight forward class so I expect we'll need to slow fill in all the functionality bit by bit. I welcome efforts from the community in this effort. Cheers, Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
HI Remo, On 27 January 2017 at 14:29, Remo Eichenbergerwrote: > OSG_VERTEX_BUFFER_HINT=VAO > OSG_GEOMETRY_IMPLEMENTATION=VAO Oh well, that exhausts one possibility of a fix. I don't really know if it's worth trying to fix osgText::Text, when I made the changes to support VAO I got things working under Linux, or at least it appeared to be working, but osgText::Text implementation is a real mess internally due to several early design decisions based on limitations of hardware 15 years back then a series of contribution that added extra features to Text but also with lots of complexities. To properly fix it I feel that it might even be worth making osgText::Text and full node and have it generate a subgraph (made with standard osg::Geometry etc.) to do the actual rendering rather than embed it all in a custom Drawable as is done now. The problem would be backwards compatibility. I have too much other work on right now to dive into topic, but have a think about the issues when I do have time. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
yes, OSG_VERTEX_BUFFER_HINT=VAO OSG_GEOMETRY_IMPLEMENTATION=VAO -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70065#70065 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
On 27 January 2017 at 14:15, Remo Eichenbergerwrote: > I use OSG master 255a86cbe22ba436ab162bd2a2e7cc0341140050 Have you enabled the new VAO support? The env var OSG_VERTEX_BUFFER_HINT should be used and set to VAO. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Hi Robert I use OSG master 255a86cbe22ba436ab162bd2a2e7cc0341140050 Cheers, Remo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70063#70063 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Hi Remo, On 27 January 2017 at 13:59, Remo Eichenbergerwrote: > I've tried a lot of things to get osgText working on MacOSX with VAO. GL3 on > OSX Core Profile requires VAOs. I don't have an OSX system so can't comment on the specifics of VAO support on MacOSX, I have rely upon OSX users to provide testing and guidance on it. The only thing I can add is to ask which version of the OSG you are using, and whether you've tested the new VAO support in OSG master. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Hi (Robert :) I've tried a lot of things to get osgText working on MacOSX with VAO. GL3 on OSX Core Profile requires VAOs. osgText doesn't setup the VAO path correctly on MacOSX. I can show glyphs when I use a osg::Geometry as a Wrapper to draw geometries from text glyphs like so: Code: class ExtText : public Text { friend class VAOText; }; class VAOText : public osg::Geometry { private: osg::ref_ptr _t; ... void redraw() { unsigned int contextID = 0; // renderInfo.getState()->getContextID(); if ( !_t->_textureGlyphQuadMap.empty() ) { const ExtText::GlyphQuads& glyphquad = (_t->_textureGlyphQuadMap.begin())->second; if (!glyphquad._transformedCoords[contextID].valid() || glyphquad._transformedCoords[contextID]->empty() ) { _t->computePositions(contextID); } } for(ExtText::TextureGlyphQuadMap::iterator titr=_t->_textureGlyphQuadMap.begin(); titr!=_t->_textureGlyphQuadMap.end(); ++titr) { const ExtText::GlyphQuads& glyphquad = titr->second; const ExtText::GlyphQuads::Coords3& transformedCoords = glyphquad._transformedCoords[contextID]; if (transformedCoords.valid() && !transformedCoords->empty()) { setVertexArray(transformedCoords.get()); setTexCoordArray(0, glyphquad._texcoords.get()); getOrCreateStateSet()->setTextureAttributeAndModes(0, titr->first.get(),osg::StateAttribute::ON); addPrimitiveSet(glyphquad._quadIndices); } } } But it doesn't work with plain osgText. So something is wrong in osgText / VAO. Cheers, Remo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70061#70061 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Hi Remo Hi Sebastian I'm wondering if you have a running osgText on MacOSX Core Profile. Your shader-code is not compatible with it. I've written a partial working version of this shader. I also found that the Glyph Texture is created with red. But i think something is wrong with the texturecoordinates. I don't see any glyph. I'm not using MacOSX, but I'm running on core profile under Windows and the shader seems to work for osgText there. Code: uniform sampler2D glyphTexture; in vec2 texCoord; out vec4 color; void main() { color = vertexColor * texture(glyphTexture, texCoord).r; } Basically the font should be white and modulated by the vertex color. I would have to dive into the implementation to see, why your information is in the red-channel. It might very well be, that the osgText is using GL_RED or something else which I can access via the .a swizzle in my driver. I'm not sure the code of "Text::drawForegroundText" can work with VAO (It's required on MacOSX) I'm not sure if the VAO path is used on my side. So I can't help you with this one. Cheers Sebastian Here you find a draw dump from MacOSX: [Image: http://forum.openscenegraph.org/files/dump_202.png ] Cheers, Remo[/img] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70036#70036 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Hi Sebastian, Sorry, please ignore my post. The code is wrong. I need to test it first :) Cheers, Remo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70027#70027 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Hi Sebastian Thank you for your help. Yes i don't see the glyphs. I use osgEarth, but this should not be a problem :) I've tried the following according your sample: Code: ControlCanvas* canvas = ControlCanvas::getOrCreate( view ); view->getCamera()->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(true); view->getCamera()->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(true); osg::ref_ptr texture = new osg::Texture2D; osg::ref_ptr image = new osg::Image(); image->allocateImage(512, 512, 1, GL_RGBA, GL_UNSIGNED_BYTE); texture->setImage(image); view->getCamera()->getOrCreateStateSet()->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); LabelControl* label = new LabelControl(); osg::Program* textProgramObject = new osg::Program; osg::Shader* textVertexObject = new osg::Shader( osg::Shader::VERTEX ); osg::Shader* textFragmentObject = new osg::Shader( osg::Shader::FRAGMENT ); textProgramObject->addShader( textFragmentObject ); textProgramObject->addShader( textVertexObject ); textFragmentObject->setShaderSource(frag); textVertexObject->setShaderSource(vert); label->getOrCreateStateSet()->setAttributeAndModes(textProgramObject, osg::StateAttribute::ON); label->setTextBackdropType(osgText::Text::BackdropType::NONE); label->setTextBackdropImplementation(osgText::Text::BackdropImplementation::DELAYED_DEPTH_WRITES); label->setBackColor( Color( Color::Black, 0.8 ) ); label->setHorizAlign( Control::ALIGN_RIGHT ); label->setVertAlign( Control::ALIGN_BOTTOM ); label->setVisible( true ); But i don't see any glyphs. Cheers, Remo[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70024#70024 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Hi Remo, A more detailed description on how it fails would be helpful. If you're seeing non-textures quads instead of your glyphs you need to adapt your shader as the text-rendering isn't using a normal blending. I've attached my default core-profile shader which uses pre-multiplied alpha. Additionally I add a default sampler at camera root for the osg_Texture and I do: for (auto index = 0u; index < mMainViewer->getNumViews(); ++index ) { getCamera(index)->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(true); getCamera(index)->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(true); } nsRenderer::Helpers::addTexture( stats_handler->getCamera()->getOrCreateStateSet(), "osg_Texture",new osg::Texture2D(nsRenderer::Helpers::getDefaultImage(false)), 0); Hope that helps Sebastian Hi, I can't render osgText on MacOSX Core Profile: text->setTextBackdropType(osgText::Text::BackdropType::NONE); text->setTextBackdropImplementation(osgText::Text::BackdropImplementation::DELAYED_DEPTH_WRITES); text->setBackColor( Color( Color::Black, 0.8 ) ); text->setHorizAlign( Control::ALIGN_RIGHT ); text->setVertAlign( Control::ALIGN_BOTTOM ); text->setVisible( true ); I've also tried to apply a default shader. But it doesn't work at all. Cheers, Remo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70020#70020 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org #version 440 #extension GL_ARB_enhanced_layouts : enable #extension GL_ARB_separate_shader_objects : enable layout (location=0) out vec4 FragmentData; layout(location=1) in block { mediump vec2 tex_coord; mediump vec4 color; } In; uniform sampler2D osg_Texture; void main() { vec4 diffuse_color = In.color; diffuse_color *= texture2D(osg_Texture, In.tex_coord).a; FragmentData = diffuse_color; }#version 440 #extension GL_ARB_enhanced_layouts : enable #extension GL_ARB_separate_shader_objects : enable layout (location=0) in vec4 osg_Vertex; layout (location=1) in vec3 osg_Normal; layout (location=2) in vec4 osg_Color; layout (location=3) in vec4 osg_MultiTexCoord0; #ifdef HUD_CLIP_PLANES layout(shared) uniform instanceData { vec4 clipPlane[6]; }; #endif uniform mat4 osg_ModelViewMatrix; uniform mat4 osg_ModelViewProjectionMatrix; uniform mat4 TextureMatrix; out gl_PerVertex { vec4 gl_Position; }; layout(location=1) out block { mediump vec2 tex_coord; mediump vec4 color; } Out; void main() { Out.color = osg_Color; Out.tex_coord = vec4(osg_MultiTexCoord0).xy; gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex; } ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Hi, I can't render osgText on MacOSX Core Profile: text->setTextBackdropType(osgText::Text::BackdropType::NONE); text->setTextBackdropImplementation(osgText::Text::BackdropImplementation::DELAYED_DEPTH_WRITES); text->setBackColor( Color( Color::Black, 0.8 ) ); text->setHorizAlign( Control::ALIGN_RIGHT ); text->setVertAlign( Control::ALIGN_BOTTOM ); text->setVisible( true ); I've also tried to apply a default shader. But it doesn't work at all. Cheers, Remo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70020#70020 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org