OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Possibility to cast/convert TextureRectangle to Texture2D


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Tare
Newbie


Joined: 04 Apr 2018
Posts: 14

PostPosted: Mon Jun 25, 2018 10:02 am    Post subject:
Possibility to cast/convert TextureRectangle to Texture2D
Reply with quote

Hi,

is there a way to cast or convert from Texture2D to TextureRectangle (or the other way round)? I don't strictly need it, but it'd help me debugging a multi pass pipeline that seems to loose information somewhere from prerender cameras to the final rendering to the frame buffer.

I have tried to just dynamically cast between the two, but the resulting pointer is a nullpointer, so that does not seem to work. Technically they aren't sub classes of each other either, but as far as i can see they don't really use different members of methods.

Just additional info, since I use them for rendering to texture I don't have an image that I could just apply to the other texture.

Kind Regards,
Tim
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12144

PostPosted: Mon Jun 25, 2018 11:42 am    Post subject:
Possibility to cast/convert TextureRectangle to Texture2D
Reply with quote

Hi Tim.

Texture2D and TextureRectangle are wrappers around two distinct types
of OpenGL textures, and at a C++ level are both subclassed from
osg::Texture, so there is no OpenGL level mapping that makes sense in
attempting to convert one to the other, and at the C++ level there
isn't any means for casting one to the other, there are different end
of storty.

I really no clue as to why you are thinking that this "cast" might be
appropriate or useful, but it's not even close to something that is
either possible or useful.

The best we can do is ask you to take a step back and tell us what the
problem you have.

Robert.

On Mon, 25 Jun 2018 at 11:39, Tim Whowantstoknow <> wrote:
Quote:

Hi,

is there a way to cast or convert from Texture2D to TextureRectangle (or the other way round)? I don't strictly need it, but it'd help me debugging a multi pass pipeline that seems to loose information somewhere from prerender cameras to the final rendering to the frame buffer.

I have tried to just dynamically cast between the two, but the resulting pointer is a nullpointer, so that does not seem to work. Technically they aren't sub classes of each other either, but as far as i can see they don't really use different members of methods.

Just additional info, since I use them for rendering to texture I don't have an image that I could just apply to the other texture.

Kind Regards,
Tim

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74134#74134








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Tare
Newbie


Joined: 04 Apr 2018
Posts: 14

PostPosted: Mon Jun 25, 2018 12:55 pm    Post subject:
Reply with quote

The problem that I have is that for the GBuffer in our deferred rendering pipeline, every texture is a Texture2D. The result of the lighting step is also a Texture2D. However, the last step, a lens simulation, is a TextureRectangle which get's positioned on the screen and then just displayed in a last step.

The output of the deferred pipeline is wrong (or non-existend), so I'm trying to debug and see, where in the pipeline the error is. For that purpose, I want to display the individual steps of the Pipeline, i.e. the textures within the GBuffer, the output of the lighting step and in the end the lens simulation. We are planning our update from very old OpenGL to OpenGL4, but until that is done I have to work with texture2D and texture2DRect as the glsl methods to access the textures. And I have to change the shader code additionally if I want to change the input texture from Texture2D to TextureRectangle, which adds a lot of time for debugging purposes. It's just inconvenient to do and therefore it'd be a whole lot easier to just change the input texture from Texture2D to TextureRectangle and display it.

I hope I could explain this sufficiently...
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12144

PostPosted: Mon Jun 25, 2018 1:04 pm    Post subject:
Possibility to cast/convert TextureRectangle to Texture2D
Reply with quote

Hi Tim,

I just don't understand why Texture2D isn't sufficient for everything
you are doing. glTextureRectangle is deprecated, it was a temporary
workaround added to OpenGL, you shouldn't need it at all now that
OpenGL fully support non power of two textures.

So please just use Texture2D all the way.

Robert.
On Mon, 25 Jun 2018 at 13:55, Tim Whowantstoknow <> wrote:
Quote:

The problem that I have is that for the GBuffer in our deferred rendering pipeline, every texture is a Texture2D. The result of the lighting step is also a Texture2D. However, the last step, a lens simulation, is a TextureRectangle which get's positioned on the screen and then just displayed in a last step.

The output of the deferred pipeline is wrong (or non-existend), so I'm trying to debug and see, where in the pipeline the error is. For that purpose, I want to display the individual steps of the Pipeline, i.e. the textures within the GBuffer, the output of the lighting step and in the end the lens simulation. We are planning our update from very old OpenGL to OpenGL4, but until that is done I have to work with texture2D and texture2DRect as the glsl methods to access the textures. And I have to change the shader code additionally if I want to change the input texture from Texture2D to TextureRectangle, which adds a lot of time for debugging purposes. It's just inconvenient to do and therefore it'd be a whole lot easier to just change the input texture from Texture2D to TextureRectangle and display it.

I hope I could explain this sufficiently...

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74145#74145








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Tare
Newbie


Joined: 04 Apr 2018
Posts: 14

PostPosted: Tue Jun 26, 2018 6:25 am    Post subject:
Reply with quote

Quote:
I just don't understand why Texture2D isn't sufficient for everything


Yeah, neither do I Very Happy I didn't write the code, but I have to work with it. Perhaps I can convince my collegues of switching to Texture2D in the future.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts How to convert all ive texture units ... Bruce Cui Plugins [osgPlugins] 0 Tue Feb 06, 2018 3:15 am View latest post
No new posts Convert from screen space to world sp... NavyBas General 3 Thu Jun 22, 2017 6:14 pm View latest post
No new posts how to convert osgb files to old version Haojia General 1 Fri Jun 02, 2017 4:35 pm View latest post
No new posts FBX loader convert units options robertosfield Submission 1 Tue Apr 18, 2017 4:20 pm View latest post
No new posts shrink, optimize, convert scenedata Meldryt General 0 Wed Apr 05, 2017 12:06 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP