BASIC

Author Topic: Better support for shaders  (Read 1251 times)

Offline kanonet

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1142
    • View Profile
    • My GLBasic code archiv
Better support for shaders
« on: 2013-Mar-15 »
I did play around with shaders in last time and got some nice effects for the beginning. But it would be really useful if we could get some more feature to use them better/ more properly:

1. X_PUTSHADER needs to get extended to store other data types like:
GLB -> glsl shader
DGInt -> float (only thing that currently works)
array[2] -> vec2
array[3] -> vec3
array[4] -> vec4
array[9] -> mat3
array[16] -> mat4
sprite ID -> sampler2D (i need a way to input more textures/ offscreen buffers)
[ TYPE (of DGInts) -> C struct (of floats) ]
Cause its very much work (and a dirty work around) to break everything into many floats and pass each float on its own into the shader. We can not do this with INLINE on our own atm.

2. Extend X_GETCAMERAMATRIX (with optional parameter, or create a new command?) so that it can output each of the matrix:
modelviewmatrix
projectionmatrix
[texturematrix]
Yes we can do this with INLINE on our own, but Im not sure if it will work on all platforms. So a native solution would be awesome.


I understand that this are advanced features and that GLB is designed to be easy - but since I do not request to remove any feature, it will not get harder for anyone. Btw. i do not need to get these functions directly in GLB, it would be totally ok, if there were some easy to use C functions that we can use with INLINE on ALL platforms. Thank you for you work Kitty!
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2459
    • View Profile
Re: Better support for shaders
« Reply #1 on: 2013-Mar-16 »
+1 for these requests.  :good:

Also, I personally would love support for OpenGLES 2.0, so that we could use shaders on the mobile platforms. I simply can't do certain things(Shadows for example) efficiently enough to use without shaders on mobile platforms. OpenGLES 1.1 is very old now and there are not many devices that rely on it.

That being said, I do realise that moving from a fixed function pipeline to a programmable one is no easy task.  :noggin:
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3321
  • Integrated Brain
    • View Profile
Re: Better support for shaders
« Reply #2 on: 2013-Mar-16 »
I think the great trouble of OpenGLes 2.0 it's make running over windows, if I'm not wrong by default not it's implemented and it's necessary an emulator, like in Eclipse whit the Mali SDK...

Another point important about this... I speak whit people use Unity and I try whit Shiva , a couple of shaders and have to be very carefully, because some shaders drop down the FPS really a lot...

Really I like have more support for 3D, GLBasic can do awesome things, but I think not too much people use GLbasic for 3D...  :'(