Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 564215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:44:36+00:00 2026-05-13T12:44:36+00:00

So I would like to draw a 2D point in OpenGL, but not in

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:44:36+00:00Added an answer on May 13, 2026 at 12:44 pm

    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

    Gluint list = glGenLists(1);
    // Release with glDeleteLists(list,1);
    glNewList(list,GL_COMPILE);
    
    // Drawing code here
    
    glEndList();
    

    Then render it with

    glCallList(list);
    

    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:

    float data[2] = {...};
    
    GLuint buffer;
    glGenBuffersARB(1,&buffer);
    // Release with glDeleteBuffersARB(1,&buffer);
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer);
    glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(data), data, GL_STATIC_DRAW_ARB);
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
    

    then draw with something like

    GLuint indices[] = {0};
    
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer);
    glVertexPointer(3, GL_FLOAT, sizeof(float)*2, ((GLubyte*)NULL)+0);
    glEnableClientState(GL_VERTEX_ARRAY);
    glDrawElements(GL_POINTS,sizeof(indices)/(sizeof(indices[0])),GL_UNSIGNED_INT,indices);
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);    
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to draw a chart in OpenGL similar to the donut graph
how to draw point and line between 2 points in opencv??? Would like by
I started playing around with OpenGL and GLUT. I would like to draw some
We have an array of points through which we would like to draw a
I would like to draw text on a canvas using the Canvas.drawText call for
I would like to draw some shapes on a JPanel by overriding paintComponent .
I would like to draw a line or bar graph using HTML5 canvas. I
I would like to draw a box using SAS/GRAPH with a color gradient (say
in vb.net i would like to draw a regular line on a form. is
In C# i have a picturebox. i would like to draw 4 colors. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.