Author Topic: GLSL shader with Png Image and Scroller Support [Code Included]  (Read 26058 times)

0 Members and 1 Guest are viewing this topic.

Offline waste

  • C= 64
  • **
  • Posts: 50
  • Karma: 2
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #20 on: April 20, 2017 »

amazing , thanks guys  !
 

inc. always at top level  ;D

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 119
  • Karma: 4
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #21 on: April 20, 2017 »
Just For fun i added to your demo script,
Added mod playing via IncludeBinary
Added get Shader from IncludeBinary
Logo moves with the mouse

« Last Edit: April 30, 2017 by Omnikam »

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #22 on: April 20, 2017 »
nice try. you should the "drag logo" feature activate on #PB_MouseButton_Right. and if you press again RMB then the logo should stay on its new location.

#WM_LBUTTONDOWN is reserved for "drag the whole window".

Let me see your scroller. Yes i have scroller code but no time to add into the glsl thing.

merged with this thread:
 http://www.dbfinteractive.com/forum/index.php?topic=6674.msg83811#msg83811


( a bit different - the music player comes from the mp3d Lib. i like the clean sound of v2m tunes )
« Last Edit: April 30, 2017 by inc. »
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 119
  • Karma: 4
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #23 on: April 20, 2017 »
The installer was 32bit only  :o   Im 64bit
Attached some psudo code, it`s in C but can be adapted, The actual scrolling routine is left out

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #24 on: April 20, 2017 »
No need for 64Bit.  Install the 32bit.  Also working nice on x64. I have installed on my x64 sys the Purebasic x86 Version. No idea why using pbx64.

After installing, do not forget to setup in Compiler option at lib Subsystem: DX9

I have PureBasic Scroller code. No need to translate C to PB

I'll check your attachment later. Not on my PC ATM.
« Last Edit: April 20, 2017 by inc. »
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 119
  • Karma: 4
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #25 on: April 21, 2017 »
Just an article I trawled from the Internet, I liked it because it was basically a the standard scroller but using glsl shader


Okay got it all up and running, ;D
« Last Edit: April 21, 2017 by Omnikam »

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #26 on: April 21, 2017 »
did you added the option:

"you should the "drag logo feature" activate on #PB_MouseButton_Right and if you press again RMB then the logo should stay on its new x/y location"

scroller is up and running too?
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 119
  • Karma: 4
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #27 on: April 22, 2017 »
Had no time,  school holidays and son's birthday party.  Will take a shot at it in a day or 2.  Been surrounded by 6 year olds all day  :boxer: I'm off to a well earned sleep. I think it won't be too hard to add a scroller,  I have a idea,  just need some time to code it in.  I'll post my code in a few days  :)

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #28 on: April 22, 2017 »
Nah,  no rush.  It's only my reply of your post:
"Okay got it all up and running"
I thought u already made it :D
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 119
  • Karma: 4
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #29 on: April 23, 2017 »
Ahh, I wish  ;D   The Scroller Is a pain is the ass look at it if you will, but i warn you it might be hard to follow, it is for me  :carrot:

Ps i borrowed code from the Vroom remake demo
« Last Edit: April 30, 2017 by Omnikam »

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 119
  • Karma: 4
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #30 on: April 24, 2017 »
So after more tinkering i have the scroller working, but now the image doesnt display and the nice nurbs shader is static

« Last Edit: April 30, 2017 by Omnikam »

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 119
  • Karma: 4
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #31 on: April 24, 2017 »
Okay inc  ;D I have both the Shader and the Scrolling text working  :bfuck2:
I still need to get the Logo to render
« Last Edit: April 30, 2017 by Omnikam »

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #32 on: April 24, 2017 »
calling 2 times:

glOrtho_

wont work.

the first call is the view for the scroller text:
Code: [Select]
glOrtho_(#Window_Main, 640, 0.0, 240, 0, 1)
the second call for our logo that we used before is:
Code: [Select]
glOrtho_(#Window_Main, 640, 480,  0, -1, 0)
calling both will occur a conflict for the x / y Coordinates for the gfx.

scroller use the whole window width: Ortho_(#Window_Main, 640,
scroller use YPos: glOrtho_(#Window_Main, 640, 0.0, 240,

logo use window width: glOrtho_(#Window_Main, 640,
logo use window height: glOrtho_(#Window_Main, 640, 480,
Logo x/y Position is separately defined (thats why we have in this line Zero: glOrtho_(#Window_Main, 640, 480,  0,

logo definition comes at this point: Render2DQuad(Texture1,  150,  120, ImageWidth(Image1), ImageHeight(Image1), 1)

and so, the logo will move the scroller out of the viewpoint and the demoscreen

a lil help:
https://wiki.delphigl.com/index.php/glOrtho
« Last Edit: April 24, 2017 by inc. »
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 119
  • Karma: 4
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #33 on: April 24, 2017 »
Thanks inc  :inspired: I figured it was an glOrtho_ issue,but couldnt understand iys use , thanks for your insight, ill try to fix the problem , It`s a problem of the cut and paste beginner code, getting things to work without fully understanding how. Ill figue out this glOrtho_  command and post a working solution.  I noticed iy rendered terribly in full screen so i had to disable it, the scroller would seem sluggish, okay im off to work  :D

Im feeling like the guy from 36th Chamber of Shaolin trying to start at the top. even after reading wiki and your explanation, i still feel like a stupid monkey  :'(
I know the solution is simple , i understand that both scroller and logo are in conflict with each other, the scroller push`s out the logo, but no matter what position i give the logo, its not displayed
Code: [Select]
Render2DQuad(Texture1,  0,  0, ImageWidth(Image1), ImageHeight(Image1), 1) is this my issue? or is it where Render2DQuad is defined in memory?
« Last Edit: April 24, 2017 by Omnikam »

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #34 on: April 24, 2017 »
Code: [Select]
Render2DQuad(Texture1,  0,  0, ImageWidth(Image1), ImageHeight(Image1), 1) is this my issue? or is it where Render2DQuad is defined in memory?

it's both of 'em ( glOrtho and Render2DQuad ) but not sure yet. i must figure it out as soon i have time.
the scroller must be included in other way.
looking forward ;)
« Last Edit: April 24, 2017 by inc. »
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 119
  • Karma: 4
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #35 on: April 24, 2017 »
Does glOrtho act like a window view scale?  a view port resizer?
in my included picture i have a question on some of the parameters, from what i understand it should be
Code: [Select]
glOrtho_(left,right,up,down,zdepth)
I dont understand why the scroller`s view is
Code: [Select]
glOrtho_(0, #WindowWidth-1, 0, #WindowHeight-1, 0, 1)   what`s with the extra 0`s ?

Is this valid
Code: [Select]
glOrtho(0,320,0,300,0)  does this represent my small square in my image? and would
Code: [Select]
glOrtho(0,640,0,600,0) would this be the larger view?

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #36 on: April 24, 2017 »
I dont understand why the scroller`s view is
Code: [Select]
glOrtho_(0, #WindowWidth-1, 0, #WindowHeight-1, 0, 1)   what`s with the extra 0`s ?

Those last 2 parameter should be the "near plane" and "far plane" and it's related to the opengl 2d projection matrix, normally I use -1.0f for near and 1.0f for the far clipping plane.

Take a look here, it might help a little bit.
http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho
Challenge Trophies Won:

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 119
  • Karma: 4
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #37 on: April 25, 2017 »
Thanks rbz,  that link was intimidating indeed,  mathematics was not my strong point during my school year's,  particularly algebra and geometry,  and now I'm having to use them and understand them more than ever  :P      I think though that I'm starting to understand why the logo doesn't show up
Last question,  in a program will it only have 1 active declaration using glOrtho?

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #38 on: April 25, 2017 »
If you are only drawing 2D stuff, then yes, you just setup your orthographic matrix only one time on init opengl.

If your drawing 3D mixed with 2D you will need to be switching from perspective projection (3d) to orthographic projection (2D).
Challenge Trophies Won:

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 119
  • Karma: 4
    • View Profile
Re: GLSL shader with Png Jpg Support [Code Included]
« Reply #39 on: April 25, 2017 »
Well im stumped, the scroller is at  0,680,0,240    while the image is 0,680,480,0 -1000 -1000  setting glortho to the scroller totally pushes image offscreen
i think my approach will be to implement a new image to opengl texture routine that has a more normalized matrix. That might be beyond my current level which is level 1 lol