Results 1 to 4 of 4

Thread: Optimizing graph drawing

  1. #1
    Member Newbie
    Join Date
    Sep 2008
    Location
    Brazil
    Posts
    40

    Optimizing graph drawing

    Hi,

    I am developing an application which draws an internal graph structure onscreen and offers some edit capatibilities. The current version uses GLUT. This screenshot should make it more clear:
    http://img84.imageshack.us/img84/2886/project1ga7.png

    In this run, I put a print on my drawing function to print the i'th time it is drawn. By this i can see it keeps drawing it everytime! Even if i dont move/press anything it will redraw it. It runs fast now, but i realize that my drawing function is somewhat 'expensive'. It runs trought a list-based graph with lots of recursive calls and evaluations. The graph is read from a binary file and allocated in. The problem is that the user should be able to edit that at any time. This makes it not static.

    Also, i'm not sure i skipped some part but does OpenGL automatically redraw the scene as fast as it can? Or maybe it's just some flaw of my program.

    I wonder if there is a way to optimize this. I guess display lists won't do as they are static. Maybe vertex arrays, but if so, i don't see how i would be using them. I would like to know if there are any options to optimize that.

    Thanks in advance,

    enunes

  2. #2
    Junior Member Newbie
    Join Date
    Sep 2008
    Location
    Slovenija
    Posts
    15

    Re: Optimizing graph drawing

    You can use display lists. In your main loop just render the display list, if the user modifies something, rebuild it.

  3. #3
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: Optimizing graph drawing

    remove glutPostRedisplay() from your drawing routine and idle function and call it in the functions that are likely to modify your scene.

  4. #4
    Member Newbie
    Join Date
    Sep 2008
    Location
    Brazil
    Posts
    40

    Re: Optimizing graph drawing

    Quote Originally Posted by Simon Mihevc
    You can use display lists. In your main loop just render the display list, if the user modifies something, rebuild it.
    Hadnt't really thought of it. Seems like it will be a good improvement.

    I will do that by now.

    Thanks,

    enunes.

Similar Threads

  1. Request for Advice - Optimizing My Drawing Calls...
    By tmason in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 06-12-2014, 01:47 AM
  2. Optimizing the drawing loop, OpenGL ES 2.0 2D
    By Sawtan in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-17-2012, 01:37 PM
  3. Question about graph drawing
    By notme_GL in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 12-10-2007, 01:55 PM
  4. optimizing drawing of model
    By GameMaker in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 11-29-2002, 09:32 PM
  5. Optimizing for FPS
    By Tilgovi in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 04-09-2001, 10:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean