Feature request > 3D
3D transparency
sf-in-sf:
Hi!
I need an X_ALPHAMODE, or an X_OBJADDVERVERTEX with RGBA colors. Any idea?
Not easy I guess. GL ES for android makes it even worse...
--- Code: (glbasic) ---// --------------------------------- //
// Project: test-3D-transparency
// Start: Wednesday, October 30, 2013
// IDE Version: 10.283
SETCURRENTDIR("Media") // go to media files
CONSTANT MK3D1%=1, MK3D2=256, MK3D3=80 // zfar down to 16 is still o.k. for this example!
LOADSPRITE "smallpicture.png",1
DRAWSPRITE 1, 3,3
X_OBJSTART 0
X_OBJADDVERTEX -1.0,-1.0,0.0, 0.0,1.0, 0xffffff //SW
X_OBJADDVERTEX -1.0, 1.0,0.0, 0.0,0.0, 0xffffff //NW
X_OBJADDVERTEX 1.0 ,-1.0,0.0, 1.0,1.0, 0xffffff //SE
X_OBJADDVERTEX 1.0 ,1.0 ,0.0, 1.0,0.0, 0xffffff //NE
// Note: is there no way to enter an alpha color?
// As soon as you use a color different from 0xffffff
// the ALPHAMODE stops working, stopping transparency.
// Problem: I must choose either vertex colors or transparency,
// but I need both.
X_OBJEND
X_MAKE3D MK3D1, MK3D2, MK3D3//1,256,80
X_CAMERA 0,0,3, 0,0,0
X_SETTEXTURE 1,-1
ALPHAMODE -0.33
FOR i%= -4 TO 0
X_MOVEMENT 0,0,i
X_DRAWOBJ 0,0
NEXT
SHOWSCREEN
MOUSEWAIT
END
--- End code ---
Schranz0r:
i think the only way is gl.gbas.
mentalthink:
I do test with the OpenGL Library of GLbasic, and you can do very very intersting things...
About change the value of transparency I'm not sure, but we have a lot of kind of transparency using directly the library...
Really it's very very easy do your own function with OpenGL, if you need help, comment me and I sned my work, you can see a lot of nice effects, and if you know a bit of graphics, don't programming, you can false a lot of things... basically it's do little tricks...
kanonet:
Maybe not really helpful, but: wouldnt it be better to use textures to achieve this? Other idea would be using shaders, could easily be done there (but no gl es with GLB).
BTW. RGBA = bOR(RGB(r,g,b), ASL(a, 24)) but I dont know if this works on this commands.
EDIT: forgot a ) in the function.
SnooPI:
The alpha blending it's for pixels not for the vertices.
kanonet :good: small function. Very useful :)
Navigation
[0] Message Index
[#] Next page
Go to full version