Results 1 to 3 of 3

Thread: Implementation to achieve fastest brush drawing performace

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2010
    Posts
    16

    Implementation to achieve fastest brush drawing performace

    Hi,
    I am drawing into a 3D texture with a brush and I am looking for the most efficient way to implement this so that there is minimal lag. My 3D texture can be 512^3 and the brush typically 1-30 pixels squared.
    The brush can be any shape, so I do need to perform and OR operation upon pasting the brush into the target texture.

    Currently I use glGetTeximage to retrieve what is already in the texture and then I OR that with the Brush (CPU side), finally I send back the result withglTexSubimage3D.
    Is this the quickest way?
    I'm not seeing unreasonable performance (if the user moves the cursor quickly, the stroke will be discontinuous, but I guess this is due to the frequency of the mouse-motion call-backs) but I'd like know if there is a quicker way to do it!

    Thanks,
    Soren

  2. #2
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,671
    Here's a quicker way: stop reading from OpenGL.

    You gave OpenGL that pixel data. You therefore know exactly what it is. So... why are you reading it back if you already have it? And if you threw it away, why would you throw something away when you know that you're going to have to get it back almost immediately?

    Just keep around a copy of the pixel data and modify that. Then send it to OpenGL to use.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2010
    Posts
    16
    Thanks! Makes sense. I think I had some irrational fear the CPU and GPU representation would come out of sync since I only transmit small subsections to the GPU on every draw, but this should not really be a concern so I will go with what you suggest.
    Soren

Similar Threads

  1. Replies: 4
    Last Post: 02-02-2013, 03:44 PM
  2. Fastest way of moving and drawing VBOs
    By Inagawa in forum OpenGL: Basic Coding
    Replies: 18
    Last Post: 09-02-2012, 07:17 AM
  3. drawing GL_POINTS with mouse. Spacings? [brush stroke]
    By hockeyman in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-12-2012, 07:20 AM
  4. How to separate pen and brush colors
    By Javac in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-20-2003, 05:15 AM
  5. Drawing a brush which represented by planes
    By Quaternion in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 04-08-2001, 09:15 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