Shadow mapping problem...

General FreeBASIC programming questions.
Dr_D
Posts: 2415
Joined: May 27, 2005 4:59
Contact:

Shadow mapping problem...

Postby Dr_D » Oct 31, 2020 0:01

I was wondering if anyone has successfully used opengl shadow mapping in freebasic? I did it a long time ago, but I'm unable to get it to work now. I really can't tell if I'm doing something wrong or if there is something else wrong. If anyone has a demo or something, I'd love to see it. I'm at a loss and getting pretty frustrated. Thanks!
angros47
Posts: 1788
Joined: Jun 21, 2005 19:04

Re: Shadow mapping problem...

Postby angros47 » Oct 31, 2020 13:29

Your question is a bit too generic: first of all, there is no such a thing as "opengl shadow mapping": shadow mapping is an algorithm that can be implemented using several graphic drivers or libraries, including opengl. OpenGL itself doesn't include a "standard" way of doing shadow mapping, but it is possible to implement it in several ways. One way is to just precalculate the shadow and store the result in the texture (and this method is not performed by opengl, but by the program used to create the 3d model that your program will load.

Another method (and I guess it's what you are looking for) is the one described here: https://learnopengl.com/Advanced-Lighting/Shadows/Shadow-Mapping (I used a similar method in OpenB3D Plus, while normally OpenB3D uses stencil shadows).
This method can be implemented in FreeBasic if you have a modern version of OpenGL and the right headers for FreeBasic, but it also requires the use of shaders, that are piece of codes executed on the GPU and not on the CPU. The shaders are written in GLSL, a language that resembles C, and FreeBasic cannot be used as replacement (the "compiler" for GLSL is included in the video card driver, it's not a stand alone program).

So, if you want to implement the method described in the tutorial in FreeBasic only part of the code will be ported, part will remain the same.

Without seeing your code I have no way to know if you are doing anything wrong or not.
Dr_D
Posts: 2415
Joined: May 27, 2005 4:59
Contact:

Re: Shadow mapping problem...

Postby Dr_D » Oct 31, 2020 23:15

Thanks for replying, but I finally got it working. I haven't used ogl shadow maps for a few years because up until now my engine has been using stencil shadows, so I forgot some stuff about using the depth buffer in this way. Anyway, shadow maps have a distinct look (especially with a PCF shader) and I kinda want that for the game I'm currently making, so that's why I'm digging up old code and asking strange questions. Cheers! :)

Return to “General”

Who is online

Users browsing this forum: Baidu [Spider] and 10 guests