Crystal Space
Welcome, Guest. Please login or register.
October 30, 2014, 03:13:50 pm

Login with username, password and session length
Search:     Advanced search
9011 Posts in 2044 Topics by 8882 Members
Latest Member: Susiesmith5
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Can't see texture loaded
« previous next »
Pages: [1] Print
Author Topic: Can't see texture loaded  (Read 3973 times)
SoulRaiden
Guest


Email
« on: January 04, 2006, 06:11:57 am »

I'm a linux user and when I try to run the simple tutorial 5.2.3, the project compile but nothing is visible into the window.

Can someone help me ?
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: January 04, 2006, 07:50:02 am »

I'm a linux user and when I try to run the simple tutorial 5.2.3, the project compile but nothing is visible into the window.

Can someone help me ?


Can you show me the code you're using?

Greetings,
Logged
soulraiden
Guest


Email
« Reply #2 on: January 04, 2006, 08:25:23 am »

This is the code for simple.cpp

Code:
#include "cssysdef.h"
#include "csutil/sysfunc.h"
#include "iutil/vfs.h"
#include "csutil/cscolor.h"
#include "cstool/csview.h"
#include "cstool/initapp.h"
#include "simple.h"
#include "iutil/eventq.h"
#include "iutil/event.h"
#include "iutil/objreg.h"
#include "iutil/csinput.h"
#include "iutil/virtclk.h"
#include "iengine/sector.h"
#include "iengine/engine.h"
#include "iengine/camera.h"
#include "iengine/light.h"
#include "iengine/texture.h"
#include "iengine/mesh.h"
#include "iengine/movable.h"
#include "iengine/material.h"
#include "imesh/thing.h"
#include "imesh/object.h"
#include "ivideo/graph3d.h"
#include "ivideo/graph2d.h"
#include "ivideo/texture.h"
#include "ivideo/material.h"
#include "ivideo/fontserv.h"
#include "igraphic/imageio.h"
#include "imap/loader.h"
#include "ivaria/reporter.h"
#include "ivaria/stdrep.h"
#include "csutil/cmdhelp.h"
#include "csutil/event.h"

CS_IMPLEMENT_APPLICATION

// The global pointer to simple
Simple* simple = 0;

Simple::Simple (iObjectRegistry* object_reg)
{
  Simple::object_reg = object_reg;
}

Simple::~Simple ()
{
}

bool Simple::HandleEvent (iEvent& ev)
{
  if (ev.Type == csevKeyboard &&
    csKeyEventHelper::GetEventType (&ev) == csKeyEventTypeDown &&
    csKeyEventHelper::GetCookedCode (&ev) == CSKEY_ESC)
  {
    csRef<iEventQueue> q (CS_QUERY_REGISTRY (object_reg, iEventQueue));
    if (q)
      q->GetEventOutlet()->Broadcast (cscmdQuit);
    return true;
  }
  return false;
}

bool Simple::SimpleEventHandler (iEvent& ev)
{
  return simple ? simple->HandleEvent (ev) : false;
}


bool Simple::Initialize ()
{

  if (!csInitializer::SetupEventHandler( object_reg, SimpleEventHandler))
  {
    csReport (object_reg, CS_REPORTER_SEVERITY_ERROR,"crystalspace.application.simple",
    "Can't initialize event handler!");
    return false;
  }

  if (!csInitializer::RequestPlugins (object_reg,
        CS_REQUEST_VFS,
        CS_REQUEST_OPENGL3D,
        CS_REQUEST_ENGINE,
        CS_REQUEST_FONTSERVER,
        CS_REQUEST_IMAGELOADER,
        CS_REQUEST_LEVELLOADER,
        CS_REQUEST_REPORTER,
        CS_REQUEST_REPORTERLISTENER,
        CS_REQUEST_END))
  {
    csReport (object_reg, CS_REPORTER_SEVERITY_ERROR,
        "crystalspace.application.simple",
        "Can't initialize plugins!");
    return false;
  }



  csReport (object_reg, CS_REPORTER_SEVERITY_NOTIFY,
        "crystalspace.application.simple",
        "Simple Crystal Space Application version 0.1.");
  // Check for commandline help.
  if (csCommandLineHelper::CheckHelp (object_reg))
  {
    csCommandLineHelper::Help (object_reg);
    return false;
  }

  // The virtual clock.
  vc = CS_QUERY_REGISTRY (object_reg, iVirtualClock);
  if (!vc)
  {
    csReport (object_reg, CS_REPORTER_SEVERITY_ERROR,
        "crystalspace.application.simple",
        "Can't find the virtual clock!");
    return false;
  }

  // Find the pointer to engine plugin
  engine = CS_QUERY_REGISTRY (object_reg, iEngine);
  if (!engine)
  {
    csReport (object_reg, CS_REPORTER_SEVERITY_ERROR,
        "crystalspace.application.simple",
        "No iEngine plugin!");
    return false;
  }

  loader = CS_QUERY_REGISTRY (object_reg, iLoader);
  if (!loader)
  {
    csReport (object_reg, CS_REPORTER_SEVERITY_ERROR,
        "crystalspace.application.simple",
        "No iLoader plugin!");
    return false;
  }

  g3d = CS_QUERY_REGISTRY (object_reg, iGraphics3D);
  if (!g3d)
  {
    csReport (object_reg, CS_REPORTER_SEVERITY_ERROR,
        "crystalspace.application.simple",
        "No iGraphics3D plugin!");
    return false;
  }

  kbd = CS_QUERY_REGISTRY (object_reg, iKeyboardDriver);
  if (!kbd)
  {
    csReport (object_reg, CS_REPORTER_SEVERITY_ERROR,
        "crystalspace.application.simple",
        "No iKeyboardDriver plugin!");
    return false;
  }

  // Open the main system. This will open all the previously
  // loaded plug-ins.
  if (!csInitializer::OpenApplication (object_reg))
  {
    csReport (object_reg, CS_REPORTER_SEVERITY_ERROR,
        "crystalspace.application.simple",
        "Error opening system!");
    return false;
  }

 
  // First disable the lighting cache. Our app is simple enough
  // not to need this.
  engine->SetLightingCacheMode (0);

  // 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"))
  {
    csReport (object_reg, CS_REPORTER_SEVERITY_ERROR,
        "crystalspace.application.simple",
        "Error loading 'stone4' texture!");
    return false;
  }
  iMaterialWrapper* tm =
    engine->GetMaterialList ()->FindByName ("stone");

  // these are used store the current orientation of the camera
  rotY = rotX = 0;

  room = engine->CreateSector ("room");
  csRef<iMeshWrapper> walls (
    engine->CreateSectorWallsMesh (room, "walls"));
  csRef<iThingState> thing_state (
    SCF_QUERY_INTERFACE (walls->GetMeshObject (), iThingState));
  iThingFactoryState* walls_state = thing_state->GetFactory ();
  walls_state->AddInsideBox (
    csVector3 (-5, 0, -5), csVector3 (5, 20, 5));
  walls_state->SetPolygonMaterial (CS_POLYRANGE_LAST, tm);
  walls_state->SetPolygonTextureMapping (CS_POLYRANGE_LAST, 3);

  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);
 

  view = csPtr<iView> (new csView (engine, g3d));
  view->GetCamera ()->SetSector (room);
  view->GetCamera ()->GetTransform ().SetOrigin (csVector3 (0, 5, -3));
  iGraphics2D* g2d = g3d->GetDriver2D ();
  view->SetRectangle (0, 0, g2d->GetWidth (), g2d->GetHeight ());
  engine->Prepare ();


  return true;
}



void Simple::SetupFrame ()
{
  // Tell 3D driver we're going to display 3D things.
  if (!g3d->BeginDraw(
    engine->GetBeginDrawFlags() | CSDRAW_3DGRAPHICS))
    return;

  // Tell the camera to render into the frame buffer.
  view->Draw ();
}

void Simple::FinishFrame ()
{
  g3d->FinishDraw ();
  g3d->Print (0);
}

void Simple::Start ()
{
  csDefaultRunLoop (object_reg);
}

/*---------------*
 * Main function
 *---------------*/
int main (int argc, char* argv[])
{
  iObjectRegistry* object_reg =
    csInitializer::CreateEnvironment (argc, argv);
  if (!object_reg) return -1;

  simple = new Simple (object_reg);
  if (simple->Initialize ())
    simple->Start ();
  delete simple;
  simple = 0;

  csInitializer::DestroyApplication (object_reg);
  return 0;
}


Thanks
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #3 on: January 04, 2006, 08:33:32 am »

Hmm looks ok. You just see a black screen? What version of CS?

Greetings,
Logged
SoulRaiden
Guest


Email
« Reply #4 on: January 04, 2006, 09:34:09 am »

CS version is 0.99.
I use gentoo linux with a nvidia 6200.


Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #5 on: January 04, 2006, 09:41:16 am »

CS version is 0.99.
I use gentoo linux with a nvidia 6200.




And the simple1 tutorial as is included with CS itself looks fine? What about walktest and other apps that are included with CS?

Greetings,
Logged
SoulRaiden
Guest


Email
« Reply #6 on: January 04, 2006, 10:29:35 am »

The walktest give me the error that can't load the wall.

In the walktest I see all the sprite but I don't see the texture on the wall.
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #7 on: January 04, 2006, 10:40:18 am »

The walktest give me the error that can't load the wall.

In the walktest I see all the sprite but I don't see the texture on the wall.

Ah ok. So CS in general doesn't seem to work. Can you give me as much information as possible: version of CS, Operating System, compiler, graphics card, driver version, ...

Greetings,
Logged
SoulRaiden
Guest


Email
« Reply #8 on: January 04, 2006, 11:10:33 am »

Gentoo Linux with kernel 2.6.12
Nvidia 6200 driver 1.0.7676
Amd athlon XP 2600
1 Gb Ram
Gcc 4.0
CS 0.99


If I use the walktest with the terrain sample, seems work correctly.
Logged
SoulRaiden
Guest


Email
« Reply #9 on: January 04, 2006, 01:43:27 pm »

I use walktest -relight and I see the texture on the wall.
Logged
dingobloo
Idle Extrordinare.
Global Moderator
Full Member
*****
Posts: 125


View Profile WWW
« Reply #10 on: January 04, 2006, 10:34:04 pm »

i know you shouldn't need it because of the lightmap cache is off an all, but have you tried -relight on your own application?
Logged
soulraiden
Guest


Email
« Reply #11 on: January 05, 2006, 11:26:05 am »

I try in my app but nothing happen
Logged
Scopes
Guest


Email
« Reply #12 on: January 21, 2006, 09:01:23 pm »

I am having the same problem on my system.

Gentoo Linux-2.6.14 (AMD64)
Crystalspace 0.99_pre20050823
NVidia 6800GS
GCC 3.4.4-r1

I'm trying it on my x86 with .98.4 and we'll see what happens, although it seems the jamtemplate createproject script is missing on this version...
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #13 on: January 21, 2006, 09:57:52 pm »

I am having the same problem on my system.

Gentoo Linux-2.6.14 (AMD64)
Crystalspace 0.99_pre20050823
NVidia 6800GS
GCC 3.4.4-r1

I'm trying it on my x86 with .98.4 and we'll see what happens, although it seems the jamtemplate createproject script is missing on this version...

Can you give me the complete output of:

./walktest -verbose=-scf -console

Greetings,
Logged
Scopes
Newbie
*
Posts: 1


View Profile
« Reply #14 on: January 22, 2006, 02:58:24 am »

It would appear that copy/pasting code from the tutorial as one goes along is not the way to go about this. I tried putting in the code from the tutorials/ folder and it worked like a charm.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.189 seconds with 16 queries.