[osg-users] [forum] DXT texture compression

Robert Osfield robert.osfield at gmail.com
Fri May 18 05:08:02 PDT 2018


Hi Roby,

On 18 May 2018 at 12:46, Roby Urban Chaos <urbanchaos at email.it> wrote:
> Now that I've changed the name, in according to the netiquette, the human name will appear.

Thanks :-)

> Thanks for the information.

> Going back to the code, below how I've realized a very small graphic context.
>
>
> Code:
>
> osg::ref_ptr<osg::GraphicContext::Traits> traits = new osg::GraphicContext::Traits;
>
> traits->x = 1;
> traits->y = 1;
> traits->width = 1;
> traits->height = 1;
> traits->alpha = 8;
> traits->windowDecoration = false;
> traits->doubleBuffer = true;
> traits->sharedContext = 0;
> traits->pbuffer = 0;
>
> osg::ref_ptr<osg::GraphicContext> gfx = new osg::GraphicContext::createGraphicsContext(traits.get());
> if (!gfx || !gfx->valid())
> {
> // osg::notify - Unable to create a graphic context
> return 1;
> }
>
> gfx->realize();
> gfx->makeCurrent();
>
>
>
>
> The code has stopped working since OSG 3.2.1.

The graphics context code has stopped working?  Or the compression?


>
> Since 3.2.1, the RGB plugin shows a warning "RGB plugin does not supporting writing compressed imagery" and the DDS output was not flipped.

FYI, I've quietened down the RGB plugin warning so it's only emitted
when you try to write a compressed image to a .rgb file.  This change
now checked into the 3.6 branch, so the warning won't appear once
3.6.1 comes out.


> Since 3.4.1, I got a segmentation fault.
>
> The code has been extracted from the "osgconv" applications (CompressTextureVisitor).
>
> Any suggestions?

This morning I had a bash at recreating the crash on my system so
cobbled together a test application the uses a bit of your code
snippet and some code for creating the graphics context.

The code works fine for me using the 3.6 branch head on my Kubuntu
system.  I have just built against 3.6.0 and it works fine as well.

Could you test the test program and let me know what happens.

For future reference, the best way for myself and others to be able to
investigate issues is to have a complete compilable example like the
attached one, otherwise it's a lot more work and far more likely to
not recreate issues that you see, we basically have to take a best
guess what we think you have, write it and hope for the best.  Copy
and pasting snippets is very poor second to having a compilable
application.

Cheers,
Robert.
-------------- next part --------------
cmake_minimum_required(VERSION 2.6)

SET(PROJECT_NAME compressionbug)

PROJECT(${PROJECT_NAME})

FIND_PACKAGE(OpenThreads)
FIND_PACKAGE(osg)
FIND_PACKAGE(osgDB)
FIND_PACKAGE(osgUtil)
FIND_PACKAGE(osgGA)
FIND_PACKAGE(osgViewer)
FIND_PACKAGE(osgText)

SET(SOURCES
    main.cpp
)

INCLUDE_DIRECTORIES(${OPENTHREADS_INCLUDE_DIR} ${OSG_INCLUDE_DIR})

LINK_DIRECTORIES(${OSG_LIB_DIR})

ADD_EXECUTABLE(${PROJECT_NAME} ${SOURCES})

TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OSG_LIBRARIES} ${OSGVIEWER_LIBRARIES} ${OSGUTIL_LIBRARIES} ${OSGDB_LIBRARIES} ${OSGGA_LIBRARIES} ${OSGTEXT_LIBRARIES} ${OPENTHREADS_LIBRARIES})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 1978 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180518/054a40e5/attachment.cpp>


More information about the osg-users mailing list