How to resolve the algorithm OpenGL step by step in the OxygenBasic programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm OpenGL step by step in the OxygenBasic programming language

Table of Contents

Problem Statement

Display a smooth shaded triangle with OpenGL.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm OpenGL step by step in the OxygenBasic programming language

Source code in the oxygenbasic programming language

  title="Rotating Triangle"
  include "OpenglSceneFrame.inc"


  sub Initialize(sys hWnd)
  '=======================
  SetTimer hWnd,1,10,NULL
  end sub
  '
  sub Scene(sys hWnd)
  '==================
  '
  static single ang1,angi1=1
  '
  glClearColor 0.3, 0.3, 0.5, 0
  glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
  '
  glLoadIdentity
  '
  '
  gltranslatef    0.0, 0.0, -4.0
  glrotatef ang1, 0.0, 0.0,  1.0
  '
  glBegin GL_TRIANGLES
  glColor3f   1.0, 0.0, 0.0 : glVertex3f   0.0,  1.0, 0.0
  glColor3f   0.0, 1.0, 0.0 : glVertex3f  -1.0, -1.0, 0.0
  glColor3f   0.0, 0.0, 1.0 : glVertex3f   1.0, -1.0, 0.0
  glEnd
  '
  'UPDATE ROTATION ANGLES
  '
  ang1+=angi1
  if ang1>360 then ang1-=360
  '
  end sub


  sub Release(sys hwnd)
  '====================
  killTimer hwnd, 1
  end sub

  

You may also check:How to resolve the algorithm Abundant, deficient and perfect number classifications step by step in the C programming language
You may also check:How to resolve the algorithm Anti-primes step by step in the Maple programming language
You may also check:How to resolve the algorithm Parsing/RPN calculator algorithm step by step in the CLU programming language
You may also check:How to resolve the algorithm Short-circuit evaluation step by step in the Prolog programming language
You may also check:How to resolve the algorithm Find limit of recursion step by step in the Erlang programming language