Not even sure if this is possible in GLB but I`ll ask anways.
Is it possible to XOR a graphic (be it DRARECT or POLYVECTOR or DRAWSPRITE) to the screen (without the use of shaders) ?
I suppose you could do a SPRITE2MEM() then make a function to XOR the data in the array, then use MEM2SPRITE().
Dunno. Why would you need this?
Well I got my XOR graphics workin =D But I feel that for such a simple effect it may slow the whole project down :(
Manic Miner attribute clash, perchance?
Aye. But, I may just have come up with another idea. One so brilliant only I could have come up with it. So fantastic that it wouldn`t just work on a character, but the whole screen. So mind boggeling that Im having to break my cardinal rull with this project and slip into inline ;( (I wanted to do this as purely GLB, but this one thing is iluding me) But by golly, if this works I will be chuffed to bits !
Use a little bit of OpenGL, that is, logic-ops.
Turn on XOR mode...
glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(GL_XOR);
Turn off...
glDisable(GL_COLOR_LOGIC_OP);
I am not at my PC at the moment, so I can't test. I can't see why this would not work TBH and it should not affect speed at all. I would use Gernots OpenGL lib or import the commands + #defines, then inline them above and below your rendering code.
That is axactly what I had in mind. My only problem is how to implement it. Not too clever when it comes to inline and ogl stuff. But yeah, shouldn`t affect the speed at all.
Including Gernots GL.gbas, from the samples...
// Xor mode, on/off sample
LOCAL i%
WHILE 1=1
GLXOR(TRUE) // On
FOR i%=0 TO 999
DRAWLINE RND(640),RND(480),RND(640),RND(480),RGB(255,255,255)
NEXT
GLXOR(FALSE) // Off
SHOWSCREEN
MOUSEWAIT
WEND
FUNCTION GLXOR: xorFlg%
IF xorFlg%
glEnable(GL_COLOR_LOGIC_OP)
glLogicOp(GL_XOR)
ELSE
glDisable(GL_COLOR_LOGIC_OP)
ENDIF
ENDFUNCTION
Thanks for the help Biggy. Tried all day with inline stuff and whatnot but until you posted the snippet I didnt know about GL.GBAS which already had everything defined (I was seaching all over the net for those defines).
Anyway, only taken me all day, but finally got there ;)
http://twitpic.com/9a9tty
Now with authentic BBC MICRO style colour clash ;)
Glad to help. It's looks very good too! :good:
That's pretty cool to see nowadays without the use of an emulator!
Ooops :(
Just tried compiling to Android and it came back with this ...
_______________________________________
*** Configuration: ANDROID ***
precompiling:
GPC - GLBasic Precompiler V.10.104 SN:17d88e8b - 3D, NET
Wordcount:3832 commands
compile+link:
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glGetClipPlane(DGInt, __GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:733: error: no matching function for call to 'DIMDATA(__GLBASIC__::DGIntArray&, int, __GLBASIC__::GLdouble [4])'
Q:\Compiler/platform/Include/glb.h:882: note: candidates are: void __GLBASIC__::DIMDATA(__GLBASIC__::DGIntArray&, int, DGInt*)
Q:\Compiler/platform/Include/glb.h:884: note: void __GLBASIC__::DIMDATA(__GLBASIC__::DGNatArray&, int, DGNat*)
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glLoadMatrixd(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:1741: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glLoadMatrixd(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glMultMatrixd(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:1796: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glMultMatrixd(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glVertex2dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:2691: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glVertex2dv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glVertex3dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:2771: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glVertex2dv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glVertex4dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:2851: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glVertex2dv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glNormal3dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:3091: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glNormal3dv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glIndexdv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:3347: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glIndexdv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glColor3dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:3955: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glColor3dv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glTexCoord1dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:4723: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glTexCoord1dv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glTexCoord2dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:4803: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glTexCoord2dv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glTexCoord3dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:4883: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glTexCoord3dv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glTexCoord4dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:4963: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glTexCoord4dv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glRasterPos2dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:5427: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glRasterPos2dv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glRasterPos3dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:5507: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glRasterPos3dv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glRasterPos4dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:5587: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glRasterPos4dv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glRectdv(__GLBASIC__::DGIntArray&, __GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:5795: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glRectdv(const __GLBASIC__::GLdouble*, const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glTexGendv(DGInt, DGInt, __GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:6889: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '3' to 'void glTexGendv(__GLBASIC__::GLenum, __GLBASIC__::GLenum, const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glGetTexGendv(DGInt, DGInt, __GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:6955: error: cannot convert 'DGInt*' to '__GLBASIC__::GLdouble*' for argument '3' to 'void glGetTexGendv(__GLBASIC__::GLenum, __GLBASIC__::GLenum, __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glEvalCoord1dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:7369: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glEvalCoord1dv(const __GLBASIC__::GLdouble*)'
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function 'DGInt __GLBASIC__::glEvalCoord2dv(__GLBASIC__::DGIntArray&)':
C:\Users\WINDOW~1\AppData\Local\Temp\glbasic\gpc_temp2.cpp:7481: error: cannot convert 'DGInt*' to 'const __GLBASIC__::GLdouble*' for argument '1' to 'void glEvalCoord2dv(const __GLBASIC__::GLdouble*)'
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 9.4 sec. Time: 14:59
Build: 0 succeeded.
*** 1 FAILED ***
I don't have an Android device but I suspect the problem may lay with gl.gbas. The gl.gbas is an OpenGL wrapper, Android needs OpenGLES, the errors you see are the differences from opengl.h and opengles.h.
Try just cutting gl.gbas down to the commands that you require.
This works for me on android.
[attachment deleted by admin]
Handy, thanks Gernot, I assume this will work on IOS as well?
Heh. Minion that's great. I've been playing Manic Miner recently on Android.
does this gl.gbs work on ios?
Sort of. Some functions are not supported. I think I uploaded an updated version that works. But I can't remember where or if :S.
My brain is slightly overheated these days.
In your last post in this Thread?^^