Author Topic: Grayscale Problems  (Read 5856 times)

0 Members and 1 Guest are viewing this topic.

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Grayscale Problems
« on: October 08, 2012, 09:22:52 am »
I can't get my grey timer to work!
Where T goes from 375 to 0, my code:
Code: [Select]
:RectI(76,12,8,50)^r
:Rect(76,62-(T*2/15),8,T*2/15)^r
It works, but it leaves behind some residue. ??? Why?

Also, in a totally separate problem, is there a way to display both buffers together without flashing between the two? I want to use the back buffer as something I can pxl-test() separately from the main buffer, but I don't want it to be grey.

Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: Grayscale Problems
« Reply #1 on: October 08, 2012, 11:02:20 am »
Make sure you are clearing the back buffer between each usage (ClrDrawr), otherwise you will get 2 pixel tall blocks left behind as it inverts it.  (Also: shouldnt the first be solid and the second inverted?)

As for displaying both buffers, im not sure exactly what you are asking.  Are you trying to mask them of something?  if you want to just draw them both together, doing DispGraph:DispGraph(L3) will draw them one on top of the other.  if you just want to be able to pxl-test the back buffer though, you dont actually have to draw it, just use pxl-Test()r.  Maybe i'm missing something, what are you actually trying to do?
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Grayscale Problems
« Reply #2 on: October 08, 2012, 11:48:36 am »
I clear the buffer with [ClrDraw^rr] so it clears both. What it's supposed to do is erase the whole timer, then draw the parts that are left in the timer. Then I do DispGraph^rr.
Changing the order makes it fill grey from top to bottom (quite smoothly), but I want it to be all grey and have white come down until it's all white.

You solved my other problem with DispGraph:DispGraph(L3)!
I wanted to display them both as 1 buffer, but be able to pxl-test() them separately. I can do that now, thanks!

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Grayscale Problems
« Reply #3 on: October 25, 2012, 09:36:03 pm »
*bump
Code: [Select]
:375->T
:Repeat T=0
:T--
:RectI(76,12,8,50)^r
:Rect(76,62-(T*2/15),8,T*2/15)^r
:End
It leaves some residue; please tell me how to fix this!

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Grayscale Problems
« Reply #4 on: October 26, 2012, 01:18:55 am »
Would you mind posting more of your code ? For now, there is no chance to leave any residue anywhere since there is no DispGraph or DispGraph^r

Is this what you are trying to do ?


If so, the right code (unoptimized) is:
:375->T
:Repeat T=0
:T--
:RectI(76,62-(T*2/15),8,T*2/15)^^r
:.draw the rectangle
:DispGraph^^r
:RectI(76,62-(T*2/15),8,T*2/15)^^r
:.erase the rectangle
:End
« Last Edit: October 26, 2012, 01:23:30 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Grayscale Problems
« Reply #5 on: October 26, 2012, 08:14:17 am »
It's in a game I'm making. Here's the code with a dispgraph
Code: [Select]
:375->T
:Repeat T=0
:T--
:RectI(76,12,8,50)^r
:Rect(76,62-(T*2/15),8,T*2/15)^r
:DispGraph^rr
:End
Yeah, forgot the DispGraph^rr. But that's essentially what the problem code in the game is.
I'm too lazy to make a new .gif, so here's an old one I made showcasing the menu. You can see the residue pretty easily. Also attached my source for the game.

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Grayscale Problems
« Reply #6 on: October 26, 2012, 08:27:48 am »
Try putting the T-- after the RectI(). If I'm reading the code right, that's what's erasing the rectangle?

Edit: ok looked it a bit more closely..what's going on is the top part of the rectangle isn't being erased, it's just being inverted every frame. If the rectangle were on the front buffer, you'd see it leaving a kind of flickery mess behind :P Because of how the grayscale works, it leaves a flickery crosshatch behind.
I'm guessing here, but try this:

375->T
Repeat T=0
RectI(76,62-(T*2/15),8,T*2/15)^r
T--
Rect(76,62-(T*2/15),8,T*2/15)^r
DispGraph^rr
End


Edit2: what heyleia did looks like it works too.
« Last Edit: October 26, 2012, 08:55:26 am by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Grayscale Problems
« Reply #7 on: October 26, 2012, 10:38:07 am »
Edit2: what heyleia did looks like it works too.
(Who's "heyleia" ? Don't know that person :P)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Grayscale Problems
« Reply #8 on: October 26, 2012, 11:02:45 am »
Hm, guess that's what posting at ~5 in the morning causes :P
Vy'o'us pleorsdti thl'e gjaemue

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Grayscale Problems
« Reply #9 on: October 26, 2012, 07:02:05 pm »
Thank you. So. Very. Much. It works!

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Grayscale Problems
« Reply #10 on: October 26, 2012, 08:32:36 pm »
Also, Hayleia, where did you get that font? I looks awesome; I want it!

EDIT: I suppose this isn't really worth a new post, so it's an edit:
Thanks for the font link. This inspired me to get zStart working again (it used to always crash) and it doesn't crash now!
« Last Edit: October 27, 2012, 09:20:11 am by dinosteven »

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Grayscale Problems
« Reply #11 on: October 26, 2012, 10:25:18 pm »
Glad to hear it's working now :)

Edit: also a friendly reminder: double-posting in a short time span (less than around 6 hrs or so) is generally discouraged, you can edit the already-made post instead ;)
« Last Edit: October 26, 2012, 10:33:14 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Grayscale Problems
« Reply #12 on: October 27, 2012, 01:11:01 am »
Thank you. So. Very. Much. It works!
Glad to be helpful :)
Also note that the code I provided is not optimized at all, you could routinize the Rect call instead of putting twice the same command.

Also, Hayleia, where did you get that font? I looks awesome; I want it!
It is Spyro's font (you need zStart to use it). I only changed the cursors, all the rest is his work.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s