Click to See Complete Forum and Search --> : The miscellaneous musical instrument of VB!
Sastraxi
Mar 8th, 2001, 03:45 PM
Hey! Welcome to the thread on my first OGL game, the miscellaneous musical instrument of VB! (just guess where I ripped the title from..)
I have already started and have set up OGL...
Now, I need to know how to load .prj files. I have a universal 3d object converter so it doesnt matter what format the 3d object is in, but I would prefer prj.
I need to know how to load these files, for this is the first step! Here is a list of things i need to know.
1. how to alpha blend textures (eg. flash character red when hit)
2. how to create a land "matrix" eg, all points connected to make a mesh, a kind of simulated landscape.
Heh, terrain is easy:
Sub MakeSomeTerrain()
Dim Terrain(50, 50) As WHATEVER_VERTEX
Dim i As Long
Dim j As Long
For i = 0 To 49
For j = 0 To 49
Terrain(i, j) = MakeVertex(i, Rnd() * 6, j)
Next j
Next i
End Sub
Function MakeVertex(X As Single, Y As Single, Z As Single) As WHATEVER_VERTEX
MakeVertex.X = X
MakeVertex.Y = Y
MakeVertex.Z = Z
End Function
I dont know anything about OGL, but you should have a
function to draw from an array. You probably wont be
able to draw from a 2d array, but im sure you can
modify the code to stick it into a regular array.
If you want the code to take a BMP and turn it into an
array, ive got that too
Z.
Sastraxi
Mar 8th, 2001, 05:45 PM
What GLBegin code (what parameter) would I use to create the land-mesh effect? And yes, the code to create an elevation grid from a BMP would be useful as well.
I'm kinda new to OGL, so most of the things I do dont work.. could you give me some examples to what I ask for???
Sastraxi
Mar 8th, 2001, 06:07 PM
Also, I am working on spinning a triangle, but for some reason the triangle moves to the top and bottom but in the end stays in the same place....
The strange thing is that not just 1 vertex is staying in the same place, they are all moving.
I dont know anything about OGL, but, for the BMP thing:
dx = 1
i = 0
Y = 0
Do While Count < Terrain.bmHeight * Terrain.bmWidth
i = i + dx
MyVerticies(Count) = MakeVertex(CSng(i), CSng((GetPixel(frmMain.hdc, i, Y) / BaseColor) / 100), CSng(Y), vbBlack, 0, 0)
MyVerticies(Count + 1) = MakeVertex(CSng(i), CSng((GetPixel(frmMain.hdc, i, Y + 1) / BaseColor) / 100), CSng(Y + 1), vbBlack, 0, 0)
Count = Count + 2
If i >= Terrain.bmWidth Or i <= 0 Then
dx = -dx
Y = Y + 1
End If
Loop
frmMain.hdc can be replaced with a memory DC, or
whatever. This creates a strip of triangles that snake
back and forth. This also allows for easy collision
detection while walking on the terrain. If you have a 2d
array, you can just round the player's position, and get
the height values.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.