Generating random dot stereogram with PTB and OpenGL

I am currently in the phase of constructing an 3D polyhedron object using random dot stereogram using PTB and OpenGL, and encountered some problems that I hope someone in the forum could help me to answer. 


To construct the polyhedron, I used OpenGL's commands GL.QUADS and other 2D surfaces. Once the actual object is constructed, I just need to use random dots to display it. I looked at various demos from PTB, including the FDF, and DrawDots3D demos. With the moglFDF function, I tried to pass the constructed object as a list (consisted of over 20 surfaces) to the function, but the function cannot display the polyhedron as it would for the rotating sphere in the demo. With PTB's build-in DrawDots function, I simply don't know how to make the configuration of the dots to reflect the underlying geometry that I constructed using OpenGL. 


Anyone who had similar experience and can provide any form of suggestions would be greatly appreciated!

If you just want dots at the nodes of your shape you could easily achieve this via vertex buffer objects. However, to do this you would need to be using Matlab 2015a or earlier as Psychtoolbox no longer supports many OpenGL functions on versions of Matlab after that. For example, glGenBuffers and other calls will fail, making this route impossible. 

PTB has moglDrawDots3D. I can't remember if internally this uses the above calls and aborts in Matlab versions above 2015a or not. But this would also work. 

Else, glBegin(GL.POINTS) et al. are still functional on in PTB on all versions of Matlab. However, for drawing many primitives these are far less efficient. 

If you want dots across the surfaces of your objects, not just the nodes, then you would need to know the geometry of your object. I am not aware of any functions which will randomly put dots across a surface unless you have specified the coordinates yourself. 

Again, VBO's would be an efficient route for doing this if you are drawing lots of dots. 


Would glPolygonMode(GL_POINT) do the trick? Did not read the whole mail i must admit

On Wed, Sep 14, 2016 at 10:20 AM, peterscarfe@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com> wrote:


If you just want dots at the nodes of your shape you could easily achieve this via vertex buffer objects. However, to do this you would need to be using Matlab 2015a or earlier as Psychtoolbox no longer supports many OpenGL functions on versions of Matlab after that. For example, glGenBuffers and other calls will fail, making this route impossible.

PTB has moglDrawDots3D. I can't remember if internally this uses the above calls and aborts in Matlab versions above 2015a or not. But this would also work.

Else, glBegin(GL.POINTS) et al. are still functional on in PTB on all versions of Matlab. However, for drawing many primitives these are far less efficient.

If you want dots across the surfaces of your objects, not just the nodes, then you would need to know the geometry of your object. I am not aware of any functions which will randomly put dots across a surface unless you have specified the coordinates yourself.

Again, VBO's would be an efficient route for doing this if you are drawing lots of dots.

P