Hi
I'm trying to create a simple skybox for my world. Based on world files
found on the net and created with the hammer editor I wrote the code below.
The problem: when rotating the camera, 5 of 6 textures are frozed (not
updated while camera is moving, but shown after program start) when polygon
lighting is off:
walls_state->SetPolygonFlags(CS_POLYRANGE_LAST, CS_POLY_LIGHTING, 0);
The same error occurs when I'm using a world file.
// textures are windows bitmap files, 512x512 pixel
m_pLoader->LoadTexture("skybox_f", "/data/ms2_f.bmp");
m_pLoader->LoadTexture("skybox_l", "/data/ms2_l.bmp");
m_pLoader->LoadTexture("skybox_b", "/data/ms2_b.bmp");
m_pLoader->LoadTexture("skybox_r", "/data/ms2_r.bmp");
m_pLoader->LoadTexture("skybox_u", "/data/ms2_u.bmp");
m_pLoader->LoadTexture("skybox_d", "/data/ms2_d.bmp");
m_pSector = m_pEngine->CreateSector("room");
csRef<iMeshWrapper> walls = m_pEngine->CreateSectorWallsMesh(m_pSector,
"walls");
csRef<iThingState> ws = SCF_QUERY_INTERFACE (walls->GetMeshObject(),
iThingState);
csRef<iThingFactoryState> walls_state = ws->GetFactory();
int iIdx = walls_state->AddInsideBox(csVector3(-400, -400, -400),
csVector3(400, 400, 400));
walls_state->SetPolygonMaterial(CS_POLYRANGE_SINGLE(iIdx),
m_pEngine->GetMaterialList()->FindByName("skybox_b"));
walls_state->SetPolygonMaterial(CS_POLYRANGE_SINGLE(iIdx+1),
m_pEngine->GetMaterialList()->FindByName("skybox_r"));
walls_state->SetPolygonMaterial(CS_POLYRANGE_SINGLE(iIdx+2),
m_pEngine->GetMaterialList()->FindByName("skybox_f"));
walls_state->SetPolygonMaterial(CS_POLYRANGE_SINGLE(iIdx+3),
m_pEngine->GetMaterialList()->FindByName("skybox_l"));
walls_state->SetPolygonMaterial(CS_POLYRANGE_SINGLE(iIdx+4),
m_pEngine->GetMaterialList()->FindByName("skybox_d"));
walls_state->SetPolygonMaterial(CS_POLYRANGE_SINGLE(iIdx+5),
m_pEngine->GetMaterialList()->FindByName("skybox_u"));
walls_state->SetPolygonTextureMapping(CS_POLYRANGE(iIdx, iIdx+3),
csVector2(1, 1), csVector2(0, 1), csVector2(0, 0));
walls_state->SetPolygonTextureMapping(CS_POLYRANGE_SINGLE(iIdx+4),
csVector2(1, 1), csVector2(0, 1), csVector2(0, 0));
walls_state->SetPolygonTextureMapping(CS_POLYRANGE_SINGLE(iIdx+5),
csVector2(0, 0), csVector2(1, 0), csVector2(1, 1));
walls_state->SetPolygonFlags(CS_POLYRANGE_LAST, CS_POLY_LIGHTING, 0);
m_pSector = m_pEngine->FindSector("room");
csRef<iLight> light;
iLightList* ll = m_pSector->GetLights();
light = m_pEngine->CreateLight(0, csVector3(0, 0, 0), 100, csColor(1, 1,
1));
ll->Add(light);
m_pView = csPtr<iView>(new csView(m_pEngine, m_pG3D));
m_pView->GetCamera()->SetSector(m_pSector);
m_pView->GetCamera()->GetTransform().SetOrigin(csVector3(0, 10, 0));
m_pG2D= m_pG3D->GetDriver2D();
m_pG2D->SetClipRect(0, 0, m_pG2D->GetWidth(), m_pG2D->GetHeight ());
m_pView->SetRectangle(0, 0, m_pG2D->GetWidth(), m_pG2D->GetHeight ());
CS Version: 0.98r004
Compiled with VS.NET 2003, wksnewrenderer (debug)
Shell messages:
SCF_WARNING: class crystalspace.graphics3d.opengl has already been
registered in the same context ('crystalspace')
SCF_WARNING: class crystalspace.graphics3d.null has already been registered
in the same context ('crystalspace')
SCF_WARNING: class crystalspace.graphics3d.software has already been
registeredin the same context ('crystalspace')
crystalspace.canvas.openglwin:
Using 32 bits per pixel (16777216 color mode), 24 bits depth buffer.
GL driver: atioglxx.dll 6.14.10.4830
crystalspace.canvas.openglcommon.driverdb:
Applied: Work around broken ATI point sprites
crystalspace.canvas.openglcommon:
OpenGL renderer: MOBILITY RADEON 9200 DDR x86/SSE2 (vendor: ATI
Technologies
Inc.) version 1.3.4830 WinXP Release
Using windowed mode at resolution 1024x768.
crystalspace.canvas.openglwin:
VSync is disabled.
crystalspace.graphics3d.shadermgr:
Loaded compilerplugin crystalspace.graphics3d.shadercompiler.xmlshader,
compiler: XMLShader
crystalspace.graphics3d.shader.fixed:
Multitexture units: acceptable 6
crystalspace.engine.notify:
Lightmaps are not up to date (no 'lm_precalc_info' found in cache).
Recalculation of lightmaps forced.
Initializing lighting (1 meshes).
Shining lights (1 lights).
Time taken: 0.0890 seconds.
CS Console messages:
crystalspace.canvas.openglwin: Using 32 bits per pixel (16777216 color
mode), 24 bits depth buffer.
crystalspace.canvas.openglwin: GL driver: atioglxx.dll 6.14.10.4830
crystalspace.canvas.openglcommon.driverdb: Applied: Work around broken ATI
point sprites
crystalspace.canvas.openglcommon: OpenGL renderer: MOBILITY RADEON 9200
DDRx86/SSE2 (vendor: ATI Technologies Inc.) version 1.3.4830 WinXP Release
crystalspace.canvas.openglcommon: Using windowed mode at resolution
1024x768.
crystalspace.canvas.openglwin: VSync is disabled.
crystalspace.graphics3d.shadermgr: Loaded compilerplugin
crystalspace.graphics3d.shadercompiler.xmlshader, compiler: XMLShader
crystalspace.graphics3d.shader.fixed: Multitexture units: acceptable 6
crystalspace.engine.notify: Lightmaps are not up to date (no
'lm_precalc_info' found in cache).
crystalspace.engine.notify: Recalculation of lightmaps forced.
crystalspace.engine.notify: Initializing lighting (1 meshes).
crystalspace.engine.notify: Shining lights (1 lights).
crystalspace.engine.notify: Time taken: 0.0940 seconds.
--
Geschenkt: 3 Monate GMX ProMail gratis + 3 Ausgaben stern gratis
++ Jetzt anmelden & testen ++ http://www.gmx.net/de/go/promail ++
|