Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


OpenGL 4.x and Point Sprites


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Ender1618   Members   -  Reputation: 243

Like
0Likes
Like

Posted 02 July 2013 - 08:46 AM

So I am working on a specialized point cloud viewer, using OpenGL 4.3. My code is completely fixed-function pipeline free, using shaders for everything of course. 

 

I am currently rendering 10+ million points using GL_POINTS without a problem, but I would like to utilize point sprites, so i can add proper world size (get bigger and when you get closer) to my points in a specific mode (I am not expecting that i can still render 10+ million points with point sprites, so I will sub-sample).

 

I am looking at point sprite rather that geometry shader generated quads, due to some articles claiming better performance on my target platform for point sprites, especially for the amount of points I want to render.

 

I am having difficulty finding a complete example on how to use OpenGL point sprites in combination with GLSL (im using version GLSL 4), to control coloring and point size. All I am finding are incomplete snippets.  It may be to lack searching right.

 

Does anyone know of a good tutorial/example for this (Point Sprites with GLSL (version 4 and up would be nice))?



Sponsor:

#2 marcClintDion   Members   -  Reputation: 431

Like
2Likes
Like

Posted 02 July 2013 - 11:05 PM

I think if something is cleared up for you then your task here will become substantially less difficult and you will then be able to find what it is you are looking for without the stress of being concerned with this issue you are concerned with, namely backwards compatibility.  Newer versions are expansions of previous versions, they are not so much replacements.  (There is a quote following that will back this statement up.)  The exception to this has been the mobile devices which have specs for Embedded Systems, OpenGL ES 2.0 has created a division between the two.  Desktop GPU manufacturers have not done this and likely will not do this. 

 

Your concern is that open source examples are using "out-dated OpenGL" and that you cannot use them for OpenGL 4.0.  The vast majority of the features in these old example are still a part of the newer spec.  You are very unlikely to find any OpenGL 4.0 point sprite examples because the manufactures have already released examples on how to use these features. Nothing has changed, the old examples are still valid.  OpenGL has been almost fully backwards compatible for 15 years now and that has not changed very much. This has always been one of the OpenGL API's design goals.

 

The idea that a feature becomes slow and obsolete because it has been around for a long time is a false notion.  Many "older" features are updated silently behind the scenes through driver optimizations and new circuit designs that increase efficiency.

 

The following is a passage written by long time nVidia software designer Mark J. Kilgard.  He has written more on the subject of OpenGL than just about anybody on the scene and does so on behalf of one of the biggest names in gaming hardware.  What he's says here does not just apply to immediate mode rendering.

 

//====================================================================================================================

 

... the notion that an OpenGL application is "wrong" to ever use immediate mode is overzealous.  The OpenGL 3.0 specification has even gone so far as to mark immediate mode in OpenGL for "deprecation" (whatever that means!); such extremism is counter-productive and foolish.  The right way to encourage good API usage isn't to try to deprecate or ban API usage, but rather educate developers about the right API usage for particular situations. http://www.slideshare.net/Mark_Kilgard/using-vertex-bufferobjectswell


Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, because you know that the testing of your faith produces perseverance. Let perseverance finish its work so that you may be mature and complete, not lacking anything.


#3 mhagain   Crossbones+   -  Reputation: 8284

Like
2Likes
Like

Posted 03 July 2013 - 02:08 AM

You just need to output gl_PointSize from your vertex shader; this is available in all GL_VERSIONs up to and including 4.3, is not deprecated functionality, and can be safely assumed to remain available in core contexts.  Of course, it also means that you need to write your own attenuation formula rather than rely on the built-in fixed function one, but that's easy enough; an example is here: http://www.processing.org/discourse/beta/num_1268967702.html.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#4 marcClintDion   Members   -  Reputation: 431

Like
0Likes
Like

Posted 03 July 2013 - 03:47 AM

With anything, I'd strongly suggest that any time you add any sort of new functionality, that you test it as soon as possible on every machine that you can get your hands on.  Some times drivers from different manufacturers will behave a bit differently or something that should work doesn't when you try it on another machine. With OpenGL there are often many subtle ways that you can change things so that it works consistently across the board.  It's better to find out sooner rather than later, you don't want to expand upon something if it requires a change for compatibility reasons.  There's no sense in isolating a huge chunk of your audience for no good reason.  Also, it's embarrassing when you try to show someone what you've built and something inexplicably doesn't work because you have not bug-tested tested on that person's type of GPU.


Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, because you know that the testing of your faith produces perseverance. Let perseverance finish its work so that you may be mature and complete, not lacking anything.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS