Silverfrost Forums

Welcome to our forums

plot one pixel ?

13 Jan 2014 3:49 #13535

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 😃

Cordially SosPel

13 Jan 2014 11:36 (Edited: 14 Jan 2014 12:15) #13539

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 😃

14 Jan 2014 8:23 #13540

@ DanRRight

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

Good to add such function to the library

I agree 😃

14 Jan 2014 12:24 #13543

And don't forget to set any lines to be just one pixel thick by set_line_width@(linewidth)

14 Jan 2014 11:20 #13549

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

Eddie

15 Jan 2014 8:05 #13551

Oops... magic.... all is done already. This is called 'RTFM' 😃 Thanks, Eddie

15 Jan 2014 9:24 #13552

**@ DanRRight & LitusSaxonicum **

Hello !

Well, here is THE solution 😃

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:

   [color=red:6454930b67]Error 29. Call to missing routine  _DRAW_POINT#[/color:6454930b67] 

Can you indicate me what I have to add?

Thank you in advance in both!!

Cordially, Sospel

15 Jan 2014 9:43 #13553

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

15 Jan 2014 11:55 #13556

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 :

      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

15 Jan 2014 1:56 #13558

I have no problems with draw_point@ or set_pixel@

15 Jan 2014 4:51 #13559

@ DanRRight

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

SosPel

15 Jan 2014 11:04 #13562

I tend to use

      INCLUDE <WINDOWS.INS>

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

E

16 Jan 2014 10:56 (Edited: 17 Jan 2014 4:59) #13563

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. http://media.orderingdisorder.com/2010/03/sector_space_to_azura.jpg

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

http://img37.imageshack.us/img37/7568/mesh2d3d.png

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

16 Jan 2014 4:36 #13565

**@ 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 😉

Cordially in both ,

Sospel

16 Jan 2014 11:20 #13566

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 ...

17 Jan 2014 6:18 #13567

Agree. That is the most interesting headline news from the desk of the developers of this compiler. Yet it goes unstressed and unnoticed as usually. Good advertisers would use it for benefits of everyone including developers themselves. Should go in bold font as a separate topic on website and forum!

Please login to reply.