|
-
Dec 18th, 2000, 09:49 AM
#1
Thread Starter
Lively Member
hello.
i would like to be able to plot a pixel with a specified
color on the screen (or inside some kind of a box[?]).
oh yeah... it needs to be ***fast***.
never have i used directX or opengl or whatever (i have NT).
now come'on,
is it that difficult question?
(and while you reply, some help about changing video modes
would be most appreciated).
thanx.
-i.
-
Dec 18th, 2000, 10:40 AM
#2
transcendental analytic
What are you intending to do, DirectDraw is probably the fastest possible solution, if you don't want to depend on DirectX you can use SetpixelV api.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 18th, 2000, 10:44 AM
#3
Thread Starter
Lively Member
i don't mind using directdraw
i don't mind using directdraw,
just never have i done before.
i am not affraid also...
i just need to know how to get started 
itay.
-
Dec 18th, 2000, 04:51 PM
#4
transcendental analytic
Before you do this you should learn the basics of DirectDraw, you can take a look at Fox DirectDraw demo on his homepage (theres a link on his signature) also you can search on this forum for more info.
The manipulations of the surfaces are a bit tricky, you need to lock them first with lock method. after all manipulations are done you can unlock it again for use.
Code:
Dim nullrect 'this rect is empty, and should stay
Dim Desc As DDSURFACEDESC2
Dim surface As DirectDrawSurface7 'this one needs to be initialized
surface.Lock nullrect, Desc, DDLOCK_WAIT, 0
surface.SetLockedPixel X, Y, color
surface.Unlock nullrect
The rect parameters is just for locking parts of a surface and you probably wont need to do that so by sending an empty rect it will select the whole surface.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 19th, 2000, 03:42 AM
#5
Thread Starter
Lively Member
allow me to rephrase
allow me to rephrase:
i would like to make a button on a form in visual basic.
on the event of button click,
i want the screen to go 320x200 256 colors.
then i will plot very *fast* pixel with all the colors
of the rainbow on the screen.
when [esc] is pressed, the vb form will return.
is that possible?
assume my knowledge of directdraw equals
your knowledge on writing demos in assembler.
itay.
-
Dec 19th, 2000, 08:14 AM
#6
transcendental analytic
Yes it's possible and easy too, i could send you a sample project of it if you want.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 20th, 2000, 06:15 PM
#7
Frenzied Member
Hey, I've seen an example on direct memory access at http://www.ur.co.nz/ , it's much faster than DirectDraw's SetLockedPixel!
-
Dec 21st, 2000, 03:53 AM
#8
Thread Starter
Lively Member
thanks a lot!
hey,
great stuff there.
now, all i need to know is how to do it on
the entire screen.
but anyway, thanks for your reply!
itay.
-
Dec 21st, 2000, 09:01 AM
#9
Frenzied Member
You're welcome 
I think it's a demo on how to make fast translucency, but since you want a rainbow, you'd have to fill the palette with the rainbow's colors, then it would be easy to make the rest! If you need help on it, e-mail me or post here again.
You'll have to make another form with no border and maximized. There's a way of making your form stay on top of all others so you can ocupy the whole screen:
Code:
'Paste this into the form's declarations (top-most lines)
Private Declare Sub SetWindowPos Lib "User32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
'Use this code to make the form "Top-Most"
SetWindowPos Form1.hWnd, HWND_TOPMOST, Form1.Left / 15, _
Form1.Top / 15, Form1.Width / 15, _
Form1.Height / 15, SWP_NOACTIVATE Or SWP_SHOWWINDOW
'Use this code to make the form back to normal
SetWindowPos Form1.hWnd, HWND_NOTOPMOST, Form1.Left / 15, _
Form1.Top / 15, Form1.Width / 15, _
Form1.Height / 15, SWP_NOACTIVATE Or SWP_SHOWWINDOW
That should solve your problem! In the Form_Load event, make the form top-most and maximize it (by setting the WindowState property of the form to 2). In the Form_Unload event, make it normal again (not sure if it's necessary).
Also note that if your form's name is not Form1, you'll have to change all the "Form1"s in the above code to your form's name.
Good luck with your program
-
Dec 21st, 2000, 11:08 AM
#10
Thread Starter
Lively Member
firstly, excuse me for being so lazy and looking
for complete answers without research from myself...
now,
the (very nice) samples there (http://www.ur.co.nz)
demonstarte memory access to picture_box array.
using this, i can indeed make changes to the picture.
however, the colors i can use are the colors of the
picture inside the pictureBox.
the only way i can "compose" my own RGB color
is using picturebox1.pset x,y,&Hrrggbb. and this is
not good (slow), plus i don't know what will happen when
i combine this two approaches.
so, still, can any1 help?
again, the task:
1. pset(x,y,color), and also
2. setpal (color,r,g,b)
3. fast.
10x, itay.
-
Dec 21st, 2000, 04:53 PM
#11
Frenzied Member
I haven't tested that demo much, but my guess is that you can load a blank image, then modify all the pixels in it.
If the picture is a GIF with a custom palette, you'll use a custom palette; if it's a 24-bits BMP, you'll be able to use the RGB mode.
Try it, it might work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|