![]() |
Register | Login | |||||
![]() |
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
![]()
| |
0 users currently in Programming. |
Acmlm's Board - I3 Archive - Programming - VB6 Overflowing NES rendering... |
New poll | ![]() ![]() |
Pages: 1 2 3 | Add to favorites | Next newer thread | Next older thread |
User | Post | ||
Disch![]() Red Cheep-cheep ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 12-10-05 Last post: 6620 days Last view: 6620 days |
| ||
Well what are you trying? I'm under the impression that you don't understand my example at all, and are just trying to copy/paste/VB-ify it rather than actually transpose it... which means you're more or less guessing (which of course will lead to "it's not working what do I do now" 99% of the time)
Let's try this the other way -- how are you outputting pixels? I take it it has something to do with that "Buffer.Line" function. But I can't make heads or tails of anything after that. What is this "Step" thing? What is that "BF" for? Nothing even remotely resembling that was in my example. If you can show me the following: 1) how to make a 4-entry array of colors 2) how to output a single red pixel at given x,y coords Then I can make a more detailed example for you. (edited by Disch on 05-01-06 10:22 AM) |
|||
Arthus![]() ![]() ![]() ![]() ![]() ![]() 140 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 11-17-05 From: Australia Last post: 6552 days Last view: 6552 days |
| ||
Here is an 4-entry array of colors, I assumed an array that has 4 values which are colors. And how to draw a pixel to a box.
' Dims name for array Dim Pallette2BPP(0 To 3) As Long ' Puts value in array Pallatte2BPP = Array(RGB(255, 255, 255), RGB(255, 0, 0), RGB(0, 255, 0), RGB(0, 0, 255)) ' Makes actual pixel pic_tiles(0).Line (1, 1)-Step(1, 1), Pallette2BPP(0) The "BF" means "box", and "filled". Which allows you to make a fully colored box using the color you specify. Here is a more detailed look at the use of the ".Line" statement. |
|||
Disch![]() Red Cheep-cheep ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 12-10-05 Last post: 6620 days Last view: 6620 days |
| ||
Good God... you mean you're actually drawing whole LINES for each pixel? What ever happened to good old-fashioned pixel plotting ![]() Anyway.. .for a more clear example:
|
|||
Arthus![]() ![]() ![]() ![]() ![]() ![]() 140 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 11-17-05 From: Australia Last post: 6552 days Last view: 6552 days |
| ||
OK, tried that, gives out something rather interesting... see attachment below.
Also I shall to the best of my knowledge correct the assumptions: 1) I think if you make the start and end co-ords 0,0. The pixel isn't going anywhere. So I think 0,0 to 1,1 would draw a pixel. 2) Yes, you are correct. 3) OK... 4) OK... 5) Yes, you are correct. EDIT: I forgot to put in the attachment... (edited by Arthus on 05-01-06 11:35 AM) |
|||
Disch![]() Red Cheep-cheep ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 12-10-05 Last post: 6620 days Last view: 6620 days |
| ||
yeah an attachment might help figure out the problem. (Of course I'll also need to see what the image is supposed to look like)
If #1 was a problem, you could change the coords so that the X coord is 1 higher in the second part. Erm... I worded that bad.. .but like:
I was worried that might draw 2 pixels. |
|||
Arthus![]() ![]() ![]() ![]() ![]() ![]() 140 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 11-17-05 From: Australia Last post: 6552 days Last view: 6552 days |
| ||
OK, with some modifications, it seems with teh 1,2,3 it keept on adding on. So just ading 1 was just fine like so:
Buffer.Line (0, y)-Step(1, 1), Palette2BPP( etc... Buffer.Line (1, y)-Step(1, 1), Palette2BPP( etc... With that, I get the attached with what it should be (once I change the colors) I also might add that all those Pallette2BPP functions return a 0. |
|||
Disch![]() Red Cheep-cheep ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 12-10-05 Last post: 6620 days Last view: 6620 days |
| ||
Well that is some pretty strange output....
Originally posted by Arthus Okay -- that seems to make more sense after re-reading that page you linked about Line I swear though... isn't there a PutPixel() function or SetPixel or something? This line drawing is complete insanity.
Well... wait... the colors should be in your Palette2BPP array. That's why it's there.
functions? I thought that was how you made an array. ![]() Palette2BPP( 0 ) should be giving you your first color, Palette2BPP( 1 ) should be giving you your second, etc. The whole math with 'a' and 'b' and all that dividing and bitwork just produces a number from 0-3 which represents the pixel to output. From there, I just used that to index the palette array to output the desired color for that pixel. Or at least, that's what I was trying to do. Also note that this will only create an 8x8 pixel image (1 tile, no stretching) -- the "desired" image you attached was actually 32x32 pixels (4 tiles, 2x stretching) |
|||
Arthus![]() ![]() ![]() ![]() ![]() ![]() 140 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 11-17-05 From: Australia Last post: 6552 days Last view: 6552 days |
| ||
You misread my wording:
"I get the attached with what it should be (once I change the colors)" Which means, It should output something similar to that, but before I change the colors to match it the same as the desired pixel. And the functions I was refering to were these: Palette2BPP( ((a / 128) And 1) + ((b / 64) And 2) ) And they are now not returning 0. They are returning numbers like 1677215 and 65280... Also, i'll look into a put pixel or somthing... |
|||
Disch![]() Red Cheep-cheep ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 12-10-05 Last post: 6620 days Last view: 6620 days |
| ||
Originally posted by Arthus Ah. Okay, whoops
Yeah that isn't a function. 'Palette2BPP' should be an array, and unless I'm mistaken, VB uses parenthesis to surround the index to the array. All that "a/128 And ..." crap is just a bunch of math that will boil down to a single number (0-3) which indexes the Palette2BPP array. It shouldn't be calling any function.
Okay -- that sounds about right. Those big numbers should be your colors (65280 is &HFF00 -- your green) |
|||
Arthus![]() ![]() ![]() ![]() ![]() ![]() 140 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 11-17-05 From: Australia Last post: 6552 days Last view: 6552 days |
| ||
But shouldn't they be outputting 0-3 instead of 65280-1677215? | |||
Disch![]() Red Cheep-cheep ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 12-10-05 Last post: 6620 days Last view: 6620 days |
| ||
((a / 128) And 1) + ((b / 64) And 2) <--- this will equate to 0-3
Palette2BPP( ((a / 128) And 1) + ((b / 64) And 2) ) <--- this will use that 0-3 to index an array, which will give you a color value (those large numbers you're getting). If you wanted to break this into several steps you could say:
That's exactly the same, just broken into smaller steps. (sorry about all the edits -- so many minor corrections and spacing issues) (edited by Disch on 05-01-06 01:17 PM) (edited by Disch on 05-01-06 01:18 PM) (edited by Disch on 05-01-06 01:21 PM) |
|||
Guy Perfect![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 11-18-05 Last post: 6342 days Last view: 6340 days |
| ||
Arthus:
Use the PSet method to draw individual pixels as opposed to the Line method. Disch: VB is only as stupid as the one who insults it. |
|||
Dan![]() Purple Leever ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 11-18-05 Last post: 6349 days Last view: 6340 days |
| ||
Originally posted by BGNG I guess that makes me stupid then, because VB sucks complete and utter balls. Having used it for a good few years, and having used other alternatives for another few years I definitely feel qualified to say that. Quite why people still use it, when there are far better (free) things out there to use, I don't know. |
|||
Disch![]() Red Cheep-cheep ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 12-10-05 Last post: 6620 days Last view: 6620 days |
| ||
The sentence you are reading right now is a lie. And 1000 other paradoxes. Word @ Dan On the major note: thanks for pointing out PSet, BGNG -- I knew there had to be some way to set a pixel -- that Line method was super insane mega-crazy |
|||
HyperHacker![]() Star Mario Finally being paid to code in VB! If only I still enjoyed that. <_< Wii #7182 6487 4198 1828 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 11-18-05 From: Canada, w00t! My computer's specs, if anyone gives a damn. STOP TRUNCATING THIS >8^( Last post: 6340 days Last view: 6340 days |
| ||
Ideally you'd use CreateCompatibleBitmap, CreateDC, BitBlt and SetPixel to draw tiles. A bit more complex, but hundreds of times faster than anything built into VB. | |||
Disch![]() Red Cheep-cheep ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 12-10-05 Last post: 6620 days Last view: 6620 days |
| ||
Originally posted by HyperMackerel CreateDIBSection + CreateCompatibleDC + BitBlt = win CreateDIBSection is super mega-awesome. |
|||
HyperHacker![]() Star Mario Finally being paid to code in VB! If only I still enjoyed that. <_< Wii #7182 6487 4198 1828 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 11-18-05 From: Canada, w00t! My computer's specs, if anyone gives a damn. STOP TRUNCATING THIS >8^( Last post: 6340 days Last view: 6340 days |
| ||
Hm, that does sound better. I'll have to try that next time I do something GDI-related. | |||
Arthus![]() ![]() ![]() ![]() ![]() ![]() 140 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 11-17-05 From: Australia Last post: 6552 days Last view: 6552 days |
| ||
OK, I'm using the PSet method, and i'm still getting the same result:
Public Sub PaintTile(Buffer As PictureBox) Palette2BPP = Array(RGB(255, 255, 255), RGB(255, 0, 0), RGB(0, 255, 0), RGB(0, 0, 255)) Dim a As Byte Dim b As Byte Dim y As Integer For y = 0 To 7 offset = 201744 a = romdata(offset + y) b = romdata(offset + y + 8) Buffer.PSet (0, y), Palette2BPP(((a / 128) And 1) + ((b / 64) And 2)) Buffer.PSet (1, y), Palette2BPP(((a / 64) And 1) + ((b / 32) And 2)) Buffer.PSet (2, y), Palette2BPP(((a / 32) And 1) + ((b / 16) And 2)) Buffer.PSet (3, y), Palette2BPP(((a / 16) And 1) + ((b / 8) And 2)) Buffer.PSet (4, y), Palette2BPP(((a / 8) And 1) + ((b / 4) And 2)) Buffer.PSet (5, y), Palette2BPP(((a / 4) And 1) + ((b / 2) And 2)) Buffer.PSet (6, y), Palette2BPP(((a / 2) And 1) + (b And 2)) Buffer.PSet (7, y), Palette2BPP((a And 1) + ((b * 2) And 2)) Next End Sub |
|||
Disch![]() Red Cheep-cheep ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 12-10-05 Last post: 6620 days Last view: 6620 days |
| ||
From what I found on MSDN it looks like PSet is supposed to have a "flags" parameter before you give it the X,Y coords. Although that page doesn't seem to give you valid values for the flag... it just says it's a "keyword", whatever the hell that means.
Or maybe it's something else silly, like VB using "twips" or whatever instead of actual pixels? Who freaking knows. You're on your own from here... I can't help anymore since the rest is VB-specific crap. But those calculations you're using to decode NES 2bpp are correct. I'm certain of that. EDIT -- unless VB doesn't zero-base array indecies? I'm under the assuption it would, but you never know. Palette2BPP( 0 ) <-- should be the first element in the array Palette2BPP( 1 ) <-- should be the second -- not the first (dunno if VB treats this as the first or not?) If I'm wrong on that assumption, you'll have to add an additional 1 to all those. IE: ((a / 128) And 1) + ((b / 64) And 2) + 1 I find that unlikely though -- but with VB you never know.... (edited by Disch on 05-03-06 02:45 PM) |
|||
HyperHacker![]() Star Mario Finally being paid to code in VB! If only I still enjoyed that. <_< Wii #7182 6487 4198 1828 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 11-18-05 From: Canada, w00t! My computer's specs, if anyone gives a damn. STOP TRUNCATING THIS >8^( Last post: 6340 days Last view: 6340 days |
| ||
You can choose in VB whether you want zero- or one-based, but I'm not sure what the default is. Also, check the Scale property of your PictureBox; it needs to be set to Pixels. I dunno WTF Twips are, but they're not very useful. |
Pages: 1 2 3 | Add to favorites | Next newer thread | Next older thread |
Acmlm's Board - I3 Archive - Programming - VB6 Overflowing NES rendering... |
![]() ![]() |