How do you suggest to implement this.
I want to draw a graph of an array of values in direct3D.
Actually it suppose to be a graph of the FPS, so it will change every frame.
How do you suggest for me to do this?
Should I create a texture, draw into that texture and draw that texture as a sprite into the screen buffer?
Or should I try draw directly into the screen buffer?
Thanks in advance.
Just draw it directly to the screen using lines (or quads). You can keep last N measurements of the FPS in the circular buffer and then draw it using few calls.
This should be faster than render to texture approach. And it will not waste any texture memory and will save you context switch.
I don't know DX, but you should be able to draw it using 2 calls: one for the part of the buffer from oldest measurement in the buffer to the end of the buffer and second call will draw from the beginning of the buffer to the oldest entry. It will look like this:
To update buffer just overwite oldest entry with the new measurement and move "start pointer" one to the right. When you get to the end of the buffer, just wrap it around.
This way buffer update will be very fast (no reallocation).
HTH
This should be faster than render to texture approach. And it will not waste any texture memory and will save you context switch.
I don't know DX, but you should be able to draw it using 2 calls: one for the part of the buffer from oldest measurement in the buffer to the end of the buffer and second call will draw from the beginning of the buffer to the oldest entry. It will look like this:
buffer: ===============|========= (| is the oldest entry)draw: ^ this goes first ^ and this part is second
To update buffer just overwite oldest entry with the new measurement and move "start pointer" one to the right. When you get to the end of the buffer, just wrap it around.
This way buffer update will be very fast (no reallocation).
HTH
No its not a line graph.
I wanted to do for every enrty in the array a vertical line of 1 pixel width.
I wanted to do for every enrty in the array a vertical line of 1 pixel width.
Are you nuts?!!?
You render a series of lines one pixel in width..... using the line primitive.
You render a series of lines one pixel in width..... using the line primitive.
If you want to do a graph whereby the area under the graph is shaded, use a triangle strip. Just alternate between a point on the graph (a sample) and the corresponding point on the axis. Using a triangle strip instead of lines will avoid any issues with gaps between lines and also allows you to scale the graph up/down more easily.
Are you nuts!?!?!
You're trying to tell me that using two triangles to render a one pixel thin line is better than rendering a one pixel thin line with the line primitive?!!?! And how exactly is it easier to scale up and down, it's the same thing in both cases!!
I'm going home..... you guys are all nuts.
You're trying to tell me that using two triangles to render a one pixel thin line is better than rendering a one pixel thin line with the line primitive?!!?! And how exactly is it easier to scale up and down, it's the same thing in both cases!!
I'm going home..... you guys are all nuts.
Quote:Original post by Anonymous Poster
Are you nuts!?!?!
You're trying to tell me that using two triangles to render a one pixel thin line is better than rendering a one pixel thin line with the line primitive?!!?! And how exactly is it easier to scale up and down, it's the same thing in both cases!!
I'm going home..... you guys are all nuts.
Uhh... I'm pretty sure a line primitive is just a very thin triangle under the covers anyways.
Quote:Original post by Anonymous PosterNo.
Are you nuts!?!?!
Quote:You're trying to tell me that using two triangles to render a one pixel thin line is better than rendering a one pixel thin line with the line primitive?!!?! And how exactly is it easier to scale up and down, it's the same thing in both cases!!I should have mentioned that I was referring to horizontal scaling, but yes, I'm saying that using triangles to render a series of vertical lines between which there are supposed to be no gaps is better than generating a load of vertical line primitives. The hardware is optimized for triangles, not lines.
Quote:I'm going home..... you guys are all nuts.Don't let the door hit ya on the way out.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement