Author Topic: Star Backgound  (Read 33538 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Star Backgound
« Reply #30 on: June 18, 2018, 11:50:55 pm »
Hi Johnno,

Where are you getting the rectangle images?

Mars is fantastic except for the unseemly seam. There is probably some way to blend the two ends mainly with colors?

I started looking into converting a rectangle to sphere image and learned word tessellation and triangle strips. Saw some fairly reasonable trig equations for the points. Maybe halfway home?
http://hugi.scene.org/online/hugi27/hugi%2027%20-%20coding%20corner%20polaris%20sphere%20tessellation%20101.htm
« Last Edit: June 18, 2018, 11:59:37 pm by bplus »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Star Backgound
« Reply #31 on: June 19, 2018, 12:35:04 am »
Rectangular images? Google. "flat map mars" etc. Using Gimp's in built Sphere Animator makes a 'traditional' sphere if the image is 'stretched' out to a square. Any image/texture can be used. The more frames used (10 frames per second is the slowest) will give you a smoother rotation at the cost of more memory.... The Mars example works quite well except for, as you rightly pointed out, the 'seam'. Gimp is quite capable in producing 'seamless' images, but for an image as complex as Mars, may be a 'bit of a stretch' - no pun intended... lol

Here is a better one by Nasa:

https://www.dropbox.com/s/jix1n1mhswnp2q2/mars0_src.jpg?dl=0 (image)
https://www.dropbox.com/s/u1p8ueq4dlj6ef2/mars2.gif?dl=0 (gif - 100 frames)
« Last Edit: June 19, 2018, 12:53:42 am by johnno56 »
Logic is the beginning of wisdom.

Offline SirCrow

  • Forum Regular
  • Posts: 144
    • View Profile
Re: Star Backgound
« Reply #32 on: June 19, 2018, 01:17:51 am »
Very nice.  I'm using a much simpler stars BG in the Asteroids-based game I'm currently making.  I want to upload it as a work in progress, but I'm confused about how the whole Linux thing works.  With Windows, I'd compile it, there would be the .exe file, and it would be super-simple to run it.  In Ubuntu, I don't even see an extension on the filename.  I definitely want the game usable in both Windows and Linux!  Should I just let the user take the source and compile it?  Am I over-complicating this?

I love the way my stars move independently of the separate nebula/cloud BG as the ship flies around.  I hope I'll get to share it here soon.
« Last Edit: June 19, 2018, 01:53:36 am by SirCrow »
I may not always finish what I've started....

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Star Backgound
« Reply #33 on: June 19, 2018, 09:02:47 am »
Hi SirCrow,

I sure don't need the exe (Windows) and much prefer the source to compile.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Star Backgound
« Reply #34 on: June 19, 2018, 09:35:09 am »
Hi [banned user],

Not bad! I like the detail but that seam...

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Star Backgound
« Reply #35 on: June 19, 2018, 11:17:09 am »
Hi [banned user]!
For more realistic planet, you can render a Sphere with planet texture using OpenGL.
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Star Backgound
« Reply #36 on: June 19, 2018, 12:02:36 pm »
Hi [banned user]!
For more realistic planet, you can render a Sphere with planet texture using OpenGL.

Hi Ashish,

I am pretty sure [banned user] would like help for that, I know I would...


Hi [banned user],

I was thinking drawing different phases of crescent moons in shady and light transparent colors in separate destination and layer them atop the circle planet. Draw circle in transparent light or dark then block out with black circle so only transparent crescent remains. (Thinking like a lazy, crazy coder?)

Offline SirCrow

  • Forum Regular
  • Posts: 144
    • View Profile
My Asteroids-like Space Game
« Reply #37 on: June 19, 2018, 12:19:12 pm »
My work-in-progress game is finally ready to share:
http://qb64.thejoyfulprogrammer.com/showthread.php?tid=1349&rndtime=15294166471450489226

As to Linux/Ubuntu and running executable files, I really wish someone would tell me how to run them without involving the Terminal.
I may not always finish what I've started....

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Star Backgound
« Reply #38 on: June 19, 2018, 12:55:52 pm »
OK [banned user] it works a little, not quite what I had in mind (need color that stays transparent for blackout) but I managed this:
https://www.qb64.org/forum/index.php?topic=286.0

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Star Backgound
« Reply #39 on: June 19, 2018, 05:45:16 pm »
SirCrow,

To run a compiled executable can be as simple as double-clicking the executable or as involved as creating a script and launcher. Either process will avoid 'The Terminal' (insert dramatic music here... lol)

If memory serves correctly... From within the QB64 IDE select 'Run" then check "Output EXE to source folder". Once that is done, pressing F11, will produce ONLY the executable. From there you can either go to the source folder and double-click or create a Launcher.

I tested the F11 option on my machine and it produced the executable as advertised. I double-clicked the executable... and an image appeared for just a moment... then vanished. Break out 'The Terminal' (insert dramatic music here). Ran the executable, so I can see any errors, and errors there were.

---------------------------------------------------------------------------------------------------------------------------------------------------
john@john-H81M-DS2 ~/basic/qb64/starblast $ ./StarBlast_2018-6-19
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
StarBlast_2018-6-19: ../../src/xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
Aborted
---------------------------------------------------------------------------------------------------------------------------------------------------

At least it was apologetic... lol

Looks like, for me anyway, I cannot run the compiled executable because I am using a multi-core machine... If your machine is a single core, give it a try, and let me know how you get on?

Sorry I couldn't be of better help...

J
Logic is the beginning of wisdom.

Offline odin

  • Administrator
  • Newbie
  • Posts: 92
  • I am.
    • View Profile
Re: Star Backgound
« Reply #40 on: June 19, 2018, 08:36:14 pm »
This topic started as an off-topic post, as it contained a single image not related to any QB64 code. The best place for that would be the off-topic board, as already explained.

As it progressed and became a collaborative program, it makes sense to have it again in the Programs board (as just moved) so you members can continue improving upon the collective effort.

Rules remain the same.

Love,

Odin.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Star Backgound
« Reply #41 on: June 20, 2018, 09:44:34 am »
Gremlin?
Code: QB64: [Select]
  1. DIM SHARED texMask AS LONG
  2. texMask = _NEWIMAGE(texWidth + 4, texHeight)  'plus 4 on width
  3.  

Nice demo of mask! Great improvements.
« Last Edit: June 20, 2018, 09:46:16 am by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Star Backgound
« Reply #42 on: June 20, 2018, 10:14:41 am »
Johnno's mars link:
https://www.dropbox.com/s/jix1n1mhswnp2q2/mars0_src.jpg?dl=0

has a much better blended seam, way less obvious! though the detail isn't quite as sharp.

BTW I tried -1 and -2 on image widths to reduce black seam and started getting a gremlin on the right side!
« Last Edit: June 20, 2018, 10:17:34 am by bplus »

Offline SirCrow

  • Forum Regular
  • Posts: 144
    • View Profile
Re: Star Backgound
« Reply #43 on: June 20, 2018, 06:24:14 pm »
. . .
---------------------------------------------------------------------------------------------------------------------------------------------------
john@john-H81M-DS2 ~/basic/qb64/starblast $ ./StarBlast_2018-6-19
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
StarBlast_2018-6-19: ../../src/xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
Aborted
---------------------------------------------------------------------------------------------------------------------------------------------------

At least it was apologetic... lol

Looks like, for me anyway, I cannot run the compiled executable because I am using a multi-core machine... If your machine is a single core, give it a try, and let me know how you get on?

Sorry I couldn't be of better help...

J

Indeed, mine is also a mult-core machine!  So no simply click-to-run, then, I guess.  What the heck is XInitThreads, anyway?  Where can I get me one of those??  Probably wouldn't solve the issue anyway.  I've had that error msg. before.  Thanks for the attention, Johnno.  [Where are the smileys on this thing?]
« Last Edit: June 20, 2018, 06:29:19 pm by SirCrow »
I may not always finish what I've started....

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Star Backgound
« Reply #44 on: June 20, 2018, 08:40:50 pm »
"What the heck is XInitThreads, anyway?  Where can I get me one of those??"

I went to the x.org/archives and found THIS description... Hold onto your hat.

"The XInitThreads function initializes Xlib support for concurrent threads. This function must be the first Xlib function a multi-threaded program calls, and it must complete before any other Xlib call is made. This function returns a nonzero status if initialization was successful; otherwise, it returns zero. On systems that do not support threads, this function always returns zero.

It is only necessary to call this function if multiple threads might use Xlib concurrently. If all calls to Xlib functions are protected by some other access mechanism (for example, a mutual exclusion lock in a toolkit or through explicit client programming), Xlib thread initialization is not required. It is recommended that single-threaded programs not call this function."

I don't know about you, but as for me, this was WAY over my head. I think I would have difficulty understanding this even if it used simple English... I'm still none the wiser... Do you STILL want one?  lol  :D
Logic is the beginning of wisdom.