Aaditya Parashar
Full Member
Just somebody with an abnormal coding routine.
Posts: 127
|
Post by Aaditya Parashar on Apr 8, 2024 9:29:19 GMT
Can we just make a 3d library for qb64 which includes opengl? It would be so easy to code 3d stuff.
|
|
|
Post by bplus on Apr 8, 2024 12:38:56 GMT
As far a 3D goes bplus this guy might be able to help you and others a lot! From what I can read he get's to the core of the problem without the complicated explanation,as one person wrote below... "@lennybird91 4 years ago As a Junior software engineer whose coverage of graphics consisted of one course utilizing OpenGL in college, I'm very grateful for this series. Exploring the underlying theory devoid of simplifying libraries is exactly what I'm after. Thanks!" Code-It-Yourself! 3D Graphics Engine Part #1 - Triangles & Projection www.youtube.com/watch?v=ih20l3pJoeU I tried to make something and just managed to do the first two parts, the third part includes clipping and textures but it wasn't important, so I just left it. View AttachmentView Attachmentpart 1 needs a game.bi i tried running it and wacked out my computer yikes! part 2 works good, nice basic cube rotations looks like good start on 3D math.
|
|
Aaditya Parashar
Full Member
Just somebody with an abnormal coding routine.
Posts: 127
|
Post by Aaditya Parashar on Apr 8, 2024 13:00:26 GMT
|
|
|
Post by bplus on Apr 8, 2024 17:06:02 GMT
that was it (now works correctly with all the files) AP, nice work. did you work out 2 different ways to do that rotating cube? skimming through subs and function of 2nd and comparing to first now that we have bi and bm they do seem like 2 different approaches. wouldn't mind more comments with those subs and functions to get to know them well enough to actually use.
|
|
Aaditya Parashar
Full Member
Just somebody with an abnormal coding routine.
Posts: 127
|
Post by Aaditya Parashar on Apr 9, 2024 4:15:14 GMT
They both do the same thing, but javidx9 added obj file loading and some other stuff, so they both are a bit different. but they work on same algorithm for rotating, i.e. matrix multiplication. Well, here is the commented file: gameSubs.bm (10.68 KB) I don't work on these now, cause I have moved on to opengl. This also has many bugs, and is slow like a turtle.
|
|
|
Post by bplus on Apr 9, 2024 20:02:32 GMT
looks interesting arb, i will check it out when i get some time.
|
|
Aaditya Parashar
Full Member
Just somebody with an abnormal coding routine.
Posts: 127
|
Post by Aaditya Parashar on Apr 15, 2024 7:16:07 GMT
Here is random scribble I made using 2D Vector Math:
Screen _NewImage(640, 480, 32) Type Vec2d As Single X, Y End Type Dim As Vec2d NormalVector, PositionVector, LastPositionVector, RandomVector Do Randomize Timer Cls NewRandomVector NormalVector NewVector PositionVector, _Width / 2, _Height / 2 LastPositionVector = PositionVector For Y = 1 To _Height NewVector RandomVector, Rnd - 0.5, Rnd - 0.5 NormalizeVector RandomVector MultiplyVector RandomVector, DotProduct(RandomVector, NormalVector) * 10 NewParallelVector NormalVector, RandomVector AddVector PositionVector, RandomVector, PositionVector Line (LastPositionVector.X, LastPositionVector.Y)-(PositionVector.X, PositionVector.Y), _RGB32(0, 127, 255) LastPositionVector = PositionVector Next Y Sleep Loop Until Inp(&H60) = 1 System Sub NewVector (A As Vec2d, X, Y) A.X = X A.Y = Y End Sub Sub NewRandomVector (A As Vec2d) A.X = Rnd - 0.5 A.Y = Rnd - 0.5 NormalizeVector A End Sub Sub NewParallelVector (A As Vec2d, B As Vec2d) A = B NormalizeVector A End Sub Function DotProduct (A As Vec2d, B As Vec2d) DotProduct = A.X * B.X + A.Y * B.Y End Function Sub NormalizeVector (A As Vec2d) L = Sqr(DotProduct(A, A)) A.X = A.X / L A.Y = A.Y / L End Sub Sub AddVector (A As Vec2d, B As Vec2d, C As Vec2d) C.X = A.X + B.X C.Y = A.Y + B.Y End Sub Sub SubVector (A As Vec2d, B As Vec2d, C As Vec2d) C.X = A.X - B.X C.Y = A.Y - B.Y End Sub Sub MultiplyVector (A As Vec2d, B As Single) A.X = A.X * B A.Y = A.Y * B End Sub
|
|