QB64 Phoenix Edition
simple 3d starfield & wireframe or vector graphics revisited - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: simple 3d starfield & wireframe or vector graphics revisited (/showthread.php?tid=4436)



simple 3d starfield & wireframe or vector graphics revisited - madscijr - 01-31-2026

I started thinking again about how you might make a 3d spaceship or car simulator program, with some old PC monitors mounted in a giant cardboard box you can sit in, with a joystick or gaming wheel as the controls, with one monitor mounted in front for the "windshield", and a couple of side "windows" on the right & left, and a PC running a simple 3d program that shows a moving starfield effect (or a road) in front and stars (or terrain) in the side windows also moving past. When you move the joystick in a direction, the stars or terrain would start scrolling in the direction you're moving.

This had been on the backburner for years, but I still would be curious to try making a simple simulation like that, just to see how realistic it would feel. 

We have talked about QB64PE controlling multiple monitors before, where you'd have seperate EXEs each running in its own display, maybe the front window is the master program and the other windows communicate to it through local TCP/IP (I have done this successfully for my multi-mouse program). Vector or wireframe animation should be good enough to start.

The part I would need help with is the 3D graphics, I totally don't know anything about 3D. The main thing I struggle to understand is drawing lines in 3d space from a given camera angle and camera position & distance from the object.

A bonus would be to draw the 3D scene in each monitor from 2 slightly different angles in red and cyan to simulate anaglyphic 3D so that when you wear the red & blue glasses, there would be added realism.

If anyone can share some sample reusable code to do this, I would totally attempt making such a program and share the results here.


RE: simple 3d starfield & wireframe or vector graphics revisited - Unseen Machine - 01-31-2026

research gluperspective (for setting your world up) and glulookat for basic camera controls.

Here's the bindings youll need 

Code: (Select All)
DECLARE DYNAMIC LIBRARY "glu32"
  SUB gluBuild2DMipmaps (BYVAL eg_GL_TEXTURE_2D AS LONG, BYVAL eg_GL_RGBA AS LONG, BYVAL sx AS LONG, BYVAL sy AS LONG, BYVAL eg_GL_RGBA AS LONG, BYVAL eg_GL_UNSIGNED_BYTE AS LONG, BYVAL offset AS _OFFSET)
  SUB gluBuild1DMipmaps (BYVAL target AS LONG, BYVAL internalFormat AS LONG, BYVAL width AS LONG, BYVAL format AS LONG, BYVAL vtype AS LONG, BYVAL pixels AS _OFFSET)
  SUB gluLookAt (BYVAL eyex AS DOUBLE, BYVAL eyey AS DOUBLE, BYVAL eyez AS DOUBLE, BYVAL centerx AS DOUBLE, BYVAL centery AS DOUBLE, BYVAL centerz AS DOUBLE, BYVAL upx AS DOUBLE, BYVAL upy AS DOUBLE, BYVAL upz AS DOUBLE)
  SUB gluOrtho2D (BYVAL left AS DOUBLE, BYVAL right AS DOUBLE, BYVAL bottom AS DOUBLE, BYVAL top AS DOUBLE)
  SUB gluPerspective (BYVAL fovy AS DOUBLE, BYVAL aspect AS DOUBLE, BYVAL zNear AS DOUBLE, BYVAL zFar AS DOUBLE)
  FUNCTION gluErrorString$ (BYVAL errorCode AS LONG)
END DECLARE

A google search will give you detailed info, and if you go in ai mode, hand those declares to the ai and tell it to make you a demo using qb64 with lots of remarks for you to learn from i think youll be fine! i,e ask it "Make a me a simple wireframe grid and First person movement demo using glulookat" and youll be sorted.

Unseen


RE: simple 3d starfield & wireframe or vector graphics revisited - madscijr - 01-31-2026

Thank you sir - when I'm back at my PC I will!


RE: simple 3d starfield & wireframe or vector graphics revisited - bplus - 01-31-2026

lets see, 
buckle down with a spreadsheet
buckle down with InForm *
buckle down with 3D cameras and graphics **

or ask another complex, takes a book to answer question, how can I build an interpreter in a day?

Choices that decide and choices that distract...

* Which BTW I can't figure out, a740g instructions dont work for me, why cant the InForm.bas file be compiled normally like any other .bas file designed for QB64pe. So I can't blame anyone for NOT buckleling down with that option!

** Oh STxAxTIC got me started on 3D graphics then bugged out. @madscijr want to see that? of course your do, I bet you don't really want to buckle down. You like playing with ideas, I know because it takes one to know one Smile


RE: simple 3d starfield & wireframe or vector graphics revisited - madscijr - 01-31-2026

Tell it like it is, @bplus! Sometimes we need a shot of truth!  Wink

My problem is I'm sometimes more of an artist than an engineer - I follow my inspirations. If I can learn to keep things simple and prioritize, more of these might get finished!


RE: simple 3d starfield & wireframe or vector graphics revisited - Pete - 01-31-2026

I'm more an engineer than an artist. Well, I'm off. That caboose isn't going to move itself.

Pete Big Grin Big Grin __ Big Grin >