Link to gl.gbas

Previous topic - Next topic

Hemlos

Was looking for this...had to dig around in the threads...no longer.

OpenGL

OpenGLES
Bing ChatGpt is pretty smart :O

fuzzy70

There is a copy of it already in the samples directory when you install GLBasic

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Hemlos

Bing ChatGpt is pretty smart :O

kanonet

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 ?
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Hemlos

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 .
Bing ChatGpt is pretty smart :O

Hemlos

I just checked it out, its the same one.
Bing ChatGpt is pretty smart :O

kanonet

No i compared it with winmerge, they are not the same. The one you linked is the older one, i think.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

bigsofty

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?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

kanonet

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.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Hemlos

ok ill add it to the top post
Bing ChatGpt is pretty smart :O

Wampus

#10
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.

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 ]

UBERmonkeybot

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

Schranz0r

It's a 1:1 wrapper.

Search for some GL-Tutorials :)
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Kitty Hello

glBegin should be wrapped internally. Try it.

UBERmonkeybot

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...

Code (glbasic) Select



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