real-time 2 graphics

I’m trying to display graphics based on data that changes in real time.
I think I’ve done everything correctly (according to the documentation),
but I can’t get the graphics to update faster than 15 hz. I get 15 hz
when I run open loop, and only 6 hz when I pass messages to do the
drawing every frame (which I will need to do). I’m running this on a
500 Mhz pentium 3. I need to get this up to at least 30 hz. All I’m
drawing is about 20 lines and 20 text fields.

All I can think is that I’m going about things wrong. I’m drawing
everything to a memory context, using PgDrawLine and similar functions,
then flushing it to an image stored in shared memory. I display the
image using a label widget and and setting the Pt_ARG_LABEL_DATA
resource to the image every frame. I’ve experimented with
PgDrawPhImagemx for displaying the image, but I haven’t gotten that to
work. Would that be faster? Any suggestions or alternative approaches
would be appreciated.

Chris VanWyk

You may want to scrutinize the image formats you are using,
vs. the driver mode. The format/mode combination that you
use might need more or less conversion.

For example, if you use a 24 bit direct draw mode with 24
bit images, the driver might be able to copy the memory
directly from the image data to the hardware.

On the other hand, if you are using a 256 color driver
mode with the same image, each pixel would have to be
interpolated into the current palette.


Previously, Chris VanWyk wrote in qdn.public.qnx4.photon:

I’m trying to display graphics based on data that changes in real time.
I think I’ve done everything correctly (according to the documentation),
but I can’t get the graphics to update faster than 15 hz. I get 15 hz
when I run open loop, and only 6 hz when I pass messages to do the
drawing every frame (which I will need to do). I’m running this on a
500 Mhz pentium 3. I need to get this up to at least 30 hz. All I’m
drawing is about 20 lines and 20 text fields.

All I can think is that I’m going about things wrong. I’m drawing
everything to a memory context, using PgDrawLine and similar functions,
then flushing it to an image stored in shared memory. I display the
image using a label widget and and setting the Pt_ARG_LABEL_DATA
resource to the image every frame. I’ve experimented with
PgDrawPhImagemx for displaying the image, but I haven’t gotten that to
work. Would that be faster? Any suggestions or alternative approaches
would be appreciated.

Chris VanWyk


Mitchell Schoenbrun --------- maschoen@pobox.com

Hi Chris,

What type of memory context are you using? Is it also shared memory?
Also what are you using to draw the images? are you using PgDrawImagemx
or PgDrawImage? have you tried them yet?

Erick.

Chris VanWyk <chris@faac.com> wrote:

I’m trying to display graphics based on data that changes in real time.
I think I’ve done everything correctly (according to the documentation),
but I can’t get the graphics to update faster than 15 hz. I get 15 hz
when I run open loop, and only 6 hz when I pass messages to do the
drawing every frame (which I will need to do). I’m running this on a
500 Mhz pentium 3. I need to get this up to at least 30 hz. All I’m
drawing is about 20 lines and 20 text fields.

All I can think is that I’m going about things wrong. I’m drawing
everything to a memory context, using PgDrawLine and similar functions,
then flushing it to an image stored in shared memory. I display the
image using a label widget and and setting the Pt_ARG_LABEL_DATA
resource to the image every frame. I’ve experimented with
PgDrawPhImagemx for displaying the image, but I haven’t gotten that to
work. Would that be faster? Any suggestions or alternative approaches
would be appreciated.

Chris VanWyk

I’m using PmMemCreateMC to create a memory context. Can I use shared memory
for this? Would that be faster? How would I draw to it?

I’m using PgDraw… functions to draw the images.

I’m displaying the image using a label widget and and setting the
Pt_ARG_LABEL_DATA. I’ve tried PgDrawPhImagemx, but not PgDrawImagemx because
the documentation recommended not to.

I was able to double my refresh rate by using an appropriate video driver (I
was using a generic video driver), but I’m still not quite up to where I
would like to be. Any suggestions would be greatly appreciated.

thanks,
Chris



Erick Muis wrote:

Hi Chris,

What type of memory context are you using? Is it also shared memory?
Also what are you using to draw the images? are you using PgDrawImagemx
or PgDrawImage? have you tried them yet?

Erick.

Chris VanWyk <> chris@faac.com> > wrote:
I’m trying to display graphics based on data that changes in real time.
I think I’ve done everything correctly (according to the documentation),
but I can’t get the graphics to update faster than 15 hz. I get 15 hz
when I run open loop, and only 6 hz when I pass messages to do the
drawing every frame (which I will need to do). I’m running this on a
500 Mhz pentium 3. I need to get this up to at least 30 hz. All I’m
drawing is about 20 lines and 20 text fields.

All I can think is that I’m going about things wrong. I’m drawing
everything to a memory context, using PgDrawLine and similar functions,
then flushing it to an image stored in shared memory. I display the
image using a label widget and and setting the Pt_ARG_LABEL_DATA
resource to the image every frame. I’ve experimented with
PgDrawPhImagemx for displaying the image, but I haven’t gotten that to
work. Would that be faster? Any suggestions or alternative approaches
would be appreciated.

Chris VanWyk

create some shared memory with PgShmemCreate, wrap a PhImage_t around it, and
pass that PhImage_t to PmMemCreateMC(), it will use it instead of creating one
of it’s own.

There is extra overhead with a PtLabel and PgDrawPhImagemx that you may
not want so PgDrawImagemx may be the better function for you.

Dave Rempel

Chris VanWyk <chris@faac.com> wrote:

I’m using PmMemCreateMC to create a memory context. Can I use shared memory
for this? Would that be faster? How would I draw to it?

I’m using PgDraw… functions to draw the images.

I’m displaying the image using a label widget and and setting the
Pt_ARG_LABEL_DATA. I’ve tried PgDrawPhImagemx, but not PgDrawImagemx because
the documentation recommended not to.

I was able to double my refresh rate by using an appropriate video driver (I
was using a generic video driver), but I’m still not quite up to where I
would like to be. Any suggestions would be greatly appreciated.

thanks,
Chris



Erick Muis wrote:

Hi Chris,

What type of memory context are you using? Is it also shared memory?
Also what are you using to draw the images? are you using PgDrawImagemx
or PgDrawImage? have you tried them yet?

Erick.

Chris VanWyk <> chris@faac.com> > wrote:
I’m trying to display graphics based on data that changes in real time.
I think I’ve done everything correctly (according to the documentation),
but I can’t get the graphics to update faster than 15 hz. I get 15 hz
when I run open loop, and only 6 hz when I pass messages to do the
drawing every frame (which I will need to do). I’m running this on a
500 Mhz pentium 3. I need to get this up to at least 30 hz. All I’m
drawing is about 20 lines and 20 text fields.

All I can think is that I’m going about things wrong. I’m drawing
everything to a memory context, using PgDrawLine and similar functions,
then flushing it to an image stored in shared memory. I display the
image using a label widget and and setting the Pt_ARG_LABEL_DATA
resource to the image every frame. I’ve experimented with
PgDrawPhImagemx for displaying the image, but I haven’t gotten that to
work. Would that be faster? Any suggestions or alternative approaches
would be appreciated.

Chris VanWyk

David Rempel wrote:

create some shared memory with PgShmemCreate, wrap a PhImage_t around it, and
pass that PhImage_t to PmMemCreateMC(), it will use it instead of creating one
of it’s own.

I have been doing that. I just didn’t realize exactly what was going on. Thanks
for the info.


There is extra overhead with a PtLabel and PgDrawPhImagemx that you may
not want so PgDrawImagemx may be the better function for you.

Dave Rempel

Ok, I tried using PgDrawImagemx. I create a widget (the old one that holds the
PtLabel), and then I draw the image to position (0,0), and the image draws just
fine (on the widget). Then when I try to draw the image again, nothing happens.
I have several widgets with images, and they all draw correctly one time
(immediately after creating the wigdet). The position you pass to PgDrawImagemx
would seem to be relative to last widget created. Is there anyway to control it?
Better yet, can I just draw the image to the screen at an absolute position
without creating widgets?

Chris VanWyk