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 

Constructor parameters of osg::Uniform


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


Joined: 06 Feb 2013
Posts: 94

PostPosted: Thu Jun 28, 2018 11:29 am    Post subject:
Constructor parameters of osg::Uniform
Reply with quote

Hi all,

I recently discovered a strange case in creation of a Uniform:

farRadiusRescaleUniform = new osg::Uniform("farRadiusRescale", 2.0f); The only constructor I could find is like that:

Uniform( Type type, const std::string& name, int numElements=1 ); The wrong construction sometimes leads to unexpected results.
Why is the compiler not reclaming about this mismatch in parameters?

- Werner -

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 821

PostPosted: Thu Jun 28, 2018 12:07 pm    Post subject:
Constructor parameters of osg::Uniform
Reply with quote

Hi Werner,


Quote:
Hi all,

I recently discovered a strange case in creation of a Uniform:

farRadiusRescaleUniform=newosg::Uniform("farRadiusRescale",2.0f);

The only constructor I could find is like that:

Uniform(Typetype,conststd::string&name,intnumElements=1);

The wrong construction sometimes leads to unexpected results.
Why is the compiler not reclaming about this mismatch in parameters?

This is called implicit conversion and is totally legal.
In order to make to compiler avoid implicit conversion it can be tagged
as explicit. As i've tumbled over this one more than once it might
acutally be a good idea to change the uniform constructors which take
only the name and "numElements".

@Robert:
Any insights?

Cheers
Sebastian

Quote:

- Werner -






------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11973

PostPosted: Thu Jun 28, 2018 12:57 pm    Post subject:
Constructor parameters of osg::Uniform
Reply with quote

On Thu, 28 Jun 2018 at 13:06, Sebastian Messerschmidt
<> wrote:
Quote:
@Robert:
Any insights?

The original osg::Uniform class is a bit of unwieldy mess. In
hindsight we shouldn't have gone for this particular implementation as
it's a bit too open ended.

In master I have written a osg::UniformBase class and a template
uniform class that enables use to create a series of explictly typed
uniforms such as IntUnfirom, FloatUnfiorm etc. This scheme is a bit
more robust when it comes to being able to easily pick the type you
want.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11973

PostPosted: Thu Jun 28, 2018 1:04 pm    Post subject:
Constructor parameters of osg::Uniform
Reply with quote

On Thu, 28 Jun 2018 at 13:57, Robert Osfield <> wrote:
Quote:
The original osg::Uniform class is a bit of unwieldy mess. In
hindsight we shouldn't have gone for this particular implementation as
it's a bit too open ended.

As a bit of background, Mike Weiblen with a bit of input from myself
created the GLSL support for the OSG before OpenGL 2.0 came out and on
prototype drivers. It was completely bleeding edge of OpenGL as well
as trying to implement this stuff in scene graphs, there was no prior
art, it was very much winging it. The fact that is has lasted so long
without a major rewrite suggests Mike came up with reasonable
solution.

The first git log entry for osg::Uniform is :

Date: Thu Feb 24 13:33:35 2005 +0000

From Mike Weiblen, adding prelimimnary GL Shader Language support
into core OSG lib.
with renaming and reordering by Robert Osfield,

13 years later it's easy to spot better ways of doing it, but kinda
cool this stuff was once pushing things forward - this work was even
used a demo at the OpenGL BOF that GLSL/2,0 was launched :-)

Robert.


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


Joined: 06 Feb 2013
Posts: 94

PostPosted: Thu Jun 28, 2018 1:35 pm    Post subject:
Constructor parameters of osg::Uniform
Reply with quote

It would be the easiest putting an "explicit " in front of the constructor but I guess there would be far to many reclaims then Smile

- Werner -

Am 28.06.2018 um 15:03 schrieb Robert Osfield:

Quote:
Quote:
On Thu, 28 Jun 2018 at 13:57, Robert Osfield <> (
Only registered users can see emails on this board!
Get registred or enter the forums!
) wrote:
Quote:
The original osg::Uniform class is a bit of unwieldy mess. In
hindsight we shouldn't have gone for this particular implementation as
it's a bit too open ended.

As a bit of background, Mike Weiblen with a bit of input from myself
created the GLSL support for the OSG before OpenGL 2.0 came out and on
prototype drivers. It was completely bleeding edge of OpenGL as well
as trying to implement this stuff in scene graphs, there was no prior
art, it was very much winging it. The fact that is has lasted so long
without a major rewrite suggests Mike came up with reasonable
solution.

The first git log entry for osg::Uniform is :

Date: Thu Feb 24 13:33:35 2005 +0000

From Mike Weiblen, adding prelimimnary GL Shader Language support
into core OSG lib.
with renaming and reordering by Robert Osfield,

13 years later it's easy to spot better ways of doing it, but kinda
cool this stuff was once pushing things forward - this work was even
used a demo at the OpenGL BOF that GLSL/2,0 was launched :-)

Robert.

--
TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
eMail: (
Only registered users can see emails on this board!
Get registred or enter the forums!
)

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


Joined: 06 Feb 2013
Posts: 94

PostPosted: Thu Jun 28, 2018 1:36 pm    Post subject:
Constructor parameters of osg::Uniform
Reply with quote

Am 28.06.2018 um 15:03 schrieb Robert Osfield:

Quote:
Quote:
On Thu, 28 Jun 2018 at 13:57, Robert Osfield <> (
Only registered users can see emails on this board!
Get registred or enter the forums!
) wrote:
Quote:
The original osg::Uniform class is a bit of unwieldy mess. In
hindsight we shouldn't have gone for this particular implementation as
it's a bit too open ended.

As a bit of background, Mike Weiblen with a bit of input from myself
created the GLSL support for the OSG before OpenGL 2.0 came out and on
prototype drivers. It was completely bleeding edge of OpenGL as well
as trying to implement this stuff in scene graphs, there was no prior
art, it was very much winging it. The fact that is has lasted so long
without a major rewrite suggests Mike came up with reasonable
solution.

The first git log entry for osg::Uniform is :

Date: Thu Feb 24 13:33:35 2005 +0000

From Mike Weiblen, adding prelimimnary GL Shader Language support
into core OSG lib.
with renaming and reordering by Robert Osfield,

13 years later it's easy to spot better ways of doing it, but kinda
cool this stuff was once pushing things forward - this work was even
used a demo at the OpenGL BOF that GLSL/2,0 was launched :-)

Robert.

--
TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
eMail: (
Only registered users can see emails on this board!
Get registred or enter the forums!
)

------------------
Post generated by Mail2Forum
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 osg::Vec3Array as uniform to Shader romulogcerqueira General 3 Sat Mar 03, 2018 8:41 pm View latest post
No new posts Transform matrix as Uniform to shaders freqfly General 3 Thu Oct 05, 2017 4:19 am View latest post
No new posts How to access the view parameters fro... Miguel General 1 Fri Sep 22, 2017 5:31 pm View latest post
No new posts Avoid call of SetupThreads in Databas... remoe Submission 3 Sun Apr 30, 2017 2:05 pm View latest post
No new posts Near-uniform tessellation of a concav... Kanpachi General 3 Wed Apr 19, 2017 12:13 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