Page 2 of 2

Posted: Mon Mar 20, 2006 2:32 pm
by Vallan
There is no log. (The program did run but with black screen)

I can run other applications using OGRE, like the PB Examples.

Posted: Mon Mar 20, 2006 7:28 pm
by Michael Vogel
Think, you have not enough video memory for doing the stuff - on my notebook I had to change the 800x600 setting of the sphere program to 640x480...

I wanted to make it more universally (but be careful: the openscreen functions seems to have a bug - and fails even for 640x480, when 800x600 could not initialized before that)
Global Fullscreen.w=1; 1: Full / 0:Window / 2: Ask
Global ColDepth.w=32
Global _X.w=800
Global _Y.w=600

If Fullscreen>1
If MessageRequester("Sphere 3D","Programm im Full-Screen Modus starten?",#PB_MessageRequester_YesNo)=6
FullScreen=1
Else
FullScreen=0
EndIf
EndIf

;- Initialisation
If InitEngine3D() = 0
MessageRequester("Fehler","3D Graphik konnte nicht initialisiert werden,"+#CR$+"möglichereise fehlt die Datei 'Engine3D.dll'",0)
End
ElseIf InitSprite() = 0 Or InitKeyboard() = 0
MessageRequester("Fehler","Direct-X konnte nicht initialisiert werden",0)
End
EndIf

If Fullscreen
Repeat
;Debug "Try..."+Str(_X)+"/"+Str(_Y)+", "+Str(ColDepth)
If OpenScreen(_X,_Y,ColDepth,"Sphere 3D")=#False
ColDepth-8
If ColDepth=0
ColDepth=32
_X*4/5 : _Y*4/5
If _x<640
End
EndIf
EndIf
Else
;Debug "Success"
Break
EndIf
ForEver

Else
OpenWindow(0,0,0,_X,_Y,"Sphere 3D")
OpenWindowedScreen(WindowID(0), 0,0,_X,_Y, 0,0,0)
SmartWindowRefresh(0, 1)
EndIf

At least that works - I added the new texture and material stuff to the brilliant demo...
Global TextureType.w=2
Global MaterialType.w=0
;-Texture
CreateTexture(0,128, 128)
StartDrawing(TextureOutput(0))
Select TextureType
Case 1
For i = 0 To 127 Step 8
Box(0,i,TextureWidth(0),1,#White)
Box(0,i+1,TextureWidth(0),1,RGB(0,0,155))
Next i
Case 2
For i = 0 To 127 Step 18
Box(0,i,TextureWidth(0),1,#Blue)
Box(0,i+3,TextureWidth(0),3,$ff6060)
Next i
Default
For i = 0 To 127 Step 4
Box(0,i,TextureWidth(0),2,#White)
Box(0,i+2,TextureWidth(0),2,RGB(0,0,155))
Next i
EndSelect
StopDrawing()


;-Material
Select MaterialType
Case 1
CreateMaterial(0,TextureID(0))
MaterialBlendingMode(0,#PB_Material_Add)
RotateMaterial(0,0.1,#PB_Material_Animated)
Default
CreateMaterial(0,TextureID(0))
RotateMaterial(0,0.1,#PB_Material_Animated)
EndSelect

Posted: Tue Mar 21, 2006 2:43 pm
by Vallan
There is stil only a black screen.

But now I found an Ogre.log:
14:40:35: Creating resource group General
14:40:35: Registering ResourceManager for type Material
14:40:35: Registering ResourceManager for type Mesh
14:40:35: Registering ResourceManager for type Skeleton
14:40:35: OverlayElementFactory for type Panel registered.
14:40:35: OverlayElementFactory for type BorderPanel registered.
14:40:35: OverlayElementFactory for type TextArea registered.
14:40:35: Registering ResourceManager for type Font
14:40:35: ArchiveFactory for archive type FileSystem registered.
14:40:35: ArchiveFactory for archive type Zip registered.
14:40:35: DevIL version: Developer's Image Library (DevIL) 1.6.7 Aug 15 2005
14:40:35: DevIL image formats: jpg jpe jpeg pcx png tga vda icb vst raw
14:40:35: Registering ResourceManager for type HighLevelGpuProgram
14:40:35: Direct3D7 Rendering Subsystem created.
14:40:35: ----- DirectDraw Detection Starts
14:40:35: Detected DirectDraw driver Primärer Anzeigetreiber
14:40:35: ----- DirectDraw Detection Ends
14:40:35: Particle Emitter Type 'Point' registered
14:40:35: Particle Emitter Type 'Box' registered
14:40:35: Particle Emitter Type 'Ellipsoid' registered
14:40:35: Particle Emitter Type 'Cylinder' registered
14:40:35: Particle Emitter Type 'Ring' registered
14:40:35: Particle Emitter Type 'HollowEllipsoid' registered
14:40:35: Particle Affector Type 'LinearForce' registered
14:40:35: Particle Affector Type 'ColourFader' registered
14:40:35: Particle Affector Type 'ColourFader2' registered
14:40:35: Particle Affector Type 'ColourImage' registered
14:40:35: Particle Affector Type 'ColourInterpolator' registered
14:40:35: Particle Affector Type 'Scaler' registered
14:40:35: Particle Affector Type 'Rotator' registered
14:40:35: TerrainSceneManager: Registered a new PageSource for type Heightmap
14:40:35: Registering ResourceManager for type BspLevel
14:40:35: *-*-* OGRE Initialising
14:40:35: *-*-* Version 1.0.7 (Azathoth)
14:40:39: ***************************************
*** Direct3D Subsystem Initialising ***
***************************************
14:40:39: *****************************************
14:40:39: *** Direct3D Subsystem Initialised Ok ***
14:40:39: *****************************************
14:40:39: Registering ResourceManager for type GpuProgram
14:40:39: ResourceBackgroundQueue - threading disabled
14:40:39: D3D7 : Created D3D7 Rendering Window 'PureBasic Ogre' : 800x600, 32bpp
14:40:39: Creating DirectDraw surfaces for window with dimensions:
14:40:39: FULLSCREEN w:800 h:600 bpp:32
14:40:42: Successfully created full screen rendering surface / flipping chain.
14:40:42: ----- Direct3D Detection Starts
14:40:42: Detected Direct3D Device Microsoft Direct3D RGB Software Emulation
14:40:42: Direct3D Device Capabilities:
14:40:42: Hardware Accelerated: 0
14:40:42: Mipmapping: 1
14:40:42: Bilinear Filtering: 1
14:40:42: Trilinear Filtering: 1
14:40:42: Hardware Transform & Light: 0
14:40:42: Max rendering colour depth: 32
14:40:42: Max single-pass texture layers: 8
14:40:42: Pixel fog supported: 256
14:40:42: Vertex fog supported: 128
14:40:42: This device needs a Z-Buffer
14:40:42: ----- Direct3D Detection Ends
14:40:42: Determining best 3D Device...
14:40:42: Best 3D Device is: Microsoft Direct3D RGB Software Emulation
14:40:42: Direct3D - Creating Z-Buffer
14:40:42: Depth-Buffer created (32-bit, 8-bit stencil)
14:40:42: Registering ResourceManager for type Texture
14:40:42: RenderSystem capabilities
14:40:42: -------------------------
14:40:42: * Hardware generation of mipmaps: no
14:40:42: * Texture blending: yes
14:40:42: * Anisotropic texture filtering: no
14:40:42: * Dot product texture operation: no
14:40:42: * Cube mapping: no
14:40:42: * Hardware stencil buffer: yes
14:40:42: - Stencil depth: 8
14:40:42: - Two sided stencil support: no
14:40:42: - Wrap stencil values: yes
14:40:42: * Hardware vertex / index buffers: no
14:40:42: * Vertex programs: no
14:40:42: * Fragment programs: no
14:40:42: * Texture Compression: no
14:40:42: * Scissor Rectangle: no
14:40:42: * Hardware Occlusion Query: no
14:40:42: * User clip planes: no
14:40:42: * VET_UBYTE4 vertex element type: no
14:40:42: * Infinite far plane projection: no
14:40:42: * Hardware render-to-texture: no
14:40:42: * Floating point textures: no
14:40:42: * Non-power-of-two textures: no
14:40:42: * Volume textures: no
14:40:42: Particle Renderer Type 'billboard' registered
14:40:42: WARNING: Mesh instance 'M0' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
14:40:42: Creating viewport on target 'PureBasic Ogre', rendering from camera 'MyCam', relative dimensions L: 0.00 T: 0.00 W: 1.00 H: 1.00 ZOrder: 0
14:40:42: Viewport for camera 'MyCam', actual dimensions L: 0 T: 0 W: 800 H: 600
14:40:42: Texture: spot_shadow_fade.png: Loading 1 faces(PF_B8G8R8,128x128x1) with 0 generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
Last time I forgot that I haven't the rights create files on general disk (I'm in school now)

Posted: Tue Mar 21, 2006 8:39 pm
by Michael Vogel
Just for fun, try 640x480 (and maybe only 24 Bits), maybe it helps (my notebook shows also a black screen, as I stated above)

Posted: Tue Mar 21, 2006 9:09 pm
by Vallan
I did try 640*480 and 32 bit but without any succes.

At Home it runs great, and it looks cool.

Posted: Tue Mar 21, 2006 9:12 pm
by Comtois
My log
12:22:18: ----- DirectDraw Detection Starts
12:22:18: Detected DirectDraw driver Pilote d'affichage principal
12:22:18: Detected DirectDraw driver RADEON 9800 SERIES
12:22:18: ----- DirectDraw Detection Ends

12:22:20: Best 3D Device is: Microsoft Direct3D Hardware Transform and Lighting acceleration capable device
Your log
14:40:35: ----- DirectDraw Detection Starts
14:40:35: Detected DirectDraw driver Primärer Anzeigetreiber
14:40:35: ----- DirectDraw Detection Ends

14:40:42: Best 3D Device is: Microsoft Direct3D RGB Software Emulation
Have you a 3D graphic card ?

Posted: Wed Mar 22, 2006 12:29 pm
by Michael Vogel
Vallan wrote:I did try 640*480 and 32 bit but without any succes.

At Home it runs great, and it looks cool.
Have you had a lokk into your screen settings of window? or try directx diagnose, this gives you also informations about your screen abilities...

And, start with the lowest requirements, 640x480x16! not 32...

Posted: Fri Mar 24, 2006 12:39 pm
by Vallan
But other 3D programs using Ogre are running great ( on the bad PC), event at 1024*768*32.

(Now I'am at home and everything runs)

Posted: Sun Mar 26, 2006 2:17 am
by SFSxOI
works great here :) very nice, thank you. Gives me an idea tho, is it possible to have the results of this method/code appear in another DirectX window? I'm working on a mod for a game and it would be cool to have a nice opening screen for the mod, but it would need to appear in the games directX window.

Posted: Tue Mar 24, 2009 7:15 pm
by Fluid Byte
Updated, formated + EnableExplicit for PB 4.30F

Code: Select all

; Comtois 28/03/06
; PB4.0 Beta 7
;
; Updated/Formated by Fluid Byte
; PB V4.30F - March.24,2009

EnableExplicit

Declare CreateSphere(M,P)
Declare UpdateMesh()

#_SIZEVERT = 36
#_SIZETRIS = 6
#FULLSCREEN = 0

Structure VECTOR
   X.f
   Y.f
   Z.f
EndStructure

Structure VERTEX
   X.f
   Y.f
   Z.f
   NX.f
   NY.f
   NZ.f
   Color.l
   U.f
   V.f
EndStructure

Structure TRIANGLE
   V1.w
   V2.w
   V3.w
EndStructure

Macro CALC_NORMALS
   *PtrV\NX = *PtrV\X
   *PtrV\NY = *PtrV\Y
   *PtrV\NZ = *PtrV\Z
EndMacro

Global *VBuffer, *IBuffer
Global Meridian = 50, Parallele = 50, PasLength = 4, Length

Define EventID, i, NbSommet, CameraMode, Angle.f, Pas.f = 0.5

InitEngine3D() : InitSprite() : InitKeyboard()

Add3DArchive(GetTemporaryDirectory(),#PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples\Sources\Data\",#PB_3DArchive_FileSystem)

If #FULLSCREEN
  OpenScreen(800,600,32,"Sphere 3D")
Else
  OpenWindow(0,0,0,800,600,"Sphere 3D",#PB_Window_SystemMenu | 1)
  OpenWindowedScreen(WindowID(0),0,0,800,600,0,0,0)
EndIf

;-Texture
CreateImage(0,128,128)
StartDrawing(ImageOutput(0))
For i = 0 To 127 Step 4
	Box(0,i,ImageWidth(0),2,RGB(255,255,255))
	Box(0,i + 2,ImageWidth(0),2,RGB(0,0,155))
Next i
StopDrawing()
SaveImage(0,GetTemporaryDirectory() + "temp.bmp") : FreeImage(0)

;-Material
CreateMaterial(0,LoadTexture(0,"temp.bmp"))
RotateMaterial(0,0.1,#PB_Material_Animated)

;-Mesh
CreateSphere(Meridian,Parallele)

;-Entity
CreateEntity(0,MeshID(0),MaterialID(0))
ScaleEntity(0,60,60,60)

;-Camera
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0,-200)
CameraLookAt(0,EntityX(0),EntityY(0),EntityZ(0))

;-Light
AmbientColor(RGB(105, 105, 105))
CreateLight(0, RGB(255, 255,  55), EntityX(0) + 150, EntityY(0)      , EntityZ(0))
CreateLight(1, RGB( 55, 255, 255), EntityX(0) - 150, EntityY(0)      , EntityZ(0))
CreateLight(2, RGB( 55,  55, 255), EntityX(0)      , EntityY(0) + 150, EntityZ(0))
CreateLight(3, RGB(255,  55, 255), EntityX(0)      , EntityY(0) - 150, EntityZ(0))

; ----------------------------------------------------------------------------------------------------
; MAINLOOP
; ----------------------------------------------------------------------------------------------------

Repeat
	If #FULLSCREEN = 0
		Repeat
			EventID = WindowEvent()
		
			Select EventID
				Case #PB_Event_CloseWindow : End 
			EndSelect
		Until EventID = 0
	EndIf
	
   Angle + Pas
   RotateEntity(0, Angle, Angle,Angle)
   
   If PasLength > 0 : UpdateMesh() : EndIf
   
   If ExamineKeyboard()
      If KeyboardReleased(#PB_Key_F1)
         CameraMode = 1 - CameraMode
         CameraRenderMode(0, CameraMode)
      EndIf
   EndIf
   
   RenderWorld()
   FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)

; ----------------------------------------------------------------------------------------------------
; FUNCTIONS
; ----------------------------------------------------------------------------------------------------

Procedure CreateSphere(M,P)
	; M = Meridian
	; P = Parallele
	; The radius is 1. Front to remove it later, it's just for the demo.
	
	If M < 3 Or P < 2  : ProcedureReturn 0 : EndIf
	
	Protected Normale.VECTOR, NbSommet, i, j, Theta.f, cTheta.f, sTheta.f
	Protected Alpha.f, cAlpha.f, sAlpha.f, *PtrV.VERTEX, *PtrF.TRIANGLE, NbTriangle
	
	NbSommet = 2 + ((M + 1) * P)
	*VBuffer = AllocateMemory(#_SIZEVERT * Nbsommet)
	
	For i = 0 To M
		Theta  = i * #PI * 2.0 / M
		cTheta = Cos(theta)
		sTheta = Sin(theta)
		
		For j = 1 To P
			Alpha  = j * #PI / (P + 1)
			cAlpha = Cos(Alpha)
			sAlpha = Sin(Alpha)
			*PtrV = *VBuffer + #_SIZEVERT * ((i * P) + (j - 1))
			*PtrV\X = sAlpha * cTheta
			*PtrV\Y = sAlpha * sTheta
			*PtrV\Z = cAlpha
			*PtrV\U  = Theta / (2.0 * #PI)
			*PtrV\V  = Alpha / #PI
			CALC_NORMALS
		Next j
	Next i
	
	; Southpole
	*PtrV = *VBuffer + #_SIZEVERT * ((M + 1) * P)	
	*PtrV\X =  0
	*PtrV\Y =  0   
	*PtrV\Z = -1
	*PtrV\U =  0
	*PtrV\V =  0
	CALC_NORMALS
		
	; Northpole
	*PtrV + #_SIZEVERT
	*PtrV\X = 0
	*PtrV\Y = 0   
	*PtrV\Z = 1
	*PtrV\U = 0
	*PtrV\V = 0
	CALC_NORMALS
	
	; Les facettes
	NbTriangle = 4 * M * P
	*IBuffer = AllocateMemory(#_SIZETRIS * NbTriangle)
	*PtrF = *IBuffer
	
	For i = 0 To M - 1
		For j = 1 To P - 1
			*PtrF\V1 = ((i + 1) * P) + j
			*PtrF\V2 = ((i + 1) * P) + (j - 1)
			*PtrF\V3 = (i * P) + (j - 1)
			*PtrF + #_SIZETRIS
			*PtrF\V3 = ((i + 1) * P) + j        ;Recto
			*PtrF\V2 = ((i + 1) * P) + (j - 1)  ;Recto
			*PtrF\V1 = (i * P) + (j - 1)        ;Recto
			*PtrF + #_SIZETRIS
			*PtrF\V1 = i * P + j
			*PtrF\V2 = ((i + 1) * P) + j
			*PtrF\V3 = (i * P) + (j - 1)
			*PtrF + #_SIZETRIS
			*PtrF\V3 = i * P + j               ;Recto
			*PtrF\V2 = ((i + 1) * P) + j       ;Recto
			*PtrF\V1 = (i * P) + (j - 1)       ;Recto
			*PtrF + #_SIZETRIS
		Next j     
	Next i
		
	; The Poles
	For i = 0 To M - 1
		*PtrF\V3 = (M + 1) * P + 1
		*PtrF\V2 = (i + 1) * P
		*PtrF\V1 = i * P
		*PtrF + #_SIZETRIS
		*PtrF\V1 = (M + 1) * P + 1   ;Recto
		*PtrF\V2 = (i + 1) * P       ;Recto
		*PtrF\V3 = i * P             ;Recto
		*PtrF + #_SIZETRIS
	Next i     
		
	For i = 0 To M - 1
		*PtrF\V3 = (M + 1) * P
		*PtrF\V2 = i * P + (P - 1)
		*PtrF\V1 = (i + 1) * P + (P - 1)
		*PtrF + #_SIZETRIS
		*PtrF\V1 = (M + 1) * P              ;Recto
		*PtrF\V2 = i * P + (P - 1)          ;Recto
		*PtrF\V3 = (i + 1) * P + (P - 1)    ;Recto
		*PtrF + #_SIZETRIS  
	Next i     
	
	If CreateMesh(0,100)
		Protected Flag = #PB_Mesh_Vertex | #PB_Mesh_Normal | #PB_Mesh_UVCoordinate | #PB_Mesh_Color
		SetMeshData(0,Flag,*VBuffer,NbSommet)
		SetMeshData(0,#PB_Mesh_Face,*IBuffer,NbTriangle)
		ProcedureReturn 1
	EndIf
	
	ProcedureReturn 0 
EndProcedure   

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Procedure UpdateMesh()
	Protected NbTriangle = 4 * Meridian * Parallele
	
	Length + PasLength
	
	If Length >= NbTriangle
		PasLength = 0
		Length = Nbtriangle
	EndIf
	
	SetMeshData(0,#PB_Mesh_Face,*IBuffer,Length)
EndProcedure

Posted: Tue Mar 24, 2009 11:30 pm
by mpz
Hi Fluid,

this code is amazing. And if you dont like the holes and the wrong textur uv on the north an south pole you can exchange the sphere code with these one.

Best regards,
Michael

Code: Select all

Procedure CreateSphere(M,P) 
   ; M = Meridian 
   ; P = Parallele 
   ; The radius is 1. Front to remove it later, it's just for the demo. 
    
   If M < 3 Or P < 2  : ProcedureReturn 0 : EndIf 
    
   Protected Normale.VECTOR, NbSommet, i, j, Theta.f, cTheta.f, sTheta.f 
   Protected Alpha.f, cAlpha.f, sAlpha.f, *PtrV.VERTEX,*PtrV2.VERTEX, *PtrF.TRIANGLE, NbTriangle 
    
   NbSommet = 1 + ((m + 1) * p) + 2 * m -1
   

   *VBuffer = AllocateMemory(#_SIZEVERT * Nbsommet) 
    
   For i = 0 To m 
      theta.f  = i * #PI * 2.0 / m 
      ctheta.f = Cos(theta) 
      stheta.f = Sin(theta) 
  
      For j = 1 To p  
         alpha.f  = j * #PI / (p + 1) 
         calpha.f = Cos(alpha) 
         salpha.f =Sin(alpha) 
         *PtrV.Vertex = *VBuffer + #_SIZEVERT * ((i * p) + (j - 1)) 
         *PtrV\x = salpha * ctheta
         *PtrV\z = salpha * stheta 
         *PtrV\y = calpha  
         *PtrV\u = Theta / (2.0 * #PI)  
         *PtrV\v = alpha / #PI 
         CALC_NORMALS 

      Next j 
   Next i 

   For i = 0 To m -1
      theta.f  = i / m 
      *PtrV.Vertex = *VBuffer + #_SIZEVERT * (((m + 1) * p)+i)
      *PtrV\x = 0 
      *PtrV\y = -1    
      *PtrV\z = 0 
      *PtrV\u = Theta + 1/(m*2)
      *PtrV\v = 1 
      CALC_NORMALS 
  Next i
 
  For i = 0 To m -1
    theta.f  = i / m 
    *PtrV.Vertex = *VBuffer + #_SIZEVERT * (((m + 1) * p)+m+i)
   ;Pole nord 
    *PtrV\x = 0 
    *PtrV\y = 1    
    *PtrV\z = 0 
    *PtrV\u = Theta + 1/(m*2) 
    *PtrV\v = 0 
    CALC_NORMALS 
  Next i

   ; Les facettes 
  
   NbTriangle = 4 * M * P 
   *IBuffer = AllocateMemory(#_SIZETRIS * NbTriangle) 

   *PtrF = *IBuffer 

   For i = 0 To m - 1 
      For j = 1 To p - 1 
         *PtrF\V1=((i + 1) * p) + j 
         *PtrF\V2=((i + 1) * p) + (j - 1) 
         *PtrF\V3=(i * p) + (j - 1) 
         *PtrF + #_SIZETRIS 
         *PtrF\V3=((i + 1) * p) + j        ;Recto 
         *PtrF\V2=((i + 1) * p) + (j - 1)  ;Recto 
         *PtrF\V1=(i * p) + (j - 1)        ;Recto 
         *PtrF + #_SIZETRIS  
         *PtrF\V1 = i * p + j
         *PtrF\V2=((i + 1) * p) + j 
         *PtrF\V3=(i * p) + (j - 1) 
         *PtrF + #_SIZETRIS 
         *PtrF\V3=i * p + j                ;Recto 
         *PtrF\V2=((i + 1) * p) + j        ;Recto 
         *PtrF\V1 = (i * p) + (j - 1)      ;Recto 
         *PtrF + #_SIZETRIS  
      Next j      

      *PtrF\V3=((m + 1) * p)+i 
      *PtrF\V2=i * p + (p - 1) 
      *PtrF\V1=(i + 1) * p + (p - 1)
      *PtrF + #_SIZETRIS  
      *PtrF\V1 = ((m + 1) * p)+i           ;Recto 
      *PtrF\V2 = i * p + (p - 1)           ;Recto 
      *PtrF\V3 = (i + 1) * p + (p - 1)     ;Recto 
      *PtrF + #_SIZETRIS  

      *PtrF\V3=(m + 1) * p +m+i 
      *PtrF\V2=(i + 1) * p 
      *PtrF\V1 = i * p 
      *PtrF + #_SIZETRIS  
      *PtrF\V1 = ((m + 1) * p) +m+i        ;Recto 
      *PtrF\V2=(i + 1) * p                 ;Recto 
      *PtrF\V3=i * p                       ;Recto 
      *PtrF + #_SIZETRIS  


   Next i
    
   If CreateMesh(0,100) 
      Protected Flag = #PB_Mesh_Vertex | #PB_Mesh_Normal | #PB_Mesh_UVCoordinate | #PB_Mesh_Color 
      SetMeshData(0,Flag,*VBuffer,NbSommet) 
      SetMeshData(0,#PB_Mesh_Face,*IBuffer,NbTriangle) 
      ProcedureReturn 1 
   EndIf 
    
   ProcedureReturn 0 
EndProcedure    



Posted: Wed Mar 25, 2009 1:01 pm
by Fluid Byte
mpz wrote:And if you dont like the holes and the wrong textur uv on the north an south pole you can exchange the sphere code with these one.
Can you read my mind? The holes were actually the first thing I realized but I was afraid to mention it since the code is so great and actually the only one which creates a working sphere. Though I didn't realize the incorrect UV mapping because the rotating stripes texture made me a "little" dizzy.

I'm currently working on an include to ease mesh creation/manipulation and the creation of primitives. So I'm checking all the codes of Comtois like Sphere3D, Cone3D and Cylinder3D. Those all have incorrect UV mapping at the top and/or bottom.

Anyway, thank you for correcting the code. :)

Posted: Wed Mar 25, 2009 2:44 pm
by mpz
Hi Fluid,

i used some primitives for an other project and i was searching for working codes too. I found the Comtois codes usefull, but i use an other easier code for the sphere now. It is a little tricky to make usefull uv cords on different kinds of Meshs.

P.S. I am very interressting on your creation/manipulation of primitives.

best regards,
Michael