Page 1 of 1

Import OpenGL->glBlendfuncSeparate

Posted: Wed Dec 02, 2020 6:10 pm
by sq4
For some sprites which I display in a windowedscreen, I need to use glBlendfuncSeparate instead of the PB function SpriteBlendingMode(Blend_Source,Blend_Destination).

This is what I do:

Code: Select all

Import "Opengl32.lib"
   glBlendFuncSeparate(a.l,b.l,c.l,d.l)
EndImport
This is what I get:
Image

CompilerOptions :
Image

Yep, it's a DLL since it 's a VST-plugin.

Anybody any idea?

Re: Import OpenGL->glBlendfuncSeparate

Posted: Thu Dec 03, 2020 7:35 am
by Mijikai
Try this:

Code: Select all

EnableExplicit

Prototype.i PROT_glBlendFuncSeparate(srcRGB.i,dstRGB.i,srcAlpha.i,dstAlpha.i)
Global glBlendFuncSeparate_.PROT_glBlendFuncSeparate


;you need to have a opengl context for this to work!
glBlendFuncSeparate_ = wglGetProcAddress_("glBlendFuncSeparate")

Debug glBlendFuncSeparate_

End

Re: Import OpenGL->glBlendfuncSeparate

Posted: Thu Dec 03, 2020 1:11 pm
by sq4
Mijikai wrote:Try this:

Code: Select all

EnableExplicit

Prototype.i PROT_glBlendFuncSeparate(srcRGB.i,dstRGB.i,srcAlpha.i,dstAlpha.i)
Global glBlendFuncSeparate_.PROT_glBlendFuncSeparate


;you need to have a opengl context for this to work!
glBlendFuncSeparate_ = wglGetProcAddress_("glBlendFuncSeparate")

Debug glBlendFuncSeparate_

End
Great, never heard of wglGetProcAddress_() function.
But now rises the next question : how to get an openGL context from a WindowedScreen()?

Re: Import OpenGL->glBlendfuncSeparate

Posted: Thu Dec 03, 2020 1:40 pm
by Mijikai
OpenWindowedSrceen() (with OpenGL as subsystem) should create the context.
wglGetProcAddress_() should work then.

Re: Import OpenGL->glBlendfuncSeparate

Posted: Thu Dec 03, 2020 3:10 pm
by sq4
Mijikai wrote:OpenWindowedSrceen() (with OpenGL as subsystem) should create the context.
wglGetProcAddress_() should work then.
Oh, it's that simple!
Thanks a lot. :)