how to draw pixel in directx9?

Started by
10 comments, last by Kern_d 16 years, 4 months ago
hi, i wanna know how to draw or plot pixels in directx9? i'm working on an app in which u can create path and graphs.. if i can draw the nodes using drawpixel routine instead of the drawprimitive routine the app would be faster than it is now.. and also i din't find any default routine for drawpixel in direcx.. help please......... thanks..............
Advertisement
hmm maybe you can create an bitmap in memory where you draw the pixels into and then just display that bitmap on the screen
http://www.vectorstudios.nethttp://engine.vectorstudios.net
thanks..
but i need to draw those nodes pixel by pixel... so that they remain the same size when the world is zoomed in or out..
You could go for pretransformed vertices; these are not affected by any matrices.

If you need exact pixel display you want to look up "Directly mapping texels to pixels".

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

thanks..... :-)
Quote:Original post by abijosh
if i can draw the nodes using drawpixel routine instead of the drawprimitive routine the app would be faster than it is now
I sincerely doubt it. 3D graphics hardware is designed to deal with 3D primitives, not 2D pixels. Manually drawing 2D pixels is pretty hard on the graphics card.
oops..
is there any way to keep the size of the objects to be the same regardless of the world transform? in fact i'm calculating the scale matrix during every render cycle to display the nodes in the same size.. but the calculation is too expensive for every single routine.. so thats y i thought of using draw pixel routine.. can anyone suggest a better way to fix it?
Quote:Original post by abijosh
oops..
is there any way to keep the size of the objects to be the same regardless of the world transform? in fact i'm calculating the scale matrix during every render cycle to display the nodes in the same size.. but the calculation is too expensive for every single routine.. so thats y i thought of using draw pixel routine.. can anyone suggest a better way to fix it?
A perspective projection matrix will make objects further from the camera appear smaller (like real life). You can use an orthogonal projection matrix instead to not scale objects with camera distance (Like CAD applications). See D3DXMatrixOrthoLH().
thanks steve
I was thinking about ortho as well, but if what he wanted to do was say, render what actually looked like a 3D cube at an angle, and have that remain the same size, but still look 3D. Then rendering it using ortho would make it look flat and "weird".

It's hard to really tell since you gave us so little info about what you are actually trying to do.

What it sounds like to me is it is almost a HUD type overlay? So as the 3D scene is zoomed in, this is over it and stays the same size? If thats the case, you can just pop the matrix all the way out, then render it, and it wont be affected by the "zoom-ness" of the matrix.

But thats pretty easy and you dont sound like a noob, so I doubt its that simple. But like I said it's hard to know with how little info you gave us.
==============================
A Developers Blog | Dark Rock Studios - My Site

This topic is closed to new replies.

Advertisement