Is there a shaderless way to draw multiple points with different sizes using glDrawArrays()?












0














I'm drawing a point cloud with different colors of points with this:



    glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);


glVertexPointer(3, GL_FLOAT, 0, vertices.get());
glColorPointer(3, GL_FLOAT, 0, colors.get());


glDrawArrays(GL_POINTS, 0, n);


glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);


is there a way to tell glDrawArrays (or the default shader) to use another client state for size of each point?










share|improve this question






















  • There is no default shader. And the fixed function pipeline (deprecated for several years) does not support individual point sizes. You should not use it anyway unless you have a good reason to do so.
    – Nico Schertler
    Nov 21 '18 at 11:26










  • I searched for a hello-world of VBO for point clouds but couldn't find any info. Then saw this and worked but without size unfortunately. Do you mean deprecated fixed function pipeline is used when glDrawArrays or glEnableClientState is used? Before this, I was using immediate mode with smooth point size and correct auto z-ordering. But immediate mode is way too slow for a million points.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 11:28












  • As soon as you don't have a shader bound, OpenGL will try to use the fixed function pipeline if it is still available. This does not work if you have a core profile context. So, in short: Always use a shader.
    – Nico Schertler
    Nov 21 '18 at 11:30










  • What kind of question should I ask for a minimal shader example for glDrawArrays with GL_POINTS? What should I use? Vertex shader or fragment shader or something else?
    – huseyin tugrul buyukisik
    Nov 21 '18 at 11:33










  • You will need both shaders. I would suggest to take a look at an arbitrary tutorial for model rendering (with modern OpenGL). If you know how to do this, then switching to pointclouds is simply a matter of replacing GL_TRIANGLES with GL_POINTS. More or less...
    – Nico Schertler
    Nov 21 '18 at 11:36
















0














I'm drawing a point cloud with different colors of points with this:



    glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);


glVertexPointer(3, GL_FLOAT, 0, vertices.get());
glColorPointer(3, GL_FLOAT, 0, colors.get());


glDrawArrays(GL_POINTS, 0, n);


glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);


is there a way to tell glDrawArrays (or the default shader) to use another client state for size of each point?










share|improve this question






















  • There is no default shader. And the fixed function pipeline (deprecated for several years) does not support individual point sizes. You should not use it anyway unless you have a good reason to do so.
    – Nico Schertler
    Nov 21 '18 at 11:26










  • I searched for a hello-world of VBO for point clouds but couldn't find any info. Then saw this and worked but without size unfortunately. Do you mean deprecated fixed function pipeline is used when glDrawArrays or glEnableClientState is used? Before this, I was using immediate mode with smooth point size and correct auto z-ordering. But immediate mode is way too slow for a million points.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 11:28












  • As soon as you don't have a shader bound, OpenGL will try to use the fixed function pipeline if it is still available. This does not work if you have a core profile context. So, in short: Always use a shader.
    – Nico Schertler
    Nov 21 '18 at 11:30










  • What kind of question should I ask for a minimal shader example for glDrawArrays with GL_POINTS? What should I use? Vertex shader or fragment shader or something else?
    – huseyin tugrul buyukisik
    Nov 21 '18 at 11:33










  • You will need both shaders. I would suggest to take a look at an arbitrary tutorial for model rendering (with modern OpenGL). If you know how to do this, then switching to pointclouds is simply a matter of replacing GL_TRIANGLES with GL_POINTS. More or less...
    – Nico Schertler
    Nov 21 '18 at 11:36














0












0








0







I'm drawing a point cloud with different colors of points with this:



    glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);


glVertexPointer(3, GL_FLOAT, 0, vertices.get());
glColorPointer(3, GL_FLOAT, 0, colors.get());


glDrawArrays(GL_POINTS, 0, n);


glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);


is there a way to tell glDrawArrays (or the default shader) to use another client state for size of each point?










share|improve this question













I'm drawing a point cloud with different colors of points with this:



    glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);


glVertexPointer(3, GL_FLOAT, 0, vertices.get());
glColorPointer(3, GL_FLOAT, 0, colors.get());


glDrawArrays(GL_POINTS, 0, n);


glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);


is there a way to tell glDrawArrays (or the default shader) to use another client state for size of each point?







opengl






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 '18 at 11:23









huseyin tugrul buyukisik

6,88133063




6,88133063












  • There is no default shader. And the fixed function pipeline (deprecated for several years) does not support individual point sizes. You should not use it anyway unless you have a good reason to do so.
    – Nico Schertler
    Nov 21 '18 at 11:26










  • I searched for a hello-world of VBO for point clouds but couldn't find any info. Then saw this and worked but without size unfortunately. Do you mean deprecated fixed function pipeline is used when glDrawArrays or glEnableClientState is used? Before this, I was using immediate mode with smooth point size and correct auto z-ordering. But immediate mode is way too slow for a million points.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 11:28












  • As soon as you don't have a shader bound, OpenGL will try to use the fixed function pipeline if it is still available. This does not work if you have a core profile context. So, in short: Always use a shader.
    – Nico Schertler
    Nov 21 '18 at 11:30










  • What kind of question should I ask for a minimal shader example for glDrawArrays with GL_POINTS? What should I use? Vertex shader or fragment shader or something else?
    – huseyin tugrul buyukisik
    Nov 21 '18 at 11:33










  • You will need both shaders. I would suggest to take a look at an arbitrary tutorial for model rendering (with modern OpenGL). If you know how to do this, then switching to pointclouds is simply a matter of replacing GL_TRIANGLES with GL_POINTS. More or less...
    – Nico Schertler
    Nov 21 '18 at 11:36


















  • There is no default shader. And the fixed function pipeline (deprecated for several years) does not support individual point sizes. You should not use it anyway unless you have a good reason to do so.
    – Nico Schertler
    Nov 21 '18 at 11:26










  • I searched for a hello-world of VBO for point clouds but couldn't find any info. Then saw this and worked but without size unfortunately. Do you mean deprecated fixed function pipeline is used when glDrawArrays or glEnableClientState is used? Before this, I was using immediate mode with smooth point size and correct auto z-ordering. But immediate mode is way too slow for a million points.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 11:28












  • As soon as you don't have a shader bound, OpenGL will try to use the fixed function pipeline if it is still available. This does not work if you have a core profile context. So, in short: Always use a shader.
    – Nico Schertler
    Nov 21 '18 at 11:30










  • What kind of question should I ask for a minimal shader example for glDrawArrays with GL_POINTS? What should I use? Vertex shader or fragment shader or something else?
    – huseyin tugrul buyukisik
    Nov 21 '18 at 11:33










  • You will need both shaders. I would suggest to take a look at an arbitrary tutorial for model rendering (with modern OpenGL). If you know how to do this, then switching to pointclouds is simply a matter of replacing GL_TRIANGLES with GL_POINTS. More or less...
    – Nico Schertler
    Nov 21 '18 at 11:36
















There is no default shader. And the fixed function pipeline (deprecated for several years) does not support individual point sizes. You should not use it anyway unless you have a good reason to do so.
– Nico Schertler
Nov 21 '18 at 11:26




There is no default shader. And the fixed function pipeline (deprecated for several years) does not support individual point sizes. You should not use it anyway unless you have a good reason to do so.
– Nico Schertler
Nov 21 '18 at 11:26












I searched for a hello-world of VBO for point clouds but couldn't find any info. Then saw this and worked but without size unfortunately. Do you mean deprecated fixed function pipeline is used when glDrawArrays or glEnableClientState is used? Before this, I was using immediate mode with smooth point size and correct auto z-ordering. But immediate mode is way too slow for a million points.
– huseyin tugrul buyukisik
Nov 21 '18 at 11:28






I searched for a hello-world of VBO for point clouds but couldn't find any info. Then saw this and worked but without size unfortunately. Do you mean deprecated fixed function pipeline is used when glDrawArrays or glEnableClientState is used? Before this, I was using immediate mode with smooth point size and correct auto z-ordering. But immediate mode is way too slow for a million points.
– huseyin tugrul buyukisik
Nov 21 '18 at 11:28














As soon as you don't have a shader bound, OpenGL will try to use the fixed function pipeline if it is still available. This does not work if you have a core profile context. So, in short: Always use a shader.
– Nico Schertler
Nov 21 '18 at 11:30




As soon as you don't have a shader bound, OpenGL will try to use the fixed function pipeline if it is still available. This does not work if you have a core profile context. So, in short: Always use a shader.
– Nico Schertler
Nov 21 '18 at 11:30












What kind of question should I ask for a minimal shader example for glDrawArrays with GL_POINTS? What should I use? Vertex shader or fragment shader or something else?
– huseyin tugrul buyukisik
Nov 21 '18 at 11:33




What kind of question should I ask for a minimal shader example for glDrawArrays with GL_POINTS? What should I use? Vertex shader or fragment shader or something else?
– huseyin tugrul buyukisik
Nov 21 '18 at 11:33












You will need both shaders. I would suggest to take a look at an arbitrary tutorial for model rendering (with modern OpenGL). If you know how to do this, then switching to pointclouds is simply a matter of replacing GL_TRIANGLES with GL_POINTS. More or less...
– Nico Schertler
Nov 21 '18 at 11:36




You will need both shaders. I would suggest to take a look at an arbitrary tutorial for model rendering (with modern OpenGL). If you know how to do this, then switching to pointclouds is simply a matter of replacing GL_TRIANGLES with GL_POINTS. More or less...
– Nico Schertler
Nov 21 '18 at 11:36












1 Answer
1






active

oldest

votes


















1














If there was, that would be terribly inefficient!




  1. Use the programmable pipeline, in a core context => OpenGL 3.3 and above.

  2. Create a buffer with all your vertices (your points).

  3. Create a buffer with the sizes of each point.

  4. Pass buffers 2 and 3 to your vertex shader. Assign the size to the global gl_PointSize.


If you don't get what I am suggesting, you must then begin by learning the modern OpenGL way of rendering :)






share|improve this answer





















  • Thank you. I managed to get past size-less version of shaders now doing this size array extension. Doesn't accept, maybe I'm on GL 3.0-.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 13:44












  • Ok, now it works with glEnable( GL_PROGRAM_POINT_SIZE );, thank you. So many states to manage! :] Also added #version 330 at first line, just in case it compiles for different version.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 13:51













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411057%2fis-there-a-shaderless-way-to-draw-multiple-points-with-different-sizes-using-gld%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














If there was, that would be terribly inefficient!




  1. Use the programmable pipeline, in a core context => OpenGL 3.3 and above.

  2. Create a buffer with all your vertices (your points).

  3. Create a buffer with the sizes of each point.

  4. Pass buffers 2 and 3 to your vertex shader. Assign the size to the global gl_PointSize.


If you don't get what I am suggesting, you must then begin by learning the modern OpenGL way of rendering :)






share|improve this answer





















  • Thank you. I managed to get past size-less version of shaders now doing this size array extension. Doesn't accept, maybe I'm on GL 3.0-.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 13:44












  • Ok, now it works with glEnable( GL_PROGRAM_POINT_SIZE );, thank you. So many states to manage! :] Also added #version 330 at first line, just in case it compiles for different version.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 13:51


















1














If there was, that would be terribly inefficient!




  1. Use the programmable pipeline, in a core context => OpenGL 3.3 and above.

  2. Create a buffer with all your vertices (your points).

  3. Create a buffer with the sizes of each point.

  4. Pass buffers 2 and 3 to your vertex shader. Assign the size to the global gl_PointSize.


If you don't get what I am suggesting, you must then begin by learning the modern OpenGL way of rendering :)






share|improve this answer





















  • Thank you. I managed to get past size-less version of shaders now doing this size array extension. Doesn't accept, maybe I'm on GL 3.0-.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 13:44












  • Ok, now it works with glEnable( GL_PROGRAM_POINT_SIZE );, thank you. So many states to manage! :] Also added #version 330 at first line, just in case it compiles for different version.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 13:51
















1












1








1






If there was, that would be terribly inefficient!




  1. Use the programmable pipeline, in a core context => OpenGL 3.3 and above.

  2. Create a buffer with all your vertices (your points).

  3. Create a buffer with the sizes of each point.

  4. Pass buffers 2 and 3 to your vertex shader. Assign the size to the global gl_PointSize.


If you don't get what I am suggesting, you must then begin by learning the modern OpenGL way of rendering :)






share|improve this answer












If there was, that would be terribly inefficient!




  1. Use the programmable pipeline, in a core context => OpenGL 3.3 and above.

  2. Create a buffer with all your vertices (your points).

  3. Create a buffer with the sizes of each point.

  4. Pass buffers 2 and 3 to your vertex shader. Assign the size to the global gl_PointSize.


If you don't get what I am suggesting, you must then begin by learning the modern OpenGL way of rendering :)







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 '18 at 12:55









Zedka29

792




792












  • Thank you. I managed to get past size-less version of shaders now doing this size array extension. Doesn't accept, maybe I'm on GL 3.0-.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 13:44












  • Ok, now it works with glEnable( GL_PROGRAM_POINT_SIZE );, thank you. So many states to manage! :] Also added #version 330 at first line, just in case it compiles for different version.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 13:51




















  • Thank you. I managed to get past size-less version of shaders now doing this size array extension. Doesn't accept, maybe I'm on GL 3.0-.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 13:44












  • Ok, now it works with glEnable( GL_PROGRAM_POINT_SIZE );, thank you. So many states to manage! :] Also added #version 330 at first line, just in case it compiles for different version.
    – huseyin tugrul buyukisik
    Nov 21 '18 at 13:51


















Thank you. I managed to get past size-less version of shaders now doing this size array extension. Doesn't accept, maybe I'm on GL 3.0-.
– huseyin tugrul buyukisik
Nov 21 '18 at 13:44






Thank you. I managed to get past size-less version of shaders now doing this size array extension. Doesn't accept, maybe I'm on GL 3.0-.
– huseyin tugrul buyukisik
Nov 21 '18 at 13:44














Ok, now it works with glEnable( GL_PROGRAM_POINT_SIZE );, thank you. So many states to manage! :] Also added #version 330 at first line, just in case it compiles for different version.
– huseyin tugrul buyukisik
Nov 21 '18 at 13:51






Ok, now it works with glEnable( GL_PROGRAM_POINT_SIZE );, thank you. So many states to manage! :] Also added #version 330 at first line, just in case it compiles for different version.
– huseyin tugrul buyukisik
Nov 21 '18 at 13:51




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411057%2fis-there-a-shaderless-way-to-draw-multiple-points-with-different-sizes-using-gld%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python