Vertex/image shading (in 2d, based on faked 3d..)

BlitzMax Forums/BlitzMax Programming/Vertex/image shading (in 2d, based on faked 3d..)

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This looks like you could use a psudo 3d coordinate system projected onto 2d like those used by isometric engines, although it's probably easier to pre-render tiles in 3d then just draw them in place with lighting?
That is entirely unfeasible. My maps can have a huge range of different heights, from zone to zone. Also, being able to change the height of any tile in realtime is a big plus.

Great, Warpy, I will try this soon.

Like I said, I have all four positions of the quad for a tile, and I render them using the image frame in a TImage (same code from the TImageFrame.Draw method, but I needed to define the points exactly without transformation):
'DirectX (notice the large slowdown because I have to get the driver each tile render - for OpenGL all I need is the imageframe)
Local dxframe:TD3D7ImageFrame, gpx:TD3D7Max2DDriver
dxframe = TD3D7ImageFrame(iframe)
gpx = TD3D7Max2DDriver(TMax2DGraphics.Current()._driver)

Local uv:Float Ptr, c:Int Ptr
uv = dxframe.xyzuv
c = Int Ptr(uv)

uv[0] = _matrix.topleft.x
uv[1] = _matrix.topleft.y
c[3] = gpx.drawcolor
uv[6] = _matrix.topright.x
uv[7] = _matrix.topright.y
c[9] = gpx.drawcolor

uv[12] = _matrix.bottomleft.x
uv[13] = _matrix.bottomleft.y
c[15] = gpx.drawcolor

uv[18] = _matrix.bottomright.x
uv[19] = _matrix.bottomright.y
c[21] = gpx.drawcolor

gpx.SetActiveFrame(dxframe)
gpx.device.DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1, uv, 4, 0)


'OpenGL
glEnable(GL_TEXTURE_2D)
glBindTexture(GL_TEXTURE_2D, glframe.name)
glBegin(GL_QUADS)

glTexCoord2f(0.0, 0.0)
glVertex2f(_matrix.topleft.x, _matrix.topleft.y)

glTexCoord2f(1.0, 0.0)
glVertex2f(_matrix.topright.x, _matrix.topright.y)

glTexCoord2f(1.0, 1.0)
glVertex2f(_matrix.bottomleft.x, _matrix.bottomleft.y)

glTexCoord2f(0.0, 1.0)
glVertex2f(_matrix.bottomright.x, _matrix.bottomright.y)

glEnd()
glDisable(GL_TEXTURE_2D)


Since I have access to each vertex of the quad, would it look best to give color to each vertex instead of the whole tile? (somehow I think it wouldn't)

Will try! Thanks.