Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:35:48+00:00 2026-06-05T11:35:48+00:00

I have a 2D texture placed over rectangular area – it’s a dynamic texture

  • 0

I have a 2D texture placed over rectangular area – it’s a dynamic texture image (640×480).

tex = new osg::Texture2D;
tex->setDataVariance( osg::Object::DYNAMIC );
tex->setResizeNonPowerOfTwoHint( false );
tex->setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::NEAREST );
tex->setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::NEAREST );
tex->setImage(myImage);

My image data is updated in other thread often (each N milliseconds):

myImage->setImage(
    width,
    height,
    1,
    3,
    GL_BGR,
    gl_data_size,
    (BYTE *)newImageData,
    osg::Image::AllocationMode::USE_MALLOC_FREE
);

And after that I want to update rendered image, if I use dirty( thought this was a best way for update ) on image set to texture, e.g.

// Update callback
...
myImage->dirty();
...

My performance is about 7-8 times slower than if I use just image replacement with same pointer.

// Update callback
...
tex->setImage(myImage);
...

Reading documentation and gidelines of OSG makes me think the correct way is – ‘dirty()’. But it’s extremly slow. Do I missunderstand something or there is a mistake in my code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:35:51+00:00Added an answer on June 5, 2026 at 11:35 am

    I’m assuming you are using not the latest (3.0.1) version of OSG, since it lacks the “dirty” method for Image class.
    In previous versions (2.x):

    inline void Image::dirty()
    {
        ++_modifiedCount;
        if (_bufferObject.valid())
            _bufferObject->dirty();
    }
    

    dirty() in turns resets all compiled lists for _bufferObject.
    On the other hand setImage begins like this:

    void Texture2D::setImage(Image* image)
    {
        if (_image == image) return;
        ...
    }
    

    so in your case it does nothing, if you are using the same pointer for the image.
    That’s why it’s faster, but I don’t know how OSG updates the actual texture if nothing changed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with drawing a texture stretched over a rectangular area in
I am wondering about when I have a texture named tex which I create
I have a texture onto which I render 16 drawings. The texture is 1024x1024
If I have a texture, is it then possible to generate a normal-map for
With WPF 3D, is it possible to have a texture with an alpha channel?
I have an OpenGL texture with transparent and opaque pixels (eg, texture contains a
What I currently have: Generating of texture coordinates given the width and height of
This is hopefully a simple question: I have an OpenGL texture and would like
I have a seamlessly tilable texture. In the fragmentshader i calculate the texturecoordinates UVproc
I have a very basic texture map problem in GL on iPhone, and I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.