Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [Tutorial] [Blitz]Textured Spinning Cube
Index -> Programming, Visual Basic and Other Basics -> Other Basics
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
shorthair




PostPosted: Thu Feb 19, 2004 10:02 pm   Post subject: [Tutorial] [Blitz]Textured Spinning Cube

From Blitz Help and Shorthair
here we go:

code:
Graphics3D 800,600

SetBuffer BackBuffer()


Then we'll have to create a light:

code:
light = CreateLight()


The light that we ceated here is just a standard white light. The CreateLight function also takes an (optional) parameter to specify the color of the light you're creating, but I will not cover that here. So now, over to the camera:

code:
camera=CreateCamera()
CameraViewport camera,0,0,800,600


Here we set the viewport of our camera to cover the entire screen. Now we need to create the cube and position it:
code:

Global cube=CreateCube()
PositionEntity cube,0,0,5


Now we have created a cube and positioned it. Before we go on to the next part, make sure you have a texture available that you have placed inside the same folder as your project file. For this example, just name it texture1. Here's how to load it and apply it to the cube we created earlier:

code:
Texture = LoadTexture ("texture1.bmp")

EntityTexture Cube,Texture


Simple, huh? Smile All we do is giving the Cube as a parameter to the EntityTexture function. After that, we give our texture as a parameter as well. From now on, all the action in the program happens as long as the user doesn't press escape (1).

code:
While Not KeyHit (1)

        TurnEntity cube,0.1,0.2,0.3

        UpdateWorld
        RenderWorld
       
        Flip
       
Wend

End


All we do here is to turn the cube, update world and render everything in it (so far, all we have inside the world is 1 cube:P) Wend = We use this to end our While loop. End ends our program. If you copy all of this, making sure the texture is placed in the same folder as your project file, you should see a spinning, textured cube on your screen:D Also, please try to forgive me if my English is a bit lousy at some places. I'm not too good at spelling , we all know that
Sponsor
Sponsor
Sponsor
sponsor
jonos




PostPosted: Wed Mar 03, 2004 8:56 pm   Post subject: (No subject)

nice, tought me how to do the textures in my pong game. keep them coming, please then we can learn more of course and better utilitse our purchased blitz basics hehe.
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Other Basics
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: