Author Topic: FILLPOLY_P: Insufficient memory  (Read 10285 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
FILLPOLY_P: Insufficient memory
« on: December 03, 2013, 11:39:51 pm »
I am trying the example code found in the HP Prime help section, but I am getting an insufficient memory error. I am using 614 KB out of my 256 MB Flash. ???

Quote
Syntax: FILLPOLY_P([G], {coordinates...} or [Coordinates], Color, [Alpha])

Fills the polygon specified by the provided pixel coordinates using the color provided.
If Alpha (0 to 255) is provided, the polygon is drawn with trensparency.

Example: FILLPOLY_P([(20,20),(120,120),(150,20),(180,150),(50,100)], #FF, 128)

Does the calc literally have to be empty in order to use 3D functions? O.O
« Last Edit: December 03, 2013, 11:40:15 pm by DJ Omnimaga »

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: FILLPOLY_P: Insufficient memory
« Reply #1 on: December 04, 2013, 09:51:42 am »
Aren't you missing a parameter ? In the text you quoted, it seems that you must pass 3 parameters (4 with alpha) and you passed 3 parameters including alpha.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Re: FILLPOLY_P: Insufficient memory
« Reply #2 on: December 04, 2013, 01:34:33 pm »
I just used the example code ???

Offline MacBernick

  • LV3 Member (Next: 100)
  • ***
  • Posts: 93
  • Rating: +3/-0
    • View Profile
Re: FILLPOLY_P: Insufficient memory
« Reply #3 on: December 05, 2013, 10:06:29 pm »
I think you should try and replace your ()'s by []'s, you will then have an actual matrix of coordinates. Looks like the Prime interprets (x, y) as complex numbers (x+iy).
« Last Edit: December 05, 2013, 10:07:52 pm by MacBernick »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: FILLPOLY_P: Insufficient memory
« Reply #4 on: December 05, 2013, 10:10:56 pm »
Ok I tried this and no longer get the error, but nothing happens at all.

Offline MacBernick

  • LV3 Member (Next: 100)
  • ***
  • Posts: 93
  • Rating: +3/-0
    • View Profile
Re: FILLPOLY_P: Insufficient memory
« Reply #5 on: December 05, 2013, 10:24:55 pm »
Yes you're right. The only way I managed to make it work is with lists

FILLPOLY_P({{20,20},{120,120},{150,20},{180,150},{50,100}}, #FF, 128)

is working fine.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: FILLPOLY_P: Insufficient memory
« Reply #6 on: December 05, 2013, 10:30:48 pm »
They really need to fix their help so that it provides working examples. :P (I mean, I went on-calc, selected FILLPOLY_P and pressed the Help key and this is what I got O.O)

It might be a typo, though.


It works now and thanks for the help! :D

And wow the function even supports alpha transparency...??? O.O

« Last Edit: December 05, 2013, 10:30:56 pm by DJ Omnimaga »

Offline MacBernick

  • LV3 Member (Next: 100)
  • ***
  • Posts: 93
  • Rating: +3/-0
    • View Profile
Re: FILLPOLY_P: Insufficient memory
« Reply #7 on: December 05, 2013, 10:39:42 pm »
You're welcome.

yes I saw the help too. Bug in doc and in software I guess. Should work with matrix, and parenthesis should be replaced in doc too.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: FILLPOLY_P: Insufficient memory
« Reply #8 on: December 06, 2013, 02:46:23 am »
O.O



Code: [Select]
EXPORT POLYFADE()
BEGIN
DIMGROB_P(G1,320,240);
DIMGROB_P(G2,320,240);
BLIT_P(G1,G0);
WHILE 1 DO
FOR Z FROM 0 TO 255 STEP 1 DO
BLIT_P(G2,G1);
FILLPOLY_P(G2,{{0,0},{320,0},{320,240},{0,240}}, #FF0000, Z);
FILLPOLY_P(G2,{{Z,Z},{320,0},{320-Z,240-Z},{0,240}}, #00FFFF, Z);
BLIT_P(G0,G2);
WAIT(.25);
END;
END;
END;
Now we have over 9000 possibilities!

Judging by the speed (which is the same on a real calc), don't expect Super Mario 64 or Minecraft, though :P (although I bet that calling every polygon in a single list might be faster, considering Tim Wessman had an entire wireframe 3D graph with polygons rotating at 20 FPS. I'll have to try with a larger list)
« Last Edit: December 06, 2013, 03:00:24 am by DJ Omnimaga »

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: FILLPOLY_P: Insufficient memory
« Reply #9 on: December 06, 2013, 01:09:35 pm »
 :o  this is epic. HP you've done a really good job with these function
« Last Edit: December 08, 2013, 02:26:09 pm by TheMachine02 »
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: FILLPOLY_P: Insufficient memory
« Reply #10 on: December 07, 2013, 04:49:04 am »
Wow, that's looking awesome O.O

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: FILLPOLY_P: Insufficient memory
« Reply #11 on: December 07, 2013, 09:31:44 am »
EDIT : no sarcasm intended =(

It seems like I downrated you by mistake, sorry for that. Probably happened on my mobile phone (I have the same problem with for example like buttons, pressing them unknowingly).

It's nice to see that the Prime is getting some good upgrades :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: FILLPOLY_P: Insufficient memory
« Reply #12 on: December 07, 2013, 09:55:03 am »
I have Tapatalk on mobile so I can't see ratings from there. :P

Also I tried this with a longer list and it didn't make a speed difference. I assume that complex shapes might be pretty fast if done from a single call. I need to investigate on the Triangle command, though, after seeing that Tim Wessman's 3D thing was done in a single call and ran at 20 FPS.

Offline Han

  • LV3 Member (Next: 100)
  • ***
  • Posts: 62
  • Rating: +7/-0
    • View Profile
Re: FILLPOLY_P: Insufficient memory
« Reply #13 on: December 18, 2013, 03:00:52 pm »
Could someone humor me and try running the same code (as posted) on the most recent emulator update (or even firmware)? For some reason it seems to go extremely slowly.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: FILLPOLY_P: Insufficient memory
« Reply #14 on: December 18, 2013, 04:02:59 pm »
I thought that the current firmware was the only one with FILLPOLY support? O.O (the first firmware didn't have triangle/polygon commands)

For me, in the current firmware (version 2013 11 25 Rev 5447), on a real calculator it runs as fast as in the screenshot above (smoother, actually, since the GIF is capped at 30 images per second). If I use multiple FILLPOLY_P commands in one loop, however, it starts being a bit slower (not super slow, though).