right heres where its at tonight the exe works and after making it tiny it goes to 1028 bytes.
' sek the intro fairy...
' use and abuse but a credit is a wonderful thing
' t2 sek would do.
' modifiyed for fb by nino
#include "windows.bi"
#include "GL/gl.bi"
#include "GL/glu.bi"
#include "GL/glext.bi"
declare Sub WinMainCRTStartup alias "WinMainCRTStartup"
Dim shared Vsh As zstring * 170 => "varying vec4 c;void main(){gl_Position=gl_Vertex+vec4(gl_Normal,1)*abs(dot(sin((gl_Vertex+ftransform())*9.9),vec4(4)));c=cos(gl_Position*0.04)*length(gl_Position*0.04);}"
' the fragment shader - do as litte as possible here...
' take c and interpolate and ssign to the ouput fragcolor...
Dim Shared Fsh As Zstring * 47 => "varying vec4 c; void main(){ gl_FragColor=c; }"
Type GenFP As Sub () Ptr
Dim Shared As GenFP glFP(7)
dim shared glnames(6) as zstring * 16 => {"glCreateShader", "glShaderSource", "glCompileShader", "glCreateProgram", "glAttachShader", "glLinkProgram", "glUseProgram"}
Dim Shared As GLuint V , F , P
Dim Shared As Integer i
Dim Shared Ts As Zstring Ptr
Dim Shared As PIXELFORMATDESCRIPTOR pfd
Dim Shared As HDC hDC
Sub WinMainCRTStartup()
' minimal windows setup code for opengl
pfd.cColorBits = pfd.cDepthBits = 32
pfd.dwFlags = PFD_SUPPORT_OPENGL Or PFD_DOUBLEBUFFER
hDC = GetDC ( CreateWindow("edit", 0, WS_POPUP Or WS_VISIBLE Or WS_CLIPSIBLINGS Or WS_CLIPCHILDREN Or WS_MAXIMIZE , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) )
SetPixelFormat ( hDC, ChoosePixelFormat( hDC, @pfd) , @pfd )
wglMakeCurrent ( hDC, wglCreateContext(hDC) )
For i = 0 To 6
glFP( I ) = Cast( GenFP , wglGetProcAddress( glnames( I ) ) )
Next
V = Cast( PFNGLCREATESHADERPROC , glFP( 0 ) ) ( GL_VERTEX_SHADER )
F = Cast( PFNGLCREATESHADERPROC , glFP( 0 ) ) ( GL_FRAGMENT_SHADER )
P = Cast( PFNGLCREATEPROGRAMPROC , glFP( 3 ) ) ( )
Ts = @vsh
Cast( PFNGLSHADERSOURCEPROC , glFP(1) ) ( v , 1 , Cast( Byte Ptr Ptr , @Ts ) , NULL )
Cast( PFNGLCOMPILESHADERPROC , glFP(2) ) ( v )
Ts = @Fsh
Cast( PFNGLSHADERSOURCEPROC , glFP(1) ) ( f , 1 , Cast( Byte Ptr Ptr , @Ts ) , NULL )
Cast( PFNGLCOMPILESHADERPROC , glFP(2) ) ( f )
Cast( PFNGLATTACHSHADERPROC , glFP(4) ) ( p , v )
Cast( PFNGLATTACHSHADERPROC , glFP(4) ) ( p , f )
Cast( PFNGLLINKPROGRAMPROC , glFP(5) ) ( p )
Cast( PFNGLUSEPROGRAMPROC , glFP(6) ) ( p )
ShowCursor(FALSE)
do
' we draw 3 spheres using the same shader which is *very* senesitive to radius
' so we see a 3 fold effect ... a trinity
glRotatef(3,3,3,3)
gluSphere( gluNewQuadric() , 1.6 , 200 , 200 )
gluSphere( gluNewQuadric() , 1.04 , 200 , 200 )
gluSphere( gluNewQuadric() , 0.4 , 200 , 200 )
SwapBuffers ( hDC )
Loop while ( GetAsyncKeyState(VK_ESCAPE) = 0 )
End Sub
exe and project folder attached.