No Work this code.
Blitz3D Forums/Blitz3D Programming/No Work this code.
| ||
Type TGraphics3D Field ancho% Field alto% Field profundidad% Field modo% End Type Function Nuevo_Graficos3D(ancho%=800, alto%=600, profundidad%=0, modo%=2) Local G3D.TGraphics3D = New TGraphics3D G3D.TGraphics3D\ancho% = ancho% G3D.TGraphics3D\alto% = alto% G3D.TGraphics3D\profundidad% = profundidad% G3D.TGraphics3D\modo = modo% Estableciendo_ModoGrafico3D%(G3D.TGraphics3D) End Function Function Estableciendo_ModoGrafico3D%(TGrahics3D.TGraphics3D) If (GfxMode3DExists(TGrahics3D\ancho%, TGrahics3D\alto%, TGrahics3D\profundidad% )) Then Graphics3D (TGrahics3D\ancho%, TGrahics3D\alto%, TGrahics3D\profundidad%, TGrahics3D\modo% ) SetBuffer ( BackBuffer()) End If End Function Nuevo_Graficos3D%() Local Camara% = CreateCamera() Local cubo% = CreateCube() Local luz% = CreateLight() While Not KeyHit(1) RenderWorld Flip Wend Return MAV. |
| ||
For some reason you're creating your Camera but it's not Graphics3D first. I see you placed that inside a function but it does not get called properly.. |
| ||
Adding to that, no need to assign the field type name like this G3D.TGraphics3D\ancho% = ancho% should be just this G3D\ancho% = ancho% |
| ||
A better option would be getting a list of available graphics resolution on a video card Edit: quick solution is the depth should be in bits, example 16, 24, 32 Just change your line from Function Nuevo_Graficos3D(ancho%=800, alto%=600, profundidad%=0, modo%=2) to Function Nuevo_Graficos3D(ancho%=800, alto%=600, profundidad%=32, modo%=2) with 32 as your default example. You can't set it to automatic (0) as you're actually checking for a specific mode itself.. |
| ||
... |
| ||
Grapchis3D ( 800, 600, 0, 2) Here Ok. My Code not Work, on 0 Depth. oO? |
| ||
No you have to understand that the difference between setting the screen to checking the screen resolution available. They have different usage Set the resolution with 0 depth means Blitz3d will select the best possible "depth (optional) - colour depth of screen. Defaults to highest colour depth available." Graphics3D ( 800, 600, 0, 2) Now in the case of Graphics3DExists, you're the one manually checking if a specific depth you entered is available. Otherwise don't use it ;-) Those 2 commands have different purposes, one is automatically SETTING and the other is manually CHECKING, that is why you use it for conditional statement as you already did. I think you are just confused between the two at the moment. |
| ||
You have to read carefully the allowed values and how they work so you'll understand. Here's the manual for clarity: GfxMode3DExists( width, height, depth) Parameters: width - the width of the display mode you want to check for height - the height of the display mode you want to check for depth - the depth of the display mode you want to check for (YOU DON'T INPUT 0 HERE!), IT NEEDS ACTUAL DEPTH VALUES, EXAMPLE 16,24,32 For comparison Graphics width, height, color depth,[mode] Parameters: width = width of screen in pixels (640, 800, etc) height = height of screen in pixels (480, 600, etc) color depth = depth in bits (0, 16, 24, or 32 bit) <--- 0 VALUE IS ALLOWED HERE mode = Video mode (see description); Optional Now Clear? |
| ||
Graphics3D 800, 600, 0, 2 This does not set a screen resolution. The screen stays the same as it already was and an 800 x 600 window is created. GfxMode3DExists will always return 0 when depth is 0. The only screen depths I still see are 16 and 32. I have also seen 8 and 24, but that was many years ago. I don't know how common it is for a screen resolution to not support 3D. I don't encounter that on my hardware. Even my cheap Android tablet has 3D. Graphics 600, 600, 0, 2 modes = CountGfxModes() For t = 1 To modes s$ = "Mode W H D 3D? : " s = s + RSet( GfxModeWidth(t), 6 ) s = s + RSet( GfxModeHeight(t), 6 ) s = s + RSet( GfxModeDepth(t), 4 ) + " " If GfxMode3D( t ) s = s + "YES" Else s = s + "NO" End If Print s Next WaitKey |
| ||
What I'm saying is in general, it just happens because he sets it in window mode which is 2. where 'screen' is game screen resolution, not monitor resolution.. in window mode. GfxMode3DExists will always return 0 when depth is 0. That's what I'm already talking about. It does not even process 0 as a parameter unless it is documented somewhere.. hence you get 0 in return I have also seen 8 and 24, but that was many years ago. I don't know how common it is for a screen resolution to not support 3D. I don't encounter that on my hardware. yes, but I'm only trying to stick with what's said in the manual and explaining it to Yue.. don't worry I understand where you're coming from as I also have cheap and new hardware. ;-) color depth = depth in bits (0, 16, 24, or 32 bit) Even my cheap Android tablet has 3D. ..Same here |
| ||
lol, watching this thread, i have checked my graphic card, and the only valid depth mode is 32 bit >.< Grapchis3D ( 800, 600, 0, 2) Here Ok. My Code not Work, on 0 Depth. oO? just to clarify, this code does not take 0 : (i know, this has been said somewhere in the above's post) If (GfxMode3DExists(TGrahics3D\ancho%, TGrahics3D\alto%, TGrahics3D\profundidad% )) Then TGrahics3D\profundidad% need to be the valid numbers like 16,24,32 ... |
| ||
if they reazon , I was confused . :) |