[futurebasic] Re: [FB] OpenGL

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 2012 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Tue, 13 Mar 2012 19:38:36 +1300
Robert Covington wrote:

> Also, with gluDisk, seems you have to make 2 lists, and flip one 180, otherwise the back of a gluDisk does not show up? (might be setting issue)

IIRC, both sides should show if you turn off face culling.
    glDisable( GL_CULL_FACE );


> Further, gluDisk is infinitely thin it seems, rings need to be about as thick as a 33LP  record of yore proportionally.

Here's a squashed torus, but I don't think it will be easily textured.
Robert P.

'----------------
include "Util_CE.incl"
include "Tlbx agl.incl"
include "Tlbx glut.incl"

local mode
local fn DrawShape( rotation as double )
'~'1
glMatrixMode( _GLMODELVIEW )
glLoadIdentity()
glRotated( rotation, -0.25, 1.0, -0.1 )
glScalef( 1, 1, .2 ) // squash
glutWireTorus( 0.3, 0.6, 24, 16 )
end fn


local mode
local fn DoFrame( theTimer as EventLoopTimerRef, userData as pointer )
'~'1
dim as AGLContext  glContext : glContext = userData
begin globals
dim as double      sRotation
end globals

glClearColor( 0.0, 0.0, 0.4, 1.0 ) 
glClear( _GLCOLORBUFFERBIT )
fn DrawShape( sRotation )
sRotation += 0.5
aglSwapBuffers( glContext )
end fn



dim as GLint           attrib(2)
dim as CGrafPtr        port
dim as AGLPixelFormat  fmt
dim as AGLContext      glContext

window 1, "Squashed Torus", (0,0) - (500,500)
attrib(0) = _AGLRGBA
attrib(1) = _AGLDOUBLEBUFFER
attrib(2) = _AGLNONE 
fmt = fn aglChoosePixelFormat( 0, 0, attrib(0) ) 
glContext = fn aglCreateContext( fmt, 0 ) 
aglDestroyPixelFormat( fmt )
port = window( _wndPort )
fn aglSetDrawable( glContext, port )
fn aglSetCurrentContext( glContext )
fn CETimerInstall( 0, 0.0, 0.015, @fn DoFrame, glContext )
RunApplicationEventLoop()
'----------------