Jump to content

CreateCube() doesn't create a mesh


xtreampb
 Share

Recommended Posts

I've got an interesting little problem here.

 

my CreateCube() functions don't seam to want to create a mesh. idk if it's the VM i'm using or what. bellow is my code

DebugPhysics(true);

TBody ground=CreateBodyBox(10,0.1,10);
TMesh groundMesh=CreateCube();
ScaleEntity(groundMesh,Vec3(10,0.1,10));
EntityParent(groundMesh,ground);

TBody ground2=CreateBodyBox(10,0.1,10);
TMesh groundMesh2=CreateCube();
ScaleEntity(groundMesh2,Vec3(10,0.1,10));
EntityParent(groundMesh2,ground2);
EntityType(ground2,1);

PositionEntity(ground2,Vec3(10,-20,0));
RotateEntity(ground2,Vec3(0,0,45));

TBody ground3=CopyEntity(ground);
PositionEntity(ground3,Vec3(0,-25,0));

 

here is the engine log

 

Leadwerks Engine 2.5

Initializing Renderer...

OpenGL Version: 2.1 Chromium 1.9

GLSL Version: 1.20

Render device: Chromium

Vendor: Humper

DrawBuffers2 supported: 0

16 texture units supported.

GPU instancing supported: 0

Shader model 4.0 supported: 0

Conditional render supported: 0

Loading shader "zip::c:/documents and settings/tss llc leadwerks/desktop/leason 5/leason 5/shaders.pak//query.vert", ""...

Loading shader "zip::c:/documents and settings/tss llc leadwerks/desktop/leason 5/leason 5/shaders.pak//guide.vert", "zip::c:/documents and settings/tss llc leadwerks/desktop/leason 5/leason 5/shaders.pak//guide.frag"...

Loading shader "zip::c:/documents and settings/tss llc leadwerks/desktop/leason 5/leason 5/shaders.pak//mesh/mesh_shadow.vert", ""...

Loading shader "zip::c:/documents and settings/tss llc leadwerks/desktop/leason 5/leason 5/shaders.pak//mesh/mesh.vert", "zip::c:/documents and settings/tss llc leadwerks/desktop/leason 5/leason 5/shaders.pak//mesh/mesh.frag"...

Loading shader "zip::c:/documents and settings/tss llc leadwerks/desktop/leason 5/leason 5/shaders.pak//postfilters/postfilter.vert", "zip::c:/documents and settings/tss llc leadwerks/desktop/leason 5/leason 5/shaders.pak//postfilters/depthblit.frag"...

Loading texture "incbin::noise.dds"...

Loading shader "zip::c:/documents and settings/tss llc leadwerks/desktop/leason 5/leason 5/shaders.pak//postfilters/postfilter.vert", "zip::c:/documents and settings/tss llc leadwerks/desktop/leason 5/leason 5/shaders.pak//lighting/directionallight.frag"...

Terminate function

 

 

anyone got any ideas. My VM is Virtual box. 3D accelleration is on as well as 2d and have 128 MBs of VRAM and 2.5 GBs of RAM. anyone got any ideas of how to solve this issue

 

thanks,

 

Xtreampb

bool Life()
{
 while(death=false)
 {
   if(death==true)
   return death;
 }
}

 

I have found the secret to infinite life

 

Did I help you out? Like my post!

Link to comment
Share on other sites

I dont know what the rest of your code looks like, but your meshes are created

 

Here is your code in a working sample

 

//	====================================================================
//	This file was generated by LEBuilder
//	http://leadwerks.com/werkspace
//	====================================================================

#include "engine.h"
#include <iostream>
#include <string>

const int 	ScreenWidth = 800;
const int 	ScreenHeight = 600;
const char* AppTitle = "test";

void ErrOut( const std::string& message ) { std::cerr << message << std::endl; }

//	-------------------------------
int main( int argn, char* argv[] )
{
// Initialize
if( !Initialize() )
	return 1;        
SetAppTitle( AppTitle ) ;

// Set graphics mode        
if( !Graphics(ScreenWidth,ScreenHeight) )
{                
	ErrOut( "Failed to set graphics mode."  );
	return 1;        
}

// Create framework object and set it to a global object so other scripts can access it
TFramework fw = CreateFramework();        
if( fw == NULL )        
{
	ErrOut( "Failed to initialize engine." );                
	return 1;        
}        

// Set Lua framework object        
SetGlobalObject( "fw", fw );                

// Set Lua framework variable        
BP lua = GetLuaState();        
lua_pushobject( lua, fw );        
lua_setglobal( lua, "fw" );        
lua_pop( lua, 1 );        

// Get framework main camera        
TCamera camera = GetLayerCamera( GetFrameworkLayer(0) );        
PositionEntity( camera, Vec3(0,10,-60) );        

// Add some light
TLight light = CreateDirectionalLight();        
RotateEntity( light, Vec3(45,45,45) );        

//	-----------------------------------------
DebugPhysics(true);        


TBody ground=CreateBodyBox(10,0.1,10);        
TMesh groundMesh=CreateCube();        
ScaleEntity(groundMesh,Vec3(10,0.1,10));        
EntityParent(groundMesh,ground);        

TBody ground2=CreateBodyBox(10,0.1,10);
TMesh groundMesh2=CreateCube();        
ScaleEntity(groundMesh2,Vec3(10,0.1,10));        
EntityParent(groundMesh2,ground2);        

EntityType(ground2,1);        
PositionEntity(ground2,Vec3(10,-20,0));        

RotateEntity(ground2,Vec3(0,0,45));        
TBody ground3=CopyEntity(ground);        
PositionEntity(ground3,Vec3(0,-25,0));
//	-----------------------------------------

while( !KeyHit() && !AppTerminate() )        
{                
	if( !AppSuspended() )
	{
		UpdateFramework();                
		RenderFramework();                

		Flip( 0 );        
	}
}                

return Terminate();
}

 

And here is the output

 

AV MX Linux

Link to comment
Share on other sites

I copied and pasted your code and got an runtime error at Flip();

 

here is my entire code

 

#include "engine.h"

//#include "Level1.h"

#include <math.h>

#define PI  3.141592654



void ChangeColor(float &, float &, float &, int );



static int count=2;

bool add=true;



int main(int argc, char** argv)

{

Initialize();



Graphics(800,600);



CreateWorld();

if(!CreateWorld())

{

	MessageBoxA(0,"ERROR","FAILED TO CREATE WORLD",0);

	goto exitapp;

}





TCamera cam=CreateCamera();

CameraClearColor(cam,Vec4(0,0,1,1));

MoveEntity(cam,Vec3(0,0,-5));



TLight light=CreateDirectionalLight();

RotateEntity(light,Vec3(65,45,0));



TBuffer buffer=CreateBuffer(800,600,BUFFER_COLOR|BUFFER_DEPTH|BUFFER_NORMAL);



TBody body=CreateBodyBox();

SetBodyMass(body,1);

TMesh box1=CreateCube();

EntityParent(box1,body);



float red=0.0;

float green=0.0;

float blue=0.0;



DebugPhysics(true);



TBody ground=CreateBodyBox(10,0.1,10);

TMesh groundMesh=CreateCube();

ScaleEntity(groundMesh,Vec3(10,0.1,10));

EntityParent(groundMesh,ground);



TBody ground2=CreateBodyBox(10,0.1,10);

TMesh groundMesh2=CreateCube();

ScaleEntity(groundMesh2,Vec3(10,0.1,10));

EntityParent(groundMesh2,ground2);

EntityType(ground2,1);



PositionEntity(ground2,Vec3(10,-20,0));

RotateEntity(ground2,Vec3(0,0,45));



TBody ground3=CopyEntity(ground);

PositionEntity(ground3,Vec3(0,-25,0));



//SetFluidPlane(Vec4(0),1);



TBody box2=CreateBodyBox();

SetBodyMass(box2,1);

TMesh BoxMesh=CreateCube();



EntityParent(BoxMesh,box2);

PositionEntity(box2,Vec3(0.5,100,0.5));

EntityType(box2,1);



PositionEntity(ground,Vec3(0,-3,0));



EntityType(body,1);

EntityType(ground,1);

EntityType(ground3,1);

Collisions(1,1,1);





//DebugPhysics(true);



PositionEntity(cam,Vec3(0,5,-10));

RotateEntity(cam,Vec3(45,0,0));

float x=0;

float z=0;

dropBox:

{

	for(int i=1; i<=100;i++)

	{

		body=CopyEntity(box2);

		x=-5+((float)rand()/RAND_MAX)*10;

		z=-5+((float)rand()/RAND_MAX)*10;

		ScaleEntity(body,Vec3(x,1,z));

		SetBodyMass(body,i);

		PositionEntity(body,Vec3(x,i,z));

	}

}	

while(!KeyHit(KEY_ESCAPE))

{

 		if(KeyDown(KEY_SPACE))

	{

		if(count==24)

		{

			add=false;

		}

		else if(count==1)

		{

			add=true;

		}



		TurnEntity(ground,Vec3(0,0,-10));



		ChangeColor(red, green, blue, count);

		if (add)

			count++;

		else if(!add)

			count--;



		CameraClearColor(cam,Vec4(red,green,blue,1));

	}

	if(KeyHit(KEY_ENTER))

		goto dropBox;



	UpdateAppTime();

	UpdateWorld();

	SetBuffer(buffer);

	RenderWorld();

	SetBuffer(BackBuffer());

	RenderLights(buffer);

	Flip();

}

exitapp:

Terminate();

return 0;

}



void ChangeColor(float &red, float &green, float &blue, int count)

{

float x=PI/count;



red=sin(x+PI/2);

//green=cos(x+PI/2);

blue=sin(1.5*x);//==sin((PI/count)-PI);

/*

if(red<0)

	red=0;

if(green<0)

	green=0;

if(blue<0)

	blue=0;

*/

}

bool Life()
{
 while(death=false)
 {
   if(death==true)
   return death;
 }
}

 

I have found the secret to infinite life

 

Did I help you out? Like my post!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...