View Full Version : Super Demos!
Reinking
17-01-2006, 01:09
Psch,
Nice work!
I've got an strange problem running the SimpleChart3 script. Could this be a problem with my hardware? I am playing around with the background color settings using the function tbgl_BackColor r, g, b, and whenever I set the combined color values of rgb greater then 6553599 {eg. RGB(255, 255, 99)} thinBasic crashes and my gl driver file sisgl.dll is flagged. Any idea what is happening?
Regards,
John
Reinking
17-01-2006, 01:43
Ok, got it working.
I didn't have enough shared video memory. My AAS (AGP Apeture Size) in BIOS was set to 64 MB; doubling it works, so I tripled it for good measure. I guess OpenGL can use up video RAM pretty quickly.
Is there a way to predict the amount of RAM you are about to consume, or any ideas on how to trap the error when you're short?
Regards,
John
Petr Schreiber
17-01-2006, 14:03
Hi John,
I'm glad you like the chart.
Thank you a lot for information about troubles with your graphic card.
I'm testing my scripts on older GeForce 2 MX 64 MB on Win98, and newer Radeon 9600 128 MB on WinME. No problems found yet with these cards, although GeForce has "only" 64 MB of memory. I will test here also the latest chart example and let you know.
I presume your SiS card is onboard one. I'm quite surprised by the
unsuffciency of 64 MB for graphics :(.
The sisgl.dll is some OpenGL wrapper for these cards - Super VGA OpenGL ICD.
It means I can hardly predict the behaviour and level of this implementation of OpenGL on your system. But don't worry :).
The possible reasons, why it takes so much memory could be caused by various facts:
The ICD driver way of emulation, I will try to google out how it works.
I force 32bit colors for rendering in windowed mode ( in fullscreen it's selectable - 16, 24 or 32 ).
I should allow you to setup bit depth in windowed mode too
Second important thing is the size of viewport ( ~= rendered window area ). Bigger resolutions takes more memory.
Next factor is the handling of textures. The filter specified when loading them is key feature. The best one - TBGL_TEX_MIPMAP results in perfect
quality of displayed textures, but it can take a far more memory comparing to the others, because it internally creates sets of variations of one texture for better quality.
The last factor is the use of display lists ( I use them a lot ). They can save
a lot of speed problems by "precaching" the model in memory of card, but I'm not sure now, how much they take.
In next releases of TBGL I will implement some info functions, which should return the name of 3D card, vendor, version of drivers, maximum resolution of textures, ... and even the
free memory space.
Thanks again for your information,
Psch
Petr Schreiber
26-01-2006, 17:43
Hi John,
I think I found at least temporary solution to general detection of memory "problems".
To introduce simple memory troubles checker just follow this 2 steps.
:arrow: Declare this at the beginning of the program:
%GL_OUT_OF_MEMORY = &H0505
DECLARE FUNCTION glGetError LIB "opengl32.dll" ALIAS "glGetError" () AS DWORD
:arrow: Insert this in the main loop of the program, but OUTSIDE any possible tbgl_BeginPoly / tbgl_EndPoly :
IF glGetError = %GL_OUT_OF_MEMORY THEN
MSGBOX hWnd, "Not Enough Graphic Memory", %MB_OK or %MB_ICONERROR, "TBGL Error"
EXIT WHILE
END IF
It should generate error message when the memory will be overfilled :)
Regards,
Psch
Petr Schreiber
26-05-2006, 22:18
Hi,
don't know if still interested, but I have found even more convenient sollution to catch and analyze errors. It is based on some info from "OpenGL Programming Guide"
DECLARE FUNCTION gluErrorString LIB "glu32.dll" ALIAS "gluErrorString" (BYVAL errCode AS DWORD) AS LONG
DECLARE FUNCTION glGetError LIB "opengl32.dll" ALIAS "glGetError" () AS DWORD
function CheckForGLError() as long
dim errorCode as long
dim errorDescription as long
errorCode = glGetError()
IF errorCode <> %GL_NO_ERROR THEN
errorDescription = gluErrorString(errorCode)
MSGBOX hWnd, "Error description: "+peek$(errorDescription, 255), %MB_OK or %MB_ICONERROR, "TBGL Error"
function = 1
else
function = 0
eND IF
end function
... just call this function to detect if some problem occured, now it also returns full error description.
Petr
P.S. It is quite funny that this function returns in case of error for example "operazione non valida" although I have Czech OpenGL drivers and localized operating system :D !