Learning bumps...

BlitzMax Forums/BlitzMax OpenGL Programming/Learning bumps...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

there is not much I can help you with either sence I am kind of where you are at right now.

I have some more code that might help you. hopefully this will help you with objects creation:
'********************************************************************
'********************************************************************
'* Example 3: A fully interactive 3D world with OpenGL              *
'********************************************************************
SuperStrict
Framework pub.OpenGL
Import BRL.GLGraphics

Global is_depth:Int; ' depth testing flag 

	GLGraphics 800, 600


	glMatrixMode(GL_PROJECTION)
	glLoadIdentity()
	gluPerspective(45.0, 1.3333, 1, 1000)
	glMatrixMode(GL_MODELVIEW)
	glLoadIdentity()
	init();
Repeat 
	display()
	keyboard()
 
	'this time we're going to keep the aspect ratio
	'constant by trapping the window resizes 

	resize()  
	Flip()
Until KeyDown(KEY_ESCAPE)


Function init()

	glClearColor(0.0, 0.0, 0.0, 0.0);
	glEnable(GL_DEPTH_TEST);
	is_depth = 1;
	glMatrixMode(GL_MODELVIEW);
End Function

Function display()

	If (is_depth)
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	Else
		glClear(GL_COLOR_BUFFER_BIT);
	EndIf
	' draw the Floor 
	glBegin(GL_QUADS);
		glColor3f(0.2, 0.2, 0.2);
		glVertex3f(-100.0, 0.0, -100.0);
		glColor3f(0.4, 0.4, 0.4);
		glVertex3f(-100.0, 0.0, 100.0);
		glColor3f(0.6, 0.6, 0.6);
		glVertex3f(100.0, 0.0, 100.0);
		glColor3f(0.8, 0.8, 0.8);
		glVertex3f(100.0, 0.0, -100.0);		
	glEnd();
	' draw 12 cubes with different colors 
	drawcube(75, 57, 2);
	drawcube(-65, -12, 3);
	drawcube(50, -50, 1);
	drawcube(-56, 17, 2);
	drawcube(67, 12, 3);
	drawcube(-87, 32, 1);
	drawcube(-26, 75, 2);
	drawcube(57, 82, 3);
	drawcube(-3, 12, 1);
	drawcube(46, 35, 2);
	drawcube(37, -2, 3);
End Function

Function keyboard()

	Rem This time the controls are:
	
	  "a": move Left
	  "d": move Right
	  "w": move forward
	  "s": move back
	  "t": toggle depth-testing

	EndRem
	Select True
	
		Case KeyDown(key_A)
			glTranslatef(5.0, 0.0, 0.0);
		Case KeyDown(KEY_D)
			glTranslatef(-5.0, 0.0, 0.0);
		Case KeyDown(KEY_W)
			glTranslatef(0.0, 0.0, 5.0);
		Case KeyDown(KEY_S)
			glTranslatef(0.0, 0.0, -5.0);
		Case KeyDown(KEY_T)
			If (is_depth)
			
				is_depth = 0;
				glDisable(GL_DEPTH_TEST);
			
			Else
			
				is_depth = 1;
				glEnable(GL_DEPTH_TEST);
			EndIf	
	EndSelect
	display();
End Function

Function resize(width:Int=1, height:Int=1)

	If height = 0 Then height = 1;
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();

	' note we divide our width by our height To get the aspect ratio 
	gluPerspective(45.0, width / height, 1.0, 400.0);

	' set initial position 
	glTranslatef(0.0, -5.0, -150.0);

	glMatrixMode(GL_MODELVIEW);

End Function

Function drawcube(x_offset:Int, z_offset:Int, color:Int)

	' this Function draws a cube centerd at (x_offset, z_offset)
	'x And z _big are the back And rightmost points, x And z _small are
	'the front And leftmost points 
	Local x_big:Float   = Float(x_offset + 5)
	Local z_big:Float   = Float(z_offset + 5)
	Local x_small:Float = Float(x_offset - 5)
	Local z_small:Float = Float(z_offset - 5)
	Select color
		Case 1
			glColor3f(1.0,0.0,0.0)
		Case 2
			glColor3f(0.0,1.0,0.0)
		Case 3
			glColor3f(0.0,0.0,1.0)
	End Select
	glBegin(GL_QUADS);
		glVertex3f(x_small,10.0,z_big); 'front
		glVertex3f(x_small,0.0,z_big);
		glVertex3f(x_big,0.0,z_big);
		glVertex3f(x_big,10.0,z_big);

		glVertex3f(x_big,10.0,z_small); ' back 
		glVertex3f(x_big,0.0,z_small);
		glVertex3f(x_small,0.0,z_small);
		glVertex3f(x_small,10.0,z_small);

		glVertex3f(x_big,10.0,z_big); ' Right 
		glVertex3f(x_big,0.0,z_big);
		glVertex3f(x_big,0.0,z_small);
		glVertex3f(x_big,10.0,z_small);

		glVertex3f(x_small,10.0,z_small); ' Left
		glVertex3f(x_small,0.0,z_small);
		glVertex3f(x_small,0.0,z_big);
		glVertex3f(x_small,10.0,z_big);

		glVertex3f(x_small,10.0,z_big); ' top 
		glVertex3f(x_big,10.0,z_big);
		glVertex3f(x_big,10.0,z_small);
		glVertex3f(x_small,10.0,z_small);

		glVertex3f(x_small,0.0,z_small); ' bottom 
		glVertex3f(x_big,0.0,z_small);
		glVertex3f(x_big,0.0,z_big);
		glVertex3f(x_small,0.0,z_big);
	glEnd();
End Function