Author Topic: Basic Opengl Window  (Read 3526 times)

0 Members and 1 Guest are viewing this topic.

Charles Pegge

  • Guest
Basic Opengl Window
« on: April 08, 2011, 11:15:48 PM »

This zip is for Kent. It belongs in the examples/GUI folder and I will include it in future releases.

Opengl is fiddly to setup but you won't need to change it much between programs :)

snippet
Code: [Select]
   glClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT
    glClearColor 0.5, 0, 0, 0
    '
    '
    'SHAPE
    '
    s1=.2    'x y
    s2=-1    'z
    s3=0.5   'color
    s4=s3*.2 'color
    '
    glrotatef ang1, 0,0,1
    '
    glbegin GL_QUADS
    glcolor4f   00,  s3,  s3, 1 : glvertex3f -s1, -s1,  s2
    glcolor4f   s3,  s3,  00, 1 : glvertex3f  s1, -s1,  s2
    glcolor4f   s4,   0,  s3, 1 : glvertex3f  s1,  s1,  s2
    glcolor4f   s4,   0,  s3, 1 : glvertex3f -s1,  s1,  s2
    glend
    '
    glfinish
    swapBuffers hdc
    '
    '
    'UPDATE ROTATION ANGLES
    '----------------------
    '
    ang1+=angi1

Charles



[attachment deleted by admin]
« Last Edit: April 08, 2011, 11:21:24 PM by Charles Pegge »

kryton9

  • Guest
Re: Basic Opengl Window
« Reply #1 on: April 09, 2011, 12:22:37 AM »
Thanks Charles. I wasn't sure if all those includes and some libs were necessary, but I guess they are for even a minimal opengl.

Charles Pegge

  • Guest
Re: Basic Opengl Window
« Reply #2 on: April 09, 2011, 12:55:22 AM »

Hi Kent,

This example only uses the headers. With PortViewer2 on the other hand, the approach is to build a library of classes and procedures and keep the front end as short as possible.

So far Opengl is the only API for which I include a full set of headers. So many definitions are needed.

Charles

JRS

  • Guest
Re: Basic Opengl Window
« Reply #3 on: April 09, 2011, 01:35:49 PM »
Quote
So far Opengl is the only API for which I include a full set of headers. So many definitions are needed.

Have you approached Jose Roca and asked he would be willing to extend his includes to support OxygenBasic?

 

Charles Pegge

  • Guest
Re: Basic Opengl Window
« Reply #4 on: April 09, 2011, 03:40:06 PM »

Hi John,

We discussed using the headers about 2 years ago and I have tested PortViewer1 with José's Opengl headers. But they are geared towards PB which means some loss of concise definition due to the lack of support for typedefs and enumerations in PB.

Basic headers in general  are also more verbose than the original  C headers so I have focussed on using the latter and avoiding the translation step.

However José's encyclopaedic set of examples are a valuable resource and quite easy to refer to and port to Oxygen.

Charles