pixel plotting
Im reading Andre Lamoths "Tricks of The Windows Gaming Guru" or somthin along those lines. And i decided to test my new found skill
WHOA!!! Im gonna make a pixel float across the screen!!
i am so proud of myself (I hope u picked up the sarcasm)
Well I got every working and the pixels move? But the preformance is really bad, when i try to move the mouse , it dosnt respond automaticly, its really "laggy"
Oh and bye the way this is in direct x?
im pretty sure its not that my computer can handle a few pixels being drawn to the screen, cause earlier in a demo, i created 1000 random pixels in random locations??
This is the command i have to draw the pixels
back_buffer[pixel1x+pixel1y*ddsd.lPitch] = col;
back_buffer[pixel2x+pixel2y*ddsd.lPitch] = col;
back_buffer[pixel3x+pixel3y*ddsd.lPitch] = col;
back_buffer[pixel4x+pixel4y*ddsd.lPitch] = col;
the variables pixel1x and pixel1y are the coordinates and col = the color.
I can post the rest, but it is a lot of code, and will make this post LONG
(thats bad)
Got any idea why the performance is so bad?
thanks
Ryan Lahay
BAHcows go moomoos go cow
Err, maybe it''s because you''re running 1024x768 on a 386? That would make it slow Honestly, there should be no reason why pixel plotting should be slow on any computer. You might want to store the lpitch in a variable instead of dereferencing it all the time
Btw, I just noticed your using the back buffer. Does that mean that you''re flipping after plotting every 4 pixels? That could be your problem.
int lPitch = ddsd.lPitch;back_buffer[pixel1x+pixel1y*lPitch] = col;
Btw, I just noticed your using the back buffer. Does that mean that you''re flipping after plotting every 4 pixels? That could be your problem.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
Yes you are right I am page flipping.. Why is that bad?? Isnt that how your supposed to do it??
And no, im running it on a 500 mhz comp and its in 640x480 mode...and that lpitch thing aint makn it better..
??
help!!
AAAAARRRGGGHHHH
And no, im running it on a 500 mhz comp and its in 640x480 mode...and that lpitch thing aint makn it better..
??
help!!
AAAAARRRGGGHHHH
BAHcows go moomoos go cow
I have a question for you: What is it about your app''s performance that leads you to believe that things are slow?
What I mean is, your pixel is not going to look like its moving very quickly if you are only incrementing x a/o y by 1. Really the best you can measure is the number of flips you''re getting per second.
So long as you are locking the backbuffer , manipulating it and unlocking it once per frame, your pixel plotting code is about as straightforward as it comes.
Teej
BTW: The mouse being sluggish could be a simple reprocussion (sp?) of using the Windows mouse. Having your own (especially in a worker thread) takes care of that.
What I mean is, your pixel is not going to look like its moving very quickly if you are only incrementing x a/o y by 1. Really the best you can measure is the number of flips you''re getting per second.
So long as you are locking the backbuffer , manipulating it and unlocking it once per frame, your pixel plotting code is about as straightforward as it comes.
Teej
BTW: The mouse being sluggish could be a simple reprocussion (sp?) of using the Windows mouse. Having your own (especially in a worker thread) takes care of that.
The app seem''s slugish because the mouse is really choppy, one second it can be in one spot, and the next, the other side of the screen...and the worker thread?? ??? ??? is that multithreadin?? I''m plotting pixels, dont think I will be doing multithreading for a while
The pixels move smooth too...
this is getting annoying....
The pixels move smooth too...
this is getting annoying....
BAHcows go moomoos go cow
Is it an USB mouse ?
If your application uses DirectX in a window and redraws the screen as fast as possible, windows doesn''t get enough timeslices to update the mouse position and the mouse gets choppy outside the window.
This is not the case with PS/2 mice since they generate a hardware interrupt forcing windows to asynchronously update the cursor
Just another idea...
-Markus-
If your application uses DirectX in a window and redraws the screen as fast as possible, windows doesn''t get enough timeslices to update the mouse position and the mouse gets choppy outside the window.
This is not the case with PS/2 mice since they generate a hardware interrupt forcing windows to asynchronously update the cursor
Just another idea...
-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement