Drawing 3D in 2D?

Just starting out? Need help? Post your questions and find answers here.
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Drawing 3D in 2D?

Post by ricardo »

Hi,

Im just playing for 1st time with drawing etc.
I want to create 3D images and save it as BMP.
Does anyone has experience on this?

Im doing in this way:

Code: Select all

Procedure CreateButton()
MyImage = CreateImage(0, 255,255) ; create a new empty bitmap, retrieve handle 
StartDrawing(ImageOutput()) ; start drawing to the bitmap we created 

For H = 0 To 255
 For W = 0 To 255
 Blue1 = 255-H
Color = RGB(255,H,Blue1)
Color = RGB(0,60,60)
 Plot(W,H,Color)
 Next W 
Next H

Valor = 60
Dividendo = (255/Valor)
  For W = 0 To Valor
   Render  = (W*Dividendo)+50
  If Render > 255
   Render = 255
   ElseIf Render < 20
   Render = 20
 EndIf
  Color = RGB(0,Render,Render)
  Radio = Valor - W
  Circle(125, 125, Radio, Color) 
  Next


StopDrawing()
SaveImage(0,"boton4.bmp",#PB_ImagePlugin_BMP)
SetGadgetState(1,ImageID())
ProcedureReturn 1

EndProcedure

If OpenWindow(0,100,150,450,300,#PB_Window_SystemMenu,"Test")
  CreateGadgetList(WindowID())
  ImageGadget(1,10,10,255,255,LoadImage(0,""))
  ButtonGadget(2,300,100,50,25,"Test")
  Repeat
    EventID=WaitWindowEvent()
    
    Select EventID
    
      Case #PB_EventGadget
        Select EventGadgetID()
          Case 2
            CreateButton()
        EndSelect
    
    EndSelect
    
  Until EventID=#PB_EventCloseWindow
EndIf
As i don't want to reivent the wheel, maybe there is some tips about this.

Help and tips are welcome :D

BTW, if i change the value on the Variable named Valor to make the sphere smaller i need to find some way to make it more brilliant, less opaque and maybe to get the effect like transparent to the background.

Have mercy with my code, its my first graphic ever in my life :?

Thanks in advance
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Sounds good to me..
Post Reply