• Welcome to Dark Bit Factory & Gravity.
 

GLSL shader with Png Image and Scroller Support [Code Included]

Started by Omnikam, April 17, 2017

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

waste


amazing , thanks guys  !


inc. always at top level  ;D

Omnikam

#21
Just For fun i added to your demo script,
Added mod playing via IncludeBinary
Added get Shader from IncludeBinary
Logo moves with the mouse


inc.

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 )
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Omnikam

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

inc.

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.
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Omnikam

#25
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

inc.

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

Omnikam

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  :)

inc.

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

Omnikam

#29
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

Omnikam

#30
So after more tinkering i have the scroller working, but now the image doesnt display and the nice nurbs shader is static


Omnikam

#31
Okay inc  ;D I have both the Shader and the Scrolling text working  :bfuck2:
I still need to get the Logo to render

inc.

calling 2 times:

glOrtho_

wont work.

the first call is the view for the scroller text:
glOrtho_(#Window_Main, 640, 0.0, 240, 0, 1)

the second call for our logo that we used before is:
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
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Omnikam

#33
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
Render2DQuad(Texture1,  0,  0, ImageWidth(Image1), ImageHeight(Image1), 1)
is this my issue? or is it where Render2DQuad is defined in memory?

inc.

Quote from: Omnikam on April 24, 2017
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 ;)
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Omnikam

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 glOrtho_(left,right,up,down,zdepth)
I dont understand why the scroller`s view is glOrtho_(0, #WindowWidth-1, 0, #WindowHeight-1, 0, 1)   what`s with the extra 0`s ?

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

Rbz

Quote from: Omnikam on April 24, 2017
I dont understand why the scroller`s view is 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:

Omnikam

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?

Rbz

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:

Omnikam

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