So I would like to draw a 2D point in OpenGL, but not in immediate mode. It’s been a while since I’ve programmed in OpenGL so I’m a bit rusty, and I can’t find it in the Redbook.
All help is appreciated.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If by “not in immediate mode” you mean uploading your geometry to the graphics card and making calls to render it then there are a couple of ways to do this. The simplest is to use a display list to precompile a list of OpenGL commands to execute
Then render it with
A potentially more flexible and faster way is with the vertex buffer objects extension (to get access to extensions easily look up the GLEW library). You can preload your geometry into a VBO, then render it through calls to OpenGL:
then draw with something like
You may also want to look up using index buffers to upload the indices as well (or alternative drawing routines). I’m afraid it’s a little late for my brain to recall all the different ways of using vertex and index buffers.
I’d add if you’re just drawing one point then most of this is unnecessary (you need to be drawing 10s or 100s of thousands of points for it to be slow) and will only serve to make the code harder to read, understand and maintain.