Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperLicht
Multiple MeshBuffer's

icereaper
Registered User
Quote
2011-02-04 17:48:47

Hello, i just started experimenting with CopperLicht and ran into my first problem:
when adding exactly one MeshBuffer i can see the polygons with texture.
Cause i want to draw different polygons with different textures, i created a MeshBuffer for each texture and add all polygons which are using it. but when putting more than one MeshBuffer into a Mesh i get a blank render.

Would be awesome if some1 could help me.

Greetz


niko
Moderator
Quote
2011-02-04 18:36:18

Sounds ok what you are doing, maybe you are missing something or causing an exception or similar. Is there an error message in the javascript console?
Maybe you could post some of your code to see what you did.


icereaper
Registered User
Quote
2011-02-04 19:05:27

i tried building some kind of map-grid. 16x16 squared consisting of 2 triangles (4 vertices) per square. im reading a text file which displays the map with chars. X = solid-wall-texture .=hole W=wall B=destroyable-wall etc... so the map file looks like this:
XXXXX
XBBBX
XBBBX
XBBBX
XXXXX

so i read the map file, and put all vertices information into an json/array:
{
'X': {'indices': [], 'vertices': []},
'H': {'indices': [], 'vertices': []},
'W': {'indices': [], 'vertices': []},
'B': {'indices': [], 'vertices': []},
'.': {'indices': [], 'vertices': []}
}

at last i return that json/array to my render code. each of the different blocks needs a different texture..
so i create a new MeshBuffer for X, one for H etc... because i can only assign one texture (?).

bufs[map.blocks[b]] = new CL3D.MeshBuffer();
this.MyMesh.AddMeshBuffer(bufs[map.blocks[b]]);

when my mapfile consists of only X or only H or only B etc. it works perfect. As soon as i have more than one buffer the scene is empty..
But the funny thing is that the mesh says that it has vertices Oo
Here a screenshot showing left: 1 type, right: multiple types

http://img26.imageshack.us/img26/748/drawbug.jpg


niko
Moderator
Quote
2011-02-05 07:13:19

Sounds still ok to me. I just tried it out, and it works for me, so I guess you are doing something still differently. Maybe posting some more code might help?


icereaper
Registered User
Quote
2011-02-05 10:59:46

EDIT: after hours and hours of debugging i found the problem, was in my script. somehow i forgot to recalculate the indices-number for every buffer.. damn.. Sry for that, was my fault


niko
Moderator
Quote
2011-02-05 18:29:42

Ah, ok, nice :)


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "I?ternational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact