Recent

Author Topic: Are there any modern OpenGL tutorials for Pascal?  (Read 10160 times)

SlightlyOutOfPhase

  • New member
  • *
  • Posts: 8
Are there any modern OpenGL tutorials for Pascal?
« on: March 14, 2016, 12:15:51 am »
.
« Last Edit: February 21, 2020, 10:42:50 pm by SlightlyOutOfPhase »

Carver413

  • Full Member
  • ***
  • Posts: 119
Re: Are there any modern OpenGL tutorials for Pascal?
« Reply #1 on: March 14, 2016, 01:47:00 am »
there isn't much to pick from, a few game engines like nxPascal or the castle game engine, not really tutorials but it something. I learned most of what I know from C++ tutorials.
https://github.com/Zaflis/nxpascal
http://castle-engine.sourceforge.net/

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Are there any modern OpenGL tutorials for Pascal?
« Reply #2 on: March 14, 2016, 02:30:35 am »
Both of these engines use nothing but Immediate Mode..... Definitely not what SlightlyOutOfPhase was looking for.
« Last Edit: March 14, 2016, 02:39:47 am by Akira1364 »

Carver413

  • Full Member
  • ***
  • Posts: 119
Re: Are there any modern OpenGL tutorials for Pascal?
« Reply #3 on: March 14, 2016, 04:40:18 am »
Both of these engines use nothing but Immediate Mode..... Definitely not what SlightlyOutOfPhase was looking for.
both of these engines use shaders and vbo's which is much more then any of the included demo's that come with lazarus, at least last time I checked. true there is lots of legacy stuff but it is something. there is also a german site https://delphigl.com/ that has some interesting stuff in the wikki . the thing is that opengl doesn't really change no matter what language you use, most of the stuff I have gathered came from other language sources.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Are there any modern OpenGL tutorials for Pascal?
« Reply #4 on: March 14, 2016, 09:50:06 am »
This is a simple canvas that tries to do everything with VBO/PBO:

http://forum.lazarus.freepascal.org/index.php/topic,30556.msg194484.html#msg194484

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Are there any modern OpenGL tutorials for Pascal?
« Reply #5 on: March 15, 2016, 08:23:07 pm »
I would say shaders are overrated :p  If one wants to do a really commercial game there is Unity for that matter. Hobbyist game engines can never hope to compete with it.

But if you do have interest for actual programming side of it, then sure they can be fun too. What i tried to do with nxPascal is to wrap OpenGL and most of every gaming related functionality to more easier to use classes. You can do almost everything without using any OpenGL commands from its header.

As far as shaders go i would say it was still a work in progress, but i guess it was mainly about writing shaders themselves which i'm not so good at. So 3D part of it may be lacking, but nothing that can't be solved if you delve into shaders yourself. I did most i could to make support for multiple shaders, and here's example of it: https://github.com/Zaflis/nxpascal/blob/master/demos/fpc/walker_shader/GraphicsUnit.pas

Basically it went this high level use, much much easier than if you were to use actual OpenGL directly. Renderer is definitely not immediate mode, even though most of older nxPascal visuals are:
Code: Pascal  [Select][+][-]
  1. renderer.EnableProgram(renderProgram, false);
  2. renderer.DrawRotateS(position.x, position.y, trunc(anim), 0, 0.5, 20/27, -17, 26)

ChrisR

  • Full Member
  • ***
  • Posts: 247
Re: Are there any modern OpenGL tutorials for Pascal?
« Reply #6 on: May 31, 2016, 05:59:50 pm »
I would suggest you look at this
  http://wiki.freepascal.org/OpenGL_Tutorial#Modern_OpenGL_using_OSX
A simple Lazarus project that uses modern OpenGL is this
  https://github.com/neurolabusc/plyview
Targeting Linux and Windows is pretty straightforward, as they include support for both modern and legacy OpenGL. However, if you want to target OSX as well you need to choose whether you want to target legacy OpenGL 2.1 or the CORE implementation of OpenGL 3.3+ (the CORE version removes a lot of legacy features). These examples show you code that works on OSX, Windows and Linux. Writing shaders is challenging, but the performance benefits can be huge.

 

TinyPortal © 2005-2018