Sign in to follow this  

[Blitz3D] Help with texturing mesh/surface

This topic is 2051 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a problem about textures in Blitz3D. I've made this code:
[CODE]
gfxMap=LoadImage("gfx\map\politics.png")
texMap=LoadTexture("gfx\map\politics.png")

mshMap=CreateMesh()

srfMap=CreateSurface(mshMap)

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)

tMap0=AddTriangle(srfMap,vMap0,vMap1,vMap2)
tMap1=AddTriangle(srfMap,vMap1,vMap2,vMap3)

PositionEntity(mshMap,0,0,0)

brsMap=CreateBrush()
BrushTexture brsMap,texMap
PaintMesh mshMap,brsMap

camMain = CreateCamera()
PositionEntity(camMain,0,100,0)
RotateEntity(camMain,90,0,0)

lgtMap = CreateLight()
MoveEntity lgtMap,0,100,0
PointEntity lgtMap,mshMap
[/CODE]

It takes an image from the [i]gfx\map[/i] directory, called [i]politics.png.[/i] 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 [i]politics.png[/i].
Then I make a brush textured with [i]politics.png[/i] 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:
[img]http://img406.imageshack.us/img406/5904/screenshothwd.png[/img]

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 [i]politics.png [/i]in the flat box formed by the two triangles. :S
Plz tell me what is wrong... :S :S :S

Share this post


Link to post
Share on other sites
I fixed the problem! It seems that when you don't add U/V parameters to the AddVertex command, and the texture is supposed to fill in completely precisely, veeery bad things happen. D:

Share this post


Link to post
Share on other sites

This topic is 2051 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this