Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
simple 3d starfield & wireframe or vector graphics revisited
#1
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.
Reply
#2
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
Reply
#3
Thank you sir - when I'm back at my PC I will!
Reply
#4
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
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#5
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!
Reply
#6
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 >
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Nice simple, I hope, question Mad Axeman 4 335 12-20-2025, 09:28 PM
Last Post: SMcNeill
  trouble filling in a closed vector shape madscijr 31 2,442 11-11-2025, 03:41 PM
Last Post: bplus
  Simple Addition gone wrong Dimster 13 1,423 08-22-2025, 09:00 PM
Last Post: Pete
  wireframe maze anyone? James D Jarvis 3 457 08-10-2025, 04:52 PM
Last Post: Unseen Machine
  Trying to create a simple menu CMR 8 1,189 06-18-2025, 06:59 PM
Last Post: CookieOscar

Forum Jump:


Users browsing this thread: