Import OpenGL->glBlendfuncSeparate

Windows specific forum
sq4
User
User
Posts: 98
Joined: Wed Feb 26, 2014 3:16 pm
Contact:

Import OpenGL->glBlendfuncSeparate

Post 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?
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: Import OpenGL->glBlendfuncSeparate

Post 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
sq4
User
User
Posts: 98
Joined: Wed Feb 26, 2014 3:16 pm
Contact:

Re: Import OpenGL->glBlendfuncSeparate

Post 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()?
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: Import OpenGL->glBlendfuncSeparate

Post by Mijikai »

OpenWindowedSrceen() (with OpenGL as subsystem) should create the context.
wglGetProcAddress_() should work then.
sq4
User
User
Posts: 98
Joined: Wed Feb 26, 2014 3:16 pm
Contact:

Re: Import OpenGL->glBlendfuncSeparate

Post 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. :)
Post Reply