Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 04 May 2012
Offline Last Active May 07 2012 05:46 AM

Topics I've Started

[Blitz3D] Help with texturing mesh/surface

04 May 2012 - 10:33 AM

I have a problem about textures in Blitz3D. I've made this code:



vMap0=AddVertex(srfMap,(ImageWidth(gfxMap) / 2) - ImageWidth(gfxMap),0,(ImageHeight(gfxMap) / 2) - ImageHeight(gfxMap))
vMap1=AddVertex(srfMap,(ImageWidth(gfxMap) / 2) - ImageWidth(gfxMap),0,ImageHeight(gfxMap) / 2)
vMap2=AddVertex(srfMap,ImageWidth(gfxMap) / 2,0,(ImageHeight(gfxMap) / 2) - ImageHeight(gfxMap))
vMap3=AddVertex(srfMap,ImageWidth(gfxMap) / 2,0,ImageHeight(gfxMap) / 2)



BrushTexture brsMap,texMap
PaintMesh mshMap,brsMap

camMain = CreateCamera()

lgtMap = CreateLight()
MoveEntity lgtMap,0,100,0
PointEntity lgtMap,mshMap

It takes an image from the gfx\map directory, called politics.png. The image is exactly 1357x628 in size.
The next part of the code generates a mesh, which consists of a single surface, which consist of two triangles, which toghether make out the exact same size and shape of politics.png.
Then I make a brush textured with politics.png and paint the mesh with it. The rest explains itself I think, but the problem is that when I debug the code, the following show up:
Posted Image

It seem to show one of the triangles as a blue face. And when I position the camera below the surface, I can see that the other triangle is also blue, but the first is black! i.e. first triangle is blue on the top and black on the bottom, second black on the top and blue on the bottom! :S
I cannot figure out what is wrong. I also tried to comment the CreateBrush, and BrushTexture lines out, and replace PaintMesh with EntityTexture; but that gave me the same result. :S
It's supposed to just fill the politics.png in the flat box formed by the two triangles. :S
Plz tell me what is wrong... :S :S :S