Hey, I'm trying to learn some raw openGL, unsurprisingly, using this is ungodly fast, I'm getting like 6000-8000+fps :O
Anyways, i'm trying to keep this box's orientation for the Y axis straight up and down.
Here's an example illistrating the problem... S/A for rotation increments, and UP/DOWN cursors for movement
Basicly, when the box is rotated, if you try to move it, it will move in the direction it's rotated in. NOT the direction up and down like I want it too.
Anyone know what i'm doing wrong?
Also any tutorials out there that can help me learn openGL would be appriciated!
Anyways, i'm trying to keep this box's orientation for the Y axis straight up and down.
Here's an example illistrating the problem... S/A for rotation increments, and UP/DOWN cursors for movement
SuperStrict GLGraphics 800, 600 Global Vertices:Float[] = [-1.0, 1.0, -10.0, 1.0, 1.0, -10.0, 1.0, -1.0, -10.0, -1.0, -1.0, -10.0]' X Y X? Global Colors:Float[] = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0] ' R G B? 'initalize stuff glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(45.0, 1.3333, 1, 1000) glMatrixMode(GL_MODELVIEW) glLoadIdentity() Local r:Float = 0 'Rotation Local _FPS:Int ' FPS Local _FPSTICK:Int ' FPS ticker Local _FPSTIME:Int = MilliSecs() ' FPS Timer While Not KeyDown(KEY_ESCAPE) glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) 'Cls 'Add/Subtract rotation value with S/A If KeyHit(KEY_S) r:+2 If KeyHit(KEY_A) r:-2 If r > 359 r = 0 If r < 0 r = 359 'TRY to move block up and down... Problems... trying to increment the Y value If KeyDown(KEY_UP) Vertices[1]:+.2 Vertices[4]:+.2 Vertices[7]:+.2 Vertices[10]:+.2 If KeyDown(KEY_DOWN) Vertices[1]:-.2 Vertices[4]:-.2 Vertices[7]:-.2 Vertices[10]:-.2 'Enable certain drawing states glEnableClientState(GL_VERTEX_ARRAY) glEnableClientState(GL_COLOR_ARRAY) 'Draw box glRotated(r,0,0,-10.0) 'Setrotation() ? glColorPointer(3, GL_FLOAT, 0, Colors) glVertexPointer(3, GL_FLOAT, 0, Vertices) glDrawArrays(GL_QUADS, 0, 4) 'Disable the enabled drawing states glDisableClientState(GL_VERTEX_ARRAY) glDisableClientState(GL_COLOR_ARRAY) 'FPS updating GLDrawText _FPS,0,0 _FPSTICK:+1 If MilliSecs() > _FPSTIME+1000 _FPS = _FPSTICK _FPSTICK = 0 _FPSTIME = MilliSecs() End If Flip 1 Wend End
Basicly, when the box is rotated, if you try to move it, it will move in the direction it's rotated in. NOT the direction up and down like I want it too.
Anyone know what i'm doing wrong?
Also any tutorials out there that can help me learn openGL would be appriciated!