opengl logger / debugger

BlitzMax Forums/OpenGL Module/opengl logger / debugger

Chris C(Posted 2005) [#1]
I'm looking for people to help me develop my opengl logger into a debugger. ie warn of incorrect gl commands in beween
glbegin and glend etc.

very early yet lots to be done!
pointers are just expressed as ints and gl enums are also ints instead of say "GL_MODELMATRIX"

contact me directly via my profile email if you are interested in helping
(just a thought from the info I'm getting you could store an opengl display list and see what tri's are being rendered from any point of view...)


just put this at the top of your code
Import "../gllogger/opengllogger.bmx"

heres some sample output
glClearColor  red_=0.000000000  green_=0.000000000  blue_=1.00000000  alpha_=0.000000000
glClearDepth  depth_=1.0000000000000000
glDepthFunc  func_=515
glEnable  cap_=2929
glShadeModel  mode_=7425
glColor3f  red_=1.00000000  green_=1.00000000  blue_=1.00000000
glClear  mask_=16640
glMatrixMode  mode_=5889
glLoadIdentity  
glViewport  x_=0  y_=0  width_=800  height_=300
glMatrixMode  mode_=5888
glLoadIdentity  
glRotatef  angle_=0.000000000  x_=0.000000000  y_=0.000000000  z_=1.00000000
glRotatef  angle_=0.000000000  x_=0.000000000  y_=1.00000000  z_=0.000000000
glRotatef  angle_=0.000000000  x_=1.00000000  y_=0.000000000  z_=0.000000000
glTranslatef  x_=0.000000000  y_=-8.00000000  z_=0.000000000
glPushMatrix 
glBindTexture  target_=3553  texture_=1
glTranslatef  x_=0.000000000  y_=0.000000000  z_=0.000000000
glRotatef  angle_=0.000000000  x_=0.000000000  y_=0.000000000  z_=1.00000000
glRotatef  angle_=0.000000000  x_=0.000000000  y_=1.00000000  z_=0.000000000
glRotatef  angle_=0.000000000  x_=1.00000000  y_=0.000000000  z_=0.000000000
glMatrixMode  mode_=5890
glPushMatrix 
glScalef  x_=1000.00000  y_=1000.00000  z_=0.000000000
glMatrixMode  mode_=5888
glBegin  mode_=7
glNormal3f  nx_=0.000000000  ny_=0.000000000  nz_=-1.00000000
glTexCoord2f  s_=1.00000000  t_=0.000000000
glVertex3f  x_=-5000.00000  y_=0.000000000  z_=-5000.00000
glTexCoord2f  s_=1.00000000  t_=1.00000000
glVertex3f  x_=-5000.00000  y_=0.000000000  z_=-5000.00000
glTexCoord2f  s_=0.000000000  t_=1.00000000
......



Chris C(Posted 2005) [#2]
glGetString GL_EXTENSIONS = GL_ARB_depth_texture GL_ARB_fragment_program .....(cut for readablity!)

starting to make some function human readable


eizdealer(Posted 2005) [#3]
This is helpful in most cases:
Local err:Int = glGetError()
If (err <> 0) Then
	Select err
		Case GL_INVALID_ENUM
			If Not Proceed ("OpenGL Error: GLenum argument out of range. Proceed?",1) Then End
		Case GL_INVALID_ENUM
			If Not Proceed ("OpenGL Error: GLenum argument out of range. Proceed?",1) Then End
		Case GL_INVALID_VALUE
			If Not Proceed ("OpenGL Error: Numeric argument out of range. Proceed?",1) Then End
		Case GL_INVALID_OPERATION
			If Not Proceed ("OpenGL Error: Operation illegal in current state. Proceed?",1) Then End
		Case GL_STACK_OVERFLOW
			If Not Proceed ("OpenGL Error: Function would cause a stack overflow. Proceed?",1) Then End
		Case GL_STACK_UNDERFLOW
			If Not Proceed ("OpenGL Error: Function would cause a stack underflow. Proceed?",1) Then End
		Case GL_OUT_OF_MEMORY
			If Not Proceed ("OpenGL Error: Not enough memory left to execute function. Proceed?",1) Then End
		Default
			If Not Proceed ("Unknown OpenGL Error. Proceed?",1) Then End
	End Select
EndIf

If it is not already part of your module.


Chris C(Posted 2005) [#4]
neat! I'd have got round to it, but it doesnt look like anyones interested, the main thing is that it does rather demonstrate the power of max that you can do these sorts of things