Crystal Space
Welcome,
Guest
. Please
login
or
register
.
May 25, 2013, 11:58:03 pm
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
9224
Posts in
2230
Topics by
5390
Members
Latest Member:
Okvepkke6
Crystal Space
Crystal Space Project Development
Bug Reports
CVS simple seg. fault
« previous
next »
Pages:
[
1
]
Author
Topic: CVS simple seg. fault (Read 5994 times)
Sl0w
Newbie
Posts: 7
CVS simple seg. fault
«
on:
July 21, 2005, 10:34:18 am »
Heyya, to reproduce it, modify the simple1.cpp so you replace the line
walls_state->AddInsideBox (csVector3 (-30, 0, -30), csVector3 (30, 20, 30));
with
walls_state->AddQuad(csVector3(-15, -10, -5), csVector3(6, -10, -5), csVector3(6,10,-5), csVector3(-10,10, -5));
walls_state->AddQuad(csVector3(-10, 10, 15), csVector3(6, 10, 15), csVector3(6,-10,15), csVector3(-15,-10, 15));
.
It works ok if you only add one mesh to the sector, if you add more it seg. faults, at least for me.
Logged
jorrit
Administrator
Hero Member
Posts: 1703
Re: CVS simple seg. fault
«
Reply #1 on:
July 21, 2005, 07:01:01 pm »
Quote from: Sl0w on July 21, 2005, 10:34:18 am
Heyya, to reproduce it, modify the simple1.cpp so you replace the line
walls_state->AddInsideBox (csVector3 (-30, 0, -30), csVector3 (30, 20, 30));
with
walls_state->AddQuad(csVector3(-15, -10, -5), csVector3(6, -10, -5), csVector3(6,10,-5), csVector3(-10,10, -5));
walls_state->AddQuad(csVector3(-10, 10, 15), csVector3(6, 10, 15), csVector3(6,-10,15), csVector3(-15,-10, 15));
.
It works ok if you only add one mesh to the sector, if you add more it seg. faults, at least for me.
Can you show me the code that you use to add more meshes?
Greetings,
Logged
Sl0w
Newbie
Posts: 7
Re: CVS simple seg. fault
«
Reply #2 on:
July 22, 2005, 10:39:01 am »
This is the relevant part:
void Simple::CreateRoom ()
{
// Load the texture from the standard library. This is located in
// CS/data/standard.zip and mounted as /lib/std using the Virtual
// File System (VFS) plugin.
if (!loader->LoadTexture ("stone", "/lib/std/stone4.gif"))
ReportError("Error loading 'stone4' texture!");
iMaterialWrapper* tm = engine->GetMaterialList ()->FindByName ("stone");
// We create a new sector called "room".
room = engine->CreateSector ("room");
// Creating the walls for our room.
csRef<iMeshWrapper> walls (engine->CreateSectorWallsMesh (room, "walls"));
csRef<iThingState> ws =
SCF_QUERY_INTERFACE (walls->GetMeshObject (), iThingState);
csRef<iThingFactoryState> walls_state = ws->GetFactory ();
walls_state->AddQuad(csVector3(6, -10, 10), csVector3(6,10,10), csVector3(6,10,-5), csVector3(6,-10,-5));
walls_state->AddQuad(csVector3(-15, -10, -5), csVector3(6, -10, -5), csVector3(6,10,-5), csVector3(-10,10, -5));
walls_state->SetPolygonMaterial (CS_POLYRANGE_LAST, tm);
walls_state->SetPolygonTextureMapping (CS_POLYRANGE_LAST, 3);
// Now we need light to see something.
csRef<iLight> light;
iLightList* ll = room->GetLights ();
light = engine->CreateLight(0, csVector3(-3, 5, 0), 10, csColor(1, 0, 0));
ll->Add (light);
light = engine->CreateLight(0, csVector3(3, 5, 0), 10, csColor(0, 0, 1));
ll->Add (light);
light = engine->CreateLight(0, csVector3(0, 5, -3), 10, csColor(0, 1, 0));
ll->Add (light);
}
it seg. faults when I want to add more than one mesh to a sector. with or without lighting. The rest of the code is the same as in simple1.cpp
Logged
jorrit
Administrator
Hero Member
Posts: 1703
Re: CVS simple seg. fault
«
Reply #3 on:
July 22, 2005, 10:40:43 am »
The problem is in these calls:
Code:
walls_state->SetPolygonMaterial (CS_POLYRANGE_LAST, tm);
walls_state->SetPolygonTextureMapping (CS_POLYRANGE_LAST, 3);
These will only set the material and texture mapping for the last added thing. In your case that is the last quad. You need to use CS_POLYRANGE_ALL instead of LAST.
Greetings,
Logged
Sl0w
Newbie
Posts: 7
Re: CVS simple seg. fault
«
Reply #4 on:
July 22, 2005, 11:08:41 am »
Hmm, sorry 'bout that. workes sweet now.
Logged
Pages:
[
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Crystal Space Development
-----------------------------
=> General Crystal Space Discussion
=> Support
-----------------------------
Crystal Space Project Development
-----------------------------
=> Feature Requests
=> Plugins
=> Bug Reports
-----------------------------
Crystal Space Development
-----------------------------
=> Game Content Creation
-----------------------------
Miscellaneous
-----------------------------
=> Article/Tutorial Requests
=> Article/Tutorial Discussion
-----------------------------
Crystal Space Project Development
-----------------------------
=> Development Discussion
-----------------------------
Crystal Space Projects
-----------------------------
=> Project Discussion
=> WIP Projects
=> Finished Projects
-----------------------------
Associate Projects
-----------------------------
=> CEL Discussion
=> Crystal Core Discussion
=> CrystalBlend Discussion
-----------------------------
Crystal Space Project Development
-----------------------------
=> Google Summer of Code
-----------------------------
Associate Projects
-----------------------------
=> Apricot (Open Game)
=> Ares Project
Loading...