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

  • SEARCH
  • Home
  • 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 531025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:15:28+00:00 2026-05-13T09:15:28+00:00

My program uses PyOpenGL (so it’s Python) with psyco. I have around 21,000 line

  • 0

My program uses PyOpenGL (so it’s Python) with psyco.

I have around 21,000 line segments which I need to render in each frame of my render (unless the user zooms in, in which case line segments are culled and not sent to the card at all). This is currently taking around 1.5 seconds each frame to complete. That’s just not good enough, so I’m looking at ways to reduce the number of distinct line segments.

I imagine there would be cases where multiple line segments can be merged into one big line, but I honestly do not even know where to begin with this. I do have the start point and end point of each line stored, so that might help things. Note that I am able to take as long as I need to at startup, and memory usage isn’t too much of a concern.

Any ideas would be much appreciated.

  • 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-13T09:15:29+00:00Added an answer on May 13, 2026 at 9:15 am

    It’s almost certainly the overhead of all the immediate mode function calls that’s killing your performance. I would do the following.

    Don’t use GL_LINE_STRIPS, use a single list of GL_LINES instead so they can be rendered in one go.

    Use glDrawArrays instead of immediate mode rendering:

    float* coordinates = {....}; //x and y coordinate pairs for all line segments
    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer(2, GL_FLOAT, 2 * sizeof(float), coordinates);
    glDrawArrays(GL_LINES, 0, 2 * linecount);
    glDisableClientState(GL_VERTEX_ARRAY);
    

    (For even better performance you can store the vertex buffer in something called a vertex buffer object, but this should be fine to begin with)

    One final thing, if you’re do culling on a per line basis it’s probably faster to just skip it and send all the lines to the GPU.

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

Sidebar

Related Questions

I have a Python program uses Qt (PyQt4 in fact) and when I launch
My program uses sqlite3 plus python. It works fine with python 2.6.2 I moved
I have a program that uses pthread library to do the matrix multiplication of
I have a program that uses: ThreadPool.QueueUserWorkItem(new WaitCallback(FireAttackProc), fireResult); On Windows7 and Vista it
My program uses a NetworkOutput object which can be used to write data to
My program uses around 20 jars (for a total size of about 30mb). For
I am developing a large program which uses a lot of memory. The program
My program uses MVC. When the user hits New File, I need to check
The following program uses an inner class named Anonymous which itself extends its enclosing
I have various constants that my program uses... string 's, int 's, double 's,

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.