forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

plot one pixel ?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
sospel



Joined: 26 Apr 2013
Posts: 31

PostPosted: Mon Jan 13, 2014 4:49 pm    Post subject: plot one pixel ? Reply with quote

Hello!

To display a sky map, I need to draw stars as "packages" of pixels, the star of the lowest luminosity being represented by a single pixel.

But I do not find in CLEARWIN+ a function which would look like this : CALL PLOT(x,y, RGB)
where x and y are coordinates of the pixel in the screen.

Somebody knows how can it be done ?

Thank you in advance Smile

Cordially
SosPel
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Tue Jan 14, 2014 12:36 am    Post subject: Reply with quote

I remember that confused me too. I use draw_line@(x1,y1,x1,y1,rgb@(r,g,b)) which solves this one pixel problem, but...

Good to add such function to the library probably because formally this above is an absurd -- we are plotting the line of zero length Smile


Last edited by DanRRight on Tue Jan 14, 2014 1:15 pm; edited 2 times in total
Back to top
View user's profile Send private message
sospel



Joined: 26 Apr 2013
Posts: 31

PostPosted: Tue Jan 14, 2014 9:23 am    Post subject: Reply with quote

@ DanRRight

Well, we have same problem Sad I've try to draw a "zero-radius" circle ... but it has 4 pixels

>> Good to add such function to the library

I agree Smile
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Tue Jan 14, 2014 1:24 pm    Post subject: Reply with quote

And don't forget to set any lines to be just one pixel thick by set_line_width@(linewidth)
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Wed Jan 15, 2014 12:20 am    Post subject: Reply with quote

Didn't I see a function DRAW_POINT@ in FTN95.CHM?

Eddie
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Wed Jan 15, 2014 9:05 am    Post subject: Reply with quote

Oops... magic.... all is done already. This is called "RTFM" Smile Thanks, Eddie
Back to top
View user's profile Send private message
sospel



Joined: 26 Apr 2013
Posts: 31

PostPosted: Wed Jan 15, 2014 10:24 am    Post subject: Reply with quote

@ DanRRight & LitusSaxonicum

Hello !

Well, here is THE solution Smile

But he doubtless fails to add a MODULE (or a DLL or ... ) somewhere in my program or in his "properties" because, in execution, I have this message:

Error 29. Call to missing routine _DRAW_POINT#

Can you indicate me what I have to add?

Thank you in advance in both!!

Cordially,
Sospel
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Wed Jan 15, 2014 10:43 am    Post subject: Reply with quote

Hi Dan and SosPel,

The problem as I see it is not drawing ONE pixel (for which as I pointed out above, there is already a subroutine), but small numbers of pixels in a regular pattern, as the ellipse and rectangle primitives don't look great at very small sizes. Coding your own primitives usually means writing some patterns using the DRAW_POINT@ subroutine.

This brings me to a couple of suggestions:

(1) you can have multiple levels of one-pixel faintness by selecting the colour carefully,
(2) you can make a star 'twinkle' by writing it then overwriting it on a timer. If the background colour is known (say it is always black or dark blue) you can use the standard write mode, but if the 'sky' is graduated (lighter at the horizon, say) then rather than try to remember the background colour value, it is probably better to switch to XOR mode, or just dim and brighten the star. If you use the same timer, then the sky will pulsate, so you need to use multiple timer intervals or randomise the order in which stars are 'twinkled'.

Eddie
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Wed Jan 15, 2014 12:55 pm    Post subject: Reply with quote

Hi SosPel,

Without writing a code to test it, I can't tell you if it's there or not in the version of FTN95 you are using, but it is certainly in CLEARWIN.INS :

Code:
      C_EXTERNAL SET_PIXEL_L@ '__win_set_pixel_l' (VAL,VAL,VAL)
      C_EXTERNAL DRAW_POINT@ '__win_set_pixel_l' (VAL,VAL,VAL)


As SET_PIXEL_L@ is defined in exactly the same way, why don't you try that as well?

Otherwise, I'm afraid you have reached the limits of my knowledge, and it is over to Paul!

Eddie
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Wed Jan 15, 2014 2:56 pm    Post subject: Reply with quote

I have no problems with draw_point@ or set_pixel@
Back to top
View user's profile Send private message
sospel



Joined: 26 Apr 2013
Posts: 31

PostPosted: Wed Jan 15, 2014 5:51 pm    Post subject: Reply with quote

@ DanRRight

Have you put "MODULE CLRWIN" in your program , or added some INCLUDE or added CLEARWIN PATH in environment variables ?
Thanks for any reply Smile

SosPel
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Thu Jan 16, 2014 12:04 am    Post subject: Reply with quote

I tend to use

Code:
      INCLUDE <WINDOWS.INS>


in my code. WINDOW.INS simply inserts a lot of other INS files.

E
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Jan 16, 2014 11:56 am    Post subject: Reply with quote

You can use any, either INCLUDE <windows.ins> like Eddie suggests since it adds also a lot of Microsoft OS related things, or INCLUDE <clearwin.ins> i see on this forum this compiler developers mostly use, or USE CLRWIN, USE MSWIN. With OpenGL you will need also INCLUDE <opengl.ins>. Search this forum, you will find tons of examples. Your twinkling and moving stars will be probably looking best in OpenGL this compiler also provides access to. There you can create incredibly realistic 3D universe. Do you have file with coordinates of stars? OpenGL will probably handle 100K of them easily, possibly 1M. The 10M, 100M and 1B stars will work only in static regime or very slowly.

I do not know what you plan to do but you could probably make something like that in a week if take my OpenGL demo example.



I do not have a time from couple hours to a day or stars coordinate data to try that myself. You can add fog as a semitransparent objects, and the mesh is already there. You will need just to substitute structured mesh with unstructured polygons for scattered in space stars




The resistance of most programmers to RTFM is understandable. What this compiler needs is Martha Stewart kind of person who will explain how to cook some classic CWP cookies on YouTube


Last edited by DanRRight on Fri Jan 17, 2014 5:59 pm; edited 5 times in total
Back to top
View user's profile Send private message
sospel



Joined: 26 Apr 2013
Posts: 31

PostPosted: Thu Jan 16, 2014 5:36 pm    Post subject: Reply with quote

@ LitusSaxonicum & DanRRight

Thank you for your adwices which solved my problem to draw a weak star by a single pixel !
Still it was necessary to know that " DRAW_POINT@ " is in the manual "FTN95.chm" and not in that of CLEARWIN...

Thank you also for the suggestions of plans of celestial map. In fact, I try at the moment to draw zones of the Sky in a realistic way : the advice to pass by OPENGL is thus sensible. As for the catalogs of stars, there are tens on WEB, one of which is that of Hipparcos.

Thus see you soon to see the results Wink

Cordially in both ,

Sospel
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri Jan 17, 2014 12:20 am    Post subject: Reply with quote

I also recommend reading the Clearwin.enh 'enhancements' file, because it gives you loads of insights into the work Paul (and maybe colleagues) have done in enhancing Clearwin ...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group