Author Topic: Link to gl.gbas  (Read 21807 times)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1622
  • Particle Hawk
    • View Profile
Link to gl.gbas
« on: 2012-Nov-17 »
Was looking for this...had to dig around in the threads...no longer.

OpenGL

OpenGLES
« Last Edit: 2012-Nov-18 by Hemlos »
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline fuzzy70

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 828
  • Look left, Look right, LOOK OUT!!
    • View Profile
Re: Link to gl.gbas
« Reply #1 on: 2012-Nov-17 »
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)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1622
  • Particle Hawk
    • View Profile
Re: Link to gl.gbas
« Reply #2 on: 2012-Nov-17 »
I lost mine :P
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline kanonet

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1137
    • View Profile
    • My GLBasic code archiv
Re: Link to gl.gbas
« Reply #3 on: 2012-Nov-17 »
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

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1622
  • Particle Hawk
    • View Profile
Re: Link to gl.gbas
« Reply #4 on: 2012-Nov-17 »
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 .
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1622
  • Particle Hawk
    • View Profile
Re: Link to gl.gbas
« Reply #5 on: 2012-Nov-17 »
I just checked it out, its the same one.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline kanonet

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1137
    • View Profile
    • My GLBasic code archiv
Re: Link to gl.gbas
« Reply #6 on: 2012-Nov-18 »
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

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2795
    • View Profile
Re: Link to gl.gbas
« Reply #7 on: 2012-Nov-18 »
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)

Offline kanonet

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1137
    • View Profile
    • My GLBasic code archiv
Re: Link to gl.gbas
« Reply #8 on: 2012-Nov-18 »
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

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1622
  • Particle Hawk
    • View Profile
Re: Link to gl.gbas
« Reply #9 on: 2012-Nov-18 »
ok ill add it to the top post
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
Re: Link to gl.gbas
« Reply #10 on: 2013-Jan-28 »
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 ]
« Last Edit: 2013-Jan-28 by Wampus »

Offline UBERmonkeybot

  • Mr. Polyvector
  • ***
  • Posts: 243
    • View Profile
Re: Link to gl.gbas
« Reply #11 on: 2015-Oct-19 »
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

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5116
  • O Rly?
    • View Profile
Re: Link to gl.gbas
« Reply #12 on: 2016-Feb-15 »
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

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10859
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Link to gl.gbas
« Reply #13 on: 2016-Feb-15 »
glBegin should be wrapped internally. Try it.

Offline UBERmonkeybot

  • Mr. Polyvector
  • ***
  • Posts: 243
    • View Profile
Re: Link to gl.gbas
« Reply #14 on: 2016-Feb-16 »
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