Was looking for this...had to dig around in the threads...no longer.
OpenGL (http://www.glbasic.com/files/gl.gbas)
OpenGLES (http://www.glbasic.com/forum/index.php?action=dlattach;topic=7801.0;attach=4797)
There is a copy of it already in the samples directory when you install GLBasic
Lee
I lost mine :P
Is this the last one? Is it newer or at least as new as the one Gernot published here: http://www.glbasic.com/forum/index.php?topic=7801.msg66675#msg66675 ?
I dont know if thats the same one.
Gernot linked this one, this year.
Im assuming he keeps it updated.
It works for me, dont think much will change in it .
I just checked it out, its the same one.
No i compared it with winmerge, they are not the same. The one you linked is the older one, i think.
Quote from: kanonet on 2012-Nov-17
the one Gernot published here: http://www.glbasic.com/forum/index.php?topic=7801.msg66675#msg66675 ?
I could be wrong but this one may have been altered for better GLES compatibility rather than a general OpenGL update?
I think so too, but i think in general opengl you lose nothing when you use it, but you win in opengles, so i would prefer tp use it.
ok ill add it to the top post
Everytime I try to run an app on Nexus 7 (Android) that includes the OpenGLES file I get an error message before anything starts up, "Unfortunately, [app] has stopped."
I also get the same message when I use Kanonet's X_SPRITE replacement code (http://www.glbasic.com/forum/index.php?topic=7992.0).
Anyone come across a similar issue and solved it? If not, any idea how or if this can be dealt with?
I'm using IDE 11.261
[ Edit: Ok, so OpenGL ES (used in Android and iPhone, probably other mobile devices too) doesn't have glBegin, glVertex or glEnd. Would need to re-code for Android. Will start here if I get the time: http://pandorawiki.org/OpenGL_ES_1.1_Tutorial (http://pandorawiki.org/OpenGL_ES_1.1_Tutorial) ]
Would anyone be able to supply a bit of example code how to get started with gl.gbas as i don't have a scooby!
Thanks
It's a 1:1 wrapper.
Search for some GL-Tutorials :)
glBegin should be wrapped internally. Try it.
Wrapped internally?
I have got some quads working but am having difficulty with textures,
I am using spritetomem -> tex%[] but glTexImage2D wont accept the array.
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex%[])
Please could someone put me out of my misery.
Thanks
gl.gbas needs to be included to run this...
LOCAL x=100,y=100,z,r
CONSTANT sc=100
GLOBAL texture%=GENSPRITE()
LOCAL sc=GENSCREEN()
CREATESCREEN sc,texture,32,32
USESCREEN sc
FOR f=0 TO 10
DRAWRECT RND(20),RND(20),5,5,RND(0xffffff)
NEXT
USESCREEN -1
GLOBAL tex%[]
DIM tex%[32*32]
LOCAL aaaa
aaaa=SPRITE2MEM(tex%[],texture%)
//IF aaaa=0 THEN END
//FOR s=0 TO 32*32-1
//DEBUG "\n"+tex%[s]
//NEXT
//DRAWSPRITE texture,0,0
//SHOWSCREEN
//MOUSEWAIT
REPEAT
//glMatrixMode(GL_PROJECTION)//
glClear(GL_COLOR_BUFFER_BIT AND GL_DEPTH_BUFFER_BIT AND GL_POLYGON_SMOOTH); // Clear The Screen And The Depth Buffer
glShadeModel(GL_SMOOTH)
glLoadIdentity(); // Reset The Current Modelview Matrix
glTranslatef(x,y,z);
glBegin(GL_TRIANGLES);
//glScaled(5,5,5)
glColor3f(255,0,0)
glVertex3f(-sc,-sc,0)
glColor3f(0,255,0)
glVertex3f(0 ,-sc,0)
glColor3f(0,0,0x66)
glVertex3f(00,sc,0)
//glTranslatef(3,0,0)
glEnd()
glLoadIdentity();
glTranslatef(500,100,0)
glRotated(r,0,0,1)
INC r,.5
glGenTextures(1,tex%[])
glEnable(GL_TEXTURE_2D)
glBindTexture(GL_TEXTURE_2D, texture)//tex%[]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex%[]);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glBegin(GL_QUADS);
glColor3f(0,0,33);
glTexCoord2f(0,-1)
glVertex3f(-sc, -sc,0) //tl
glTexCoord2f( 1,1)
glVertex3f(sc,-sc,0) //tr
glTexCoord2f( 1,0) //br
glVertex3f( sc,sc,0)
glColor3f(0,33,33)
glTexCoord2f( 0,0) //
glVertex3f( -sc, sc,0) // bl
glEnd(); // Done Drawing A Quad
IF KEY(203) THEN DEC x,1
IF KEY(205) THEN INC x,1
IF KEY(200) THEN DEC y,1
IF KEY(208) THEN INC y,1
IF KEY(12) THEN DEC z,.1
IF KEY(13) THEN INC z,.1
SHOWSCREEN
UNTIL FALSE
X_SETTEXTURE
Try this ;)
Hahahahahha no way!!
It's that simple,There i was trying to work out pointers in C etc etc.
Thanks very much Schranz0r
:nw:
No problem :)
Thanks kitty.
I don't understand Kitty,I have tried addressof but it only accepts a function name.
I looked through the Docs and checked the examples and understand what addressof does but cannot see how it pertains?
:S