Author Topic: Shaders  (Read 472 times)

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1773
    • View Profile
    • Homepage
Shaders
« on: 2019-May-13 »
Would this be useful as a basis for learning shaders to use in GLBasic?

https://news.ycombinator.com/item?id=19895218

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1634
  • Particle Hawk
    • View Profile
Re: Shaders
« Reply #1 on: 2019-May-13 »
shaders are wonky in glbasic
i have a thread somewhere with a couple examples
one of the main things is, you cannot pass vectors like typical shaders code eg. vec2 vec3 etc
To get it to work, you have to split inputs into single values and then pass them into the shader code.
other than that, shaders seem to work as expected, its just alot of work to convert them to glbasic friendly.

ps. no, i don't see enough info on those pages to get started in glbasic....there isn't anywhere on the web that will.
You have to learn the gpu language before even attempt glbasic shaders.
You have to learn minimally about vec2 vec3 vector lists, and be able to expand them into single dimensions as input.
« Last Edit: 2019-May-13 by Hemlos »
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Snoopy

  • Dr. Type
  • ****
  • Posts: 260
    • View Profile
Re: Shaders
« Reply #2 on: 2019-May-13 »
I don't see the problem you're talking about Hemlos  O_O
It's quite possible to use the GLSL in a normal way in GLB and using the vector system (vec2, vec3, vec4).

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1634
  • Particle Hawk
    • View Profile
Re: Shaders
« Reply #3 on: 2019-May-14 »
Glbasic doesn't have vector variables, you have to pass single values, and rebuild it inside the shader code as a vec2 3 4
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Snoopy

  • Dr. Type
  • ****
  • Posts: 260
    • View Profile
Re: Shaders
« Reply #4 on: 2019-May-14 »
But that's normal, it's like the interactions between GLB and C language O_O
This is not a problem specific to Shaders in GLB but a problem of normal conversion of data types between GLB and ... the rest.

I'm too tired to explain myself better on this subject (especially in English :rant:), but we'll talk again because it's an interesting subject ;)


Offline dreamerman

  • Global Moderator
  • Dr. Type
  • *******
  • Posts: 286
    • View Profile
    • my personal website
Re: Shaders
« Reply #5 on: 2019-May-15 »
Already available shaders can be some base if you need basic/simple effects, only issue is that they are scattered on different forum threads.
Helmos I saw that topic some time ago but forgot to mark it, and now I can't find it :D
Check my source code editor for GLBasic - link

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1634
  • Particle Hawk
    • View Profile
Re: Shaders
« Reply #6 on: 2019-May-15 »
hmm oh ya, i started this thread when i started playing with the shaders in glb

https://www.glbasic.com/forum/index.php?topic=3148.msg22927#msg22927

note: its 10 years old thread with some relevent information tho, however, i dont know if the code still works the same.
gernot helped share some important info there too
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline dreamerman

  • Global Moderator
  • Dr. Type
  • *******
  • Posts: 286
    • View Profile
    • my personal website
Re: Shaders
« Reply #7 on: 2019-May-15 »
Was it this topic? I think that there was also another one, but maybe not started by You, it had shaders included as sources not as attachments (that are now unavailable). Still this topic also gives some important info :)
Check my source code editor for GLBasic - link