GLBasic forum

Main forum => GLBasic - en => Topic started by: mich19 on 2006-May-20

Title: X_settextureoffset
Post by: mich19 on 2006-May-20
Can you explain me the functioning of X_SETTEXTUREOFFSET
Title: X_settextureoffset
Post by: bigsofty on 2006-May-21
Its the texture offset.

The two parameters are added to all UV co-ordinates for a model to make the texture 'scroll' by a certain amount, horizontally and vertically.

Think of it as quick way to rotate a skin around a model or scroll a repeated texture accross a polygonial plane.
Title: X_settextureoffset
Post by: mich19 on 2006-May-21
I do not arrive has to use this function(office), can you make me an example
Thank you
Title: X_settextureoffset
Post by: BumbleBee on 2006-May-21
Hi mich19

Here is a X_SETTEXTUREOFFSET example

Code (glbasic) Select
LIMITFPS 60

         //Call Create_Ground_Function
Create_Ground(400,0,400,RGB(255,255,255))

            //Load Texture
LOADSPRITE "Your_Texture.bmp",1

                       //LOOP
//-------------------------------------------------------
WHILE TRUE

  X_MAKE3D 1,2000,45
  X_CAMERA 0,0,-1200,0,0,0

  X_MOVEMENT 0,0,0
  X_SCALING 1,1,1
  X_ROTATION 90,1,0,0
  X_SETTEXTURE 1,-1
            //Scroll texture (dx,dy)
  //dx=dx-0.005
  dy=dy+0.01  
  X_SETTEXTUREOFFSET dx,dy
 
  X_DRAWOBJ 1,0
     
 SHOWSCREEN
WEND


// ---------------------------------------------------------//
             //    CREATE_GROUND
// ----------------------------------------------------------//
FUNCTION Create_Ground: Gr_X,Gr_Y,Gr_Z,Gr_Color
     X_OBJSTART 1
X_OBJADDVERTEX -Gr_X,0,-Gr_Z, 0,0,Gr_Color
X_OBJADDVERTEX  Gr_X,0,-Gr_Z, 1,0,Gr_Color
X_OBJADDVERTEX -Gr_X,0, Gr_Z, 0,1,Gr_Color
X_OBJADDVERTEX  Gr_X,0, Gr_Z, 1,1,Gr_Color
X_OBJEND
ENDFUNCTION
Have a nice day :)

Cheers
Title: X_settextureoffset
Post by: bigsofty on 2006-May-21
Good example :)
Title: X_settextureoffset
Post by: Kitty Hello on 2006-May-22
I'll put that in the manual then!?
Title: X_settextureoffset
Post by: mich19 on 2006-May-22
Thank you for the speed and the quality of the example