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.

Alright, I got that much, but now i'm trying to create a little mini engine to draw rects around...

How do I...

-Change prepective to 0,0 = top left cornor?
-Draw dimensions in pixels?

here's what I have so far, i'm stumped...

SuperStrict
Framework pub.OpenGL
Import BRL.GLGraphics

GLGraphics 800, 600


Type TGLPrimative
	Field X:Float,Y:Float
	Field Ox:Float,Oy:Float
	Field RotAngle:Int
	Field Width:Int,Height:Int
End Type


Type TGLQuad Extends TGLPrimative
	Field v1x:Float, v1y:Float
	Field v2x:Float, v2y:Float
	Field v3x:Float, v3y:Float
	Field v4x:Float, v4y:Float


	Method Init(_x:Float,_y:Float,w:Int,h:Int)
		X = _x/800
		Y = _y/600
		Width = w/800
		Height = h/600
		Ox = X
		Oy = Y
		
		'top left
		v1x = X
		v1y = Y
		'top right
		v2x = X+Width
		v2y = Y
		'bottom right
		v3x = X+Width
		v3y = Y-Height
		'bottom left
		v4x = X
		v4y = Y-Height
	End Method
	
	Method Render()
		glTranslatef(x-Ox, y-Oy,0)
		glRotatef(RotAngle,0,0,1.0)
		
		glBegin(GL_QUADS)
		
		glColor3f(.2,.6,.55)
		glVertex3f(v1x,v1y,-.0001)
		
		glColor3f(.22,.7,.9)
		glVertex3f(v2x,v2y,-.0001)
		
		glColor3f(.56,.2,.5)
		glVertex3f(v3x,v3y,-.0001)
		
		glColor3f(.33,.9,.2)
		glVertex3f(v4x,v4y,-.0001)
		
		glEnd()
	End Method
End Type


'other initalizing stuff
InitalizeGL() 'initalize opengl stuff (beyound my comprehension at the moment)
Local _FPS:Int ' FPS
Local _FPSTICK:Int ' FPS ticker
Local _FPSTIME:Int = MilliSecs() ' FPS Timer


Local MyBox:TGLQuad = New TGLQuad
MyBox.Init(200,200,100,100)


'Main loop, quit on KEY_ESCAPE
While Not KeyDown(KEY_ESCAPE)
	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) 'Cls but opengl
	glLoadIdentity
	MyBox.Render()
	
	
	'FPS updating
	GLDrawText _FPS,0,0
	_FPSTICK:+1
	If MilliSecs() > _FPSTIME+1000
		_FPS = _FPSTICK
		_FPSTICK = 0
		_FPSTIME = MilliSecs()
	End If
	Flip 1
Wend
End

Function InitalizeGL()
	glMatrixMode(GL_PROJECTION)
	glLoadIdentity()
	gluPerspective(45.0, 1.3333, 1, 1000)
	glMatrixMode(GL_MODELVIEW)
	glLoadIdentity()
End Function


Nothing is being drawn oddly enough... I thought that 1.0 ment the whole screen so I divided 1 by 800 for x, which should give me pixels? I did the same for Y.

I also looked at the DrawRect function in GLGraphics.mod... What is BeginOrtho and EndOrtho? Does that have to do with changing prepective?

Thanks in advance!