Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - matty47

#46
In the light example I can see no difference in the "off", "ambient" ,"multitexture" and "spot" modes. The "bump" and "cartoon" modes do appear to have shadows but I can't say that there is any variation in the light (no attenuation). The shadows example likewise show a shadow but again the rest of the lighting is pretty uniformly lit. Am I expecting too much??
Thanks
MAtthew
#47
No takers???
Matthew
#48
Hi,
please look at the project in the zip
//members.optusnet.com.au/~ingle.m/3droom.zip
When I run this I can see the model OK even though I have not made any lights. If I add a light nothing changes. I think I am missing something fundamental here. (Note I have added extra stuff to the T3DEntity file)
Any help appreciated
Matthew
#49
Code Snippets / Plane Lib
2008-Jan-12
The only bmp I used was a tileable water texture. Any would do. Just adjust the name in the code. I think the original was 256 x 256 pixels but you could use larger. Possible could add a bump texture to make the water look more realistic?
Thanks
Matthew
#50
Hi,
I ran into troubles having MingW installed on my system. GLBasic picks up the wrong compiler/libs and fails to compile properly. I overcame this by removing the environmental variable (c:\MingW\bin in the PATH variable) and renaming the MingW directory (in case there are some entries in the registry) GLBasic then behaved normally. When I want to use MingW I do the reverse.(rename the directory and add the MingW dir to the PATH variable). Bit kludgy but it works
Matthew
#51
Bug Reports / KeyCode 08
2007-Dec-09
Blush, blush
Sorry
Thanks
Matthew
#52
Bug Reports / KeyCode 08
2007-Dec-09
Both return the error. Just the number in the error message changes
Matthew
#53
Bug Reports / KeyCode 08
2007-Dec-09
Hi,
just tried to use Key(08) and Key(09) in a program and the following error appeared for the latter

invalid digit "9" in octal constant

Key(10) seems to work OK
Thanks
Matthew
#54
Thanks for the quick advice
Matthew
#55
I know that color 128,0,255 is treated as transparent when creating images for GLBasic sprites. How do I achieve a "fuzzy" edge for sprites. I created a 128 x 128 png with a pink background. I then drew a white circle on this. I then applied a gaussian blur to geve the edges a blurred effect. When I use this as a sprite there are pink tinges at the edge of the white. (Obviously the blur changes some of the pink background). I also tried doing this with a transparent background. With the transparent background the sprite looked as though it had sharp edges. I must be misunderstanding something. Any help please?
THanks
Matthew
#56
Code Snippets / Plane Lib
2007-Oct-29
Hi, after being inspired by the Entity Library/System on the German forum I have been experimenting with a plane lib. Probably best just to look at the code. You need a texture for the water in the example. Can't remember where I got the camera code but it was on this forum.
The plane library
Code (glbasic) Select
// --------------------------------- //
// Project: Plane
// Start: Sunday, October 28, 2007
// IDE Version: 5.055
//Matthew Ingle - October 2007
//A set of functions to implement a plane object
//Add to as you see fit however share the code!!
TYPE Plane_vertex
plx
ply
plz
tx
tz
col
ENDTYPE

TYPE TPlane
Plane_pts[] AS Plane_vertex
xverts
zverts
smooth
ENDTYPE
//--------------------------------------------//
//! Create a plane of z length, x width and having x and z divisions
//! Use smooth= TRUE to smooth the plane
//! you can reference any vertex by it's x,z number 0 to division -1
//--------------------------------------------//
FUNCTION CreatePlane AS TPlane:length,width,secx,secz,smooth
LOCAL name AS TPlane
LOCAL z_count,x_count
LOCAL delta_x=width/secx
LOCAL delta_z=length/secz
REDIM name.Plane_pts[secx+1][secz+1]
FOR x_count=0 TO secx
FOR z_count=0 TO secz
name.Plane_pts[x_count][z_count].plx=delta_x*x_count
name.Plane_pts[x_count][z_count].ply=0
name.Plane_pts[x_count][z_count].plz=delta_z*z_count
name.Plane_pts[x_count][z_count].tx=MOD(x_count,2)
name.Plane_pts[x_count][z_count].tz=MOD(z_count,2)
name.Plane_pts[x_count][z_count].col=RGB(255,255,255)
NEXT
NEXT
name.smooth=smooth
name.xverts=secx+1
name.zverts=secz+1
RETURN name
ENDFUNCTION

//--------------------------------------//
//!Draw the plane
//--------------------------------------//
FUNCTION DrawPlane:name AS TPlane,objnum
LOCAL ix,iz
X_OBJSTART objnum
FOR ix=0 TO name.xverts-2
X_OBJNEWGROUP
FOR iz= 0 TO name.zverts-1
X_OBJADDVERTEX name.Plane_pts[ix][iz].plx,name.Plane_pts[ix][iz].ply,name.Plane_pts[ix][iz].plz,name.Plane_pts[ix][iz].tx,name.Plane_pts[ix][iz].tz,name.Plane_pts[ix][iz].col
X_OBJADDVERTEX name.Plane_pts[ix+1][iz].plx,name.Plane_pts[ix+1][iz].ply,name.Plane_pts[ix+1][iz].plz,name.Plane_pts[ix+1][iz].tx,name.Plane_pts[ix+1][iz].tz,name.Plane_pts[ix+1][iz].col
NEXT
NEXT
X_OBJEND
IF name.smooth=TRUE
X_AUTONORMALS 2
ELSE
X_AUTONORMALS 1
ENDIF

X_DRAWOBJ objnum,0
RETURN 1
ENDFUNCTION

//-------------------------------------//
//! Set the height of a particular plane vertex
//-------------------------------------//
FUNCTION SetPlaneHeight: name AS TPlane,x,z,height
name.Plane_pts[x][z].ply=height
ENDFUNCTION

//------------------------------------//
//! Get the height of the plane at x,z
//------------------------------------//
FUNCTION GetPlaneHeight: name AS TPlane,x,z
RETURN name.Plane_pts[x][z].ply
ENDFUNCTION

//------------------------------------//
//! Assign a random value between 0 and h to each vertex in the plane
//------------------------------------//
FUNCTION RandomisePlane: name AS TPlane,h
LOCAL ix,iz
FOR ix=0 TO name.xverts-1
FOR iz=0 TO name.zverts-1
SetPlaneHeight(name,ix,iz,RND(h))
NEXT
NEXT
ENDFUNCTION
The camera code
Code (glbasic) Select
UNCTION MoveCam:
INC phiXZ,MOUSEAXIS(0)/10 //left-right turn
INC phiXY,MOUSEAXIS(1)/10 //up-down turn

IF phiXZ > 360 THEN phiXZ=phiXZ-360
IF phiXZ < 0 THEN  phiXZ=phiXZ+360

IF phiXY < -up_down_limit THEN phiXY=-up_down_limit
IF phiXY > up_down_limit  THEN phiXY=up_down_limit

IF KEY(17) //forward -- w key
INC camz,SIN(phiXZ)*WalkSpeed
INC camx,COS(phiXZ)*WalkSpeed
ENDIF

IF KEY(31) //back -- s key
DEC camz,SIN(phiXZ)*WalkSpeed
DEC camx,COS(phiXZ)*WalkSpeed
ENDIF

IF KEY(30) //left -- a key
INC camz,SIN(phiXZ-90)*WalkSpeed
INC camx,COS(phiXZ-90)*WalkSpeed
ENDIF

IF KEY(32) //right --d key
INC camz,SIN(phiXZ+90)*WalkSpeed
INC camx,COS(phiXZ+90)*WalkSpeed
ENDIF

ENDFUNCTION
And a program to test the code
Code (glbasic) Select
// --------------------------------- //
// Project: Plane
// Start: Saturday, October 27, 2007
// IDE Version: 5.047
//Test of the plane functions as an ocean swell
//Matthew Ingle October 2007
//Code adapted from a Darkbasic example
//Use and improve!!!
//------------Declarations------------//
//Variables for camera
LIMITFPS 25
GLOBAL up_down_limit=30
GLOBAL camy=20,camx=15,camz=15
GLOBAL WalkSpeed=0.5
GLOBAL phiXZ=0
GLOBAL phiXY=0

//Variable for ground plane
LOCAL ground AS TPlane
LOCAL size=2000 // the x and z size of the plane
LOCAL divisions=20 //the number of divisions in the plane
LOCAL waveheight=2
DIM ripple[divisions*divisions] // an array to hold ripple data for the plane

//Fill the ripple array with data
LOCAL t
FOR t=0 TO divisions*divisions-1
ripple[t]=RND(359)
NEXT

//Create a plane object and assign random heights to the vertices
ground=CreatePlane(size,size,divisions,divisions,TRUE)
RandomisePlane(ground,waveheight)
//load a sprite FOR the water
LOADSPRITE "water.bmp",500

//draw a plain blue background
GETSCREENSIZE sx,sy
DRAWRECT 0,0,sx,sy,RGB(0x38, 0x8e, 0xc2)
GRABSPRITE 100,0,0,sx,sy

//main loop
WHILE TRUE
DRAWSPRITE 100,0,0
X_MAKE3D 0.1,1000,45
X_CAMERA camx, camy, camz,   camx+COS(phiXZ), camy+SIN(-phiXY), camz+SIN(phiXZ)
X_AMBIENT_LT 0,RGB(255,255,255)
X_FOG RGB(240,240,255),FALSE,200,1000
X_DRAWAXES 0,0,0
//update the ripple data for the plane
LOCAL ix,iz
FOR ix =1 TO divisions-2
FOR iz=1 TO divisions-2
//Get the current height of the plane vertex
h=GetPlaneHeight(ground,ix,iz)
//Match the vertex to a member of the ripple array
tt=ix+(iz*divisions-1)
//set the new height of the vertex
SetPlaneHeight(ground,ix,iz,h+(COS(ripple[tt])*1))
//and change the ripple height for next time
ripple[tt]=MOD(ripple[tt]+5,360)
NEXT
NEXT
//Set the water texture and draw the plane
X_SETTEXTURE 500,-1
DrawPlane(ground,500)
//check the camera for movement
MoveCam()
X_MAKE2D
PRINT "Camera X:"+camx,0,30
PRINT "Camera Z:"+camz,0,50
PRINT "Camera Y:"+camy,0,70
//show it
SHOWSCREEN
WEND
END
About time I contributed hope this is OK (I am not flameproof!!)
Thanks
Matthew
#57
Hi Gernot,
I do appreciate the effort that you put into making your product user friendly and reliable. I have switched to Linux and only use windows in VMWare to use GLBasic. Being able to use under WINE is a great step forward. (I do have a laptop that runs winXP that I have not changed over to Linux yet??)
Anyway thanks once again
Matthew
#58
HI,
I downloaded the sdk again ( probably didn't have to as it appeared to be the same as previously downloaded) and installed glbasic under wine. The editor ran OK and I was able to use the internet update to bring up to latest version.The editor works OK and the precompiler seems to work but I get an error with compiling
Quotecompiling:
g++.exe: installation problem, cannot exec `cc1plus': No such file or directory
*** FATAL ERROR - Please post this output in the forum
Same error when options set to compile for windows or for linux
I am using Ubuntu 7.04 Feisty Fawn. Looks like a path error? although GLBasic did not seem to set any path variables on my winxp laptop.
Any thoughts
thanks
Matthew
#59
GLBasic - en / Entity Code
2007-Oct-15
Thanks ,that fixed it . I could not find what was going wrong in the original code. I'll compare the new to find it.( a learning experience)
Matthew
#60
GLBasic - en / Entity Code
2007-Oct-15
Gernot,
I tried the entity code from the German forum. My model displays ok but it doesn't seem to move ( as the code would suggest). I added some functions to get the position of the entity and displayed this on the screen. The position value of the entity changes on each loop so I can only think that the X-Multmatrix or the X-Drawanim instructions are not working (for me anyway). This code looks like a good start to a scene manager library. Any ideas??
Code I added to Entity.gbas
Code (glbasic) Select
// ------------------------------------------ //
//! Return the x position of the entity
// ------------------------------------------ //
FUNCTION GetEntityX: entity
RETURN g3DObj[entity].x
ENDFUNCTION

// ------------------------------------------ //
//! Return the y position of the entity
// ------------------------------------------ //
FUNCTION GetEntityY: entity
RETURN g3DObj[entity].y
ENDFUNCTION

// ------------------------------------------ //
//! Return the z position of the entity
// ------------------------------------------ //
FUNCTION GetEntityZ: entity
RETURN g3DObj[entity].z
ENDFUNCTION
Thanks
Matthew