BASIC

Author Topic: GLBasic Contest 02: 2D Art  (Read 1541 times)

Offline WPShadow

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1667
    • View Profile
    • http://lostrevenant.blogspot.com
GLBasic Contest 02: 2D Art
« on: 2019-Apr-08 »
Hi,

here we go, it's time for an other contest:


Definition

Write a 2D art program in GLBasic. It should be a little piece of art, not an art creation program.

Rules

  • Write the whole program only in GLBasic
  • no third party libraries
  • Keep the code short and simple
  • Make the result look impressive

Goal

Show us your best little art project, with or without movement and impress us.

Submission

Just post your code here in a codeblock, so everybody can study your awesome work.

Closing Date

19.05.2019

Example

Here is my little example. It's an optical illusion.

If you press the space bar, you can start and stop the movement.

Code: GLBasic [Select]

TYPE tRect
        x
        y
        direction
        speed
ENDTYPE

GLOBAL rect[] AS tRect, space

main()

FUNCTION main:

        generateRects()

        WHILE TRUE
               
                drawLines()
                drawBoxes()
               
                IF INKEY$() = " "
                        INC space, 1
                        IF space > 1 THEN space = 0
                ENDIF
       
                SHOWSCREEN
        WEND

ENDFUNCTION

FUNCTION generateRects:
LOCAL r AS tRect
LOCAL offset
       
       
        FOR tmpY = 0 TO 15
       
                offset = RND(25)
               
                r.direction =  MOD(tmpY, 2)
                r.speed = 100 + RND(200)
               
                FOR tmpX = 0 TO 10
                        r.x = 0 + (tmpX * 60) + offset
                        r.y = 5 + (tmpY * 30)
                       
                        DIMPUSH rect[], r
                       
                NEXT
        NEXT

ENDFUNCTION

FUNCTION addRect: x, y, direction

ENDFUNCTION

FUNCTION drawLines:
LOCAL tmpY

        FOR tmpY = 0 TO 15
                DRAWRECT 0, 0 + (tmpY * 30), 640, 5, RGB(128, 128, 128)
        NEXT

ENDFUNCTION

FUNCTION drawBoxes:

        FOREACH r IN rect[]

                IF space = TRUE
                        IF r.direction = 0
                                INC r.x, r.speed / 500
                        ENDIF
                        IF r.direction = 1
                                DEC r.x, r.speed / 500
                        ENDIF
                ENDIF

                DRAWRECT r.x, r.y, 5, 25, RGB(128, 128, 128)
                DRAWRECT r.x + 5, r.y, 25, 25, RGB(255, 255, 255)
                DRAWRECT r.x + 30, r.y, 5, 25, RGB(128, 128, 128)
               
                IF r.x < -30
                        r.x = 640
                ENDIF
                IF r.x > 640
                        r.x = -30
                ENDIF
        NEXT

ENDFUNCTION
 

Winner

This is a fun contest and there is nothing to win... Nevertheless, together we can choose a winner...



Good luck and have fun.

=====

Winner of the contest:

 :enc:Qedo (50%) & Snoopy (50%) :enc:

« Last Edit: 2019-Jun-01 by WPShadow »
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

Offline WPShadow

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1667
    • View Profile
    • http://lostrevenant.blogspot.com
Re: GLBasic Contest 02: 2D Art
« Reply #1 on: 2019-Apr-09 »
I know, this contest looks pointless at first, but it's pretty handy for backgrounds or scenes in games
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1634
  • Particle Hawk
    • View Profile
Re: GLBasic Contest 02: 2D Art
« Reply #2 on: 2019-Apr-20 »
This is an experimental piece i tinkered with a few years ago, hardly worth being called art.
It uses a rocking motion of sins and cos. eg. -1 to 1 to -1 to 1 etc

1. compile fullscreen 1920x1080
2. dont forget to grab this background image, or the special effect at the end will not look right.


Code: GLBasic [Select]
// --------------------------------- //
// Project: ColorPalette
// Start: Saturday, August 08, 2015
// IDE Version: 12.312


// compile 1920 x 1080 resolution fullscreen

LOADSPRITE "sky2.png", 9999

WHILE TRUE

        STATIC a# = 0
        a# = a# + 0.1
        IF a# > 359.0
                a# = 0.0
        ENDIF
        b# = SIN(a#) * 127.0

        // the meters - still experimenting with colors..these are read to go...they have inputs [0.0..1.0] or [-1.0..1.0]
        METER_Volume(30,40,20,300,SIN(a/2))
        METER_SINE(60,40,20,300,SIN(a) )//, 0x604020, 0x707070)
        METER_SINE(90,40,20,300,COS(b) )//, 0x604020, 0x707070)

//       stars
        DrawStar(200,500, 0xffffff, 5 , -50 , a , 0.5)
        DrawStar(300,600, 0xff00ff, 5 , -100 , a , 0.75)
        DrawStar(200,640, 0x808080 + RGB(COS(a)*127,128,0), 24 , -128 , 0 , SIN(a) * 1.0)
        DrawStar(200,640, 0x808080 + RGB(0,COS(a)*127,128), 24 , -128 , a , 0.2)

        // fractal sun
        // this one needs HEAVY experimenting!
        MakeSun(960,540, 2048, 2048+COS(b)*2048, 1, RGB( (127+COS(b*10)*127), (127+SIN(b*10)*127),COS(b*5)*127+127), 0x000000, b#, 0.1)  //this is the fractal...its a lil messy
        IF (GETTIMERALL() >20000)
                c=c+0.01
                IF c>1.0 THEN c=1.0
                DrawStar( 940, 540, 0xffffff, 5, 9999, a, c)
        ENDIF
        IF (GETTIMERALL() >24000) THEN END


        SHOWSCREEN

WEND

//
FUNCTION MakeSun: x1%, y1%, Points2%, Size2%, Wander%, Color#, Color2#, Angle#, Depth#
        DrawStar(x1% , y1%+2 , Color#, Points2%, -Size2%  ,  COS(Angle#)*2.0, Depth#)
        DrawStar(x1% , y1% , Color2#, Points2% , -Size2% ,  0 , Depth#)
        RETURN 0
ENDFUNCTION



FUNCTION METER_SINE: x%, y%, w%, h%, Level#, Color1% = 0x00f0f0, Color2% = 0xf0f000 // Level# = -1.0 to 1.0 eg. [-1.0..1.0]
        IF Level# < -1.0 THEN Level# = -1.0
        IF Level# > 1.0 THEN Level# = 1.0
        PRINT Level,10,10
        LOCAL MeterLevel# = (h% - 1 ) * Level#
        POLYVECTOR x%,y%,w%,h%,0x0000f0
        DRAWRECT x%+2,y%+2,w%-4,h%-4,Color2%
        DRAWRECT x%+4,y%+4,w%-8,h%-8,Color2% * 0.4
        DRAWRECT x%+4,y%+(h%/2),w%-8,-MeterLevel#/2,Color1%
        RETURN 0
ENDFUNCTION


FUNCTION METER_Volume: x%, y%, w%, h%, Level#, Color1% = 0x806040, Color2% = 0xf0f000 //Level# = 0 to 1.0 [0..1]
        IF Level# < 0 THEN Level# = 0
        IF Level# > 1.0 THEN Level# = 1.0
        PRINT Level,10,10
        LOCAL MeterLevel# = ( h% - 4 ) * Level#
        DRAWRECT x%,y%,w%,h,Color1%
        DRAWRECT x%+4,y%+4,w%-8,h%-9,Color1% * 0
        DRAWRECT x%+4,y%+h%-4,w%-8,-MeterLevel#, Color2%
        RETURN 0
ENDFUNCTION


FUNCTION DrawStar: x%, y%, Color#, NumberOfPoints%, TextureID%, Rotate#, Depth# // make some stars! -TextureID# = SIZE If No Sprites ID is supplied. (-) Negative ID
        // Star Creator Code Designed Neil M. Silver,  Aug. 9, 2015
        //
        // The Algorithm:
        // --
        //   NumberOfPoints = Number of visually obvious points, eg. An American Star is 5 pointed.
        // --
        //   Vector Count = The number of actual vectors a polyvector needs, in fan mode, can be calculated:
        //
        //     ( V = P * 2 + 2 )
        //     VectorCount% = ( NumberOfPoints% * 2 ) + 2 )
        //     Note: Add Two, one for the center point, one for the last point.
        // --
        //   VectorAngleSize% = is the turn size for each vector to draw.
        //     ( A = 180 / P )
        //     VectorAngleSize# = ( 180.0 / NumberOfPoints% )
        // --
        //   Depth%
        //     The inner and outer radius represent the length of the points, and the depth of thier inner corners.
        //     The Depth% value is a scalar, a ratio of the outer radius, 0.5 is good for stars...play with this [0.1~~1.0]
        //
        //                           . ________________
        //                                            ^
        //                    .   .    .     .        |   Outer Radius
        //                                            V
        //                       .     ________________
        //                                            V  Inner Radius (Depth#)
        //                           .   ______________
        //                      .          .
        //
        //
        // --
        //   Rotate%, 360 degrees
        // --
        //  A negative value for TextureID% will make the star that size, without an image.
        //  eg ( TextureID%  = -5 ) will make the star 10 wide, radius 5...no skin.
        // --
        //
        // Other notes:
        // Its midhandled.
        // Use a square image, root 2
        //
        STATIC Phase%
        LOCAL iW%, iH%, ViR#, VoR#
        LOCAL VectorCount% = ( ( NumberOfPoints% * 2 ) + 2 )
        LOCAL VectorAngleSize# = ( 180.0 / NumberOfPoints% ) * 1.0
        LOCAL tX#, tY#, vX#, vY#

        // Get the outer radius:
        IF TextureID% >= 0
                GETSPRITESIZE TextureID%, iW%, iH%
                ViR# = ( iW% * 0.5 ) * Depth#
                VoR# = ( iW% * 0.5 ) * 1.0
        ELSE
                VoR# = ABS(TextureID%) //use -textureid for a size param
                ViR# = ( VoR# * Depth# )
        ENDIF
        //STAR:

        STARTPOLY TextureID%, 0 // FAN Mode only!
        POLYVECTOR x%, y%, VoR#, VoR#, Color# // center vector
        LOCAL AngleNow#
        FOR i% = 0 TO VectorCount% - 1
                AngleNow# = ( ( VectorAngleSize# * i% * 1.0 ) + Rotate# ) * 1.0
                Phase% = Phase% + 1
                IF Phase% > 1
                        Phase% = 0
                ENDIF
                IF Phase%
                        vX# = COS( AngleNow# ) * VoR#
                        vY# = SIN( AngleNow# ) * VoR#
                ELSE
                        vX# = COS( AngleNow# ) * ViR#
                        vY# = SIN( AngleNow# ) * ViR#
                ENDIF
                tX# = vX# + VoR#
                tY# = vY# + VoR#
                POLYVECTOR x% + vX#, y% + vY#, tX#, tY#, Color#
        NEXT
        ENDPOLY
        RETURN 0
ENDFUNCTION


 
« Last Edit: 2019-Apr-23 by Hemlos »
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline WPShadow

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1667
    • View Profile
    • http://lostrevenant.blogspot.com
Re: GLBasic Contest 02: 2D Art
« Reply #3 on: 2019-Apr-21 »
This is awesome
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2606
    • View Profile
Re: GLBasic Contest 02: 2D Art
« Reply #4 on: 2019-Apr-23 »
This is an experimental piece i tinkered with a few years ago, hardly worth being called art.

I disagree, very much art!  ;)
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 Snoopy

  • Dr. Type
  • ****
  • Posts: 261
    • View Profile
Re: GLBasic Contest 02: 2D Art
« Reply #5 on: 2019-Apr-23 »
Hemlos is a very very good programmer.

A professional level.

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1634
  • Particle Hawk
    • View Profile
Re: GLBasic Contest 02: 2D Art
« Reply #6 on: 2019-Apr-23 »
I'm not a pro, but i have read a few books.
And to give credit where it's due, Gernot was a huge influence on my thirst for math.
I'm looking forward to more entries!

About the program, it was simply really.
It was a benchtest program to show what the function DrawStar() could do.
DrawStar was a brainstorm, as you can see in the remarks of the function showing a progression of the idea.
All the effects, are a result of using several combinations and configurations of this function:
Code: GLBasic [Select]
DrawStar(x%, y%, Color#, NumberOfPoints%, TextureID%, Rotate#, Depth#)

Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Snoopy

  • Dr. Type
  • ****
  • Posts: 261
    • View Profile
Re: GLBasic Contest 02: 2D Art
« Reply #7 on: 2019-Apr-24 »
You can have a professional level without being a professional.
In fact, I was talking about your work in general, not just this program. For example, your particle engine was really good.
But if you prefer me to say that you are an average programmer, ok no problem  =D  ;)

I will try to do something (I like the concurence friendly). The code of WPShadow is simpler but the optical effect is nice (and according to the rules of the contest, the complexity doesn't matter this time).

Ps : Since I really rediscover the interactions between GLB and C, Gernot is not only for me a very good programmer, but my living god :nw:  :)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1634
  • Particle Hawk
    • View Profile
Re: GLBasic Contest 02: 2D Art
« Reply #8 on: 2019-Apr-25 »
I will try to do something (I like the concurence friendly). The code of WPShadow is simpler but the optical effect is nice (and according to the rules of the contest, the complexity doesn't matter this time).

Sounds good, looking forward to more entries.
I like these contests because it gives access to some cool functions.
The more the merrier!
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline WPShadow

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1667
    • View Profile
    • http://lostrevenant.blogspot.com
Re: GLBasic Contest 02: 2D Art
« Reply #9 on: 2019-Apr-25 »
Quote
I like these contests because it gives access to some cool functions.

That's my idea. Short little codes and everybody can learn something from the different programming styles
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

Offline dreamerman

  • Global Moderator
  • Dr. Type
  • *******
  • Posts: 288
    • View Profile
    • my personal website
Re: GLBasic Contest 02: 2D Art
« Reply #10 on: 2019-Apr-26 »
I had no idea for something small & simple and didn't want to copy another plasma/fire example so I made this, nothing special, just to have more entries in competition.  Code isn't piece of art, so.. ;)

Main source:
Code: GLBasic [Select]
// --------------------------------- //
// Project: 2dpixart
// by dreamerman_pl
// only GLBasic code
// coded to run in 640x480
//

TYPE point2d
    x%
    y%
ENDTYPE
TYPE point_struct
    pos AS point2d
    vec AS point2d
    target AS point2d
    dir_num%
    color%
ENDTYPE
   
   
   
GLOBAL my_point[] AS point_struct
GLOBAL my_point_count% = 1000       // how many moving rectangles
GLOBAL endit% = 0
GLOBAL i1%, anim_pos%, txt_pos AS point2d
DIM my_point[my_point_count%]

SMOOTHSHADING FALSE         // prefer stronk pixels
LIMITFPS 60
CREATESCREEN 0, 1, 640, 480
prepare_text()



// set some points
FOR i1% = 0 TO my_point_count%  -1
    my_point[i1%].pos = ret_p2d(RND(639), RND(479))
    find_newtarget(i1%)
    my_point[i1%].color% = RGB(RND(4)*64-1, RND(4)*64-1, RND(4)*64-1)   // yeap some may be totally black :D
NEXT


REPEAT
    CLEARSCREEN
    USESCREEN 0
    ALPHAMODE -0.025
    DRAWRECT 0, 0, 640, 480, RGB(0,0,0)
    ALPHAMODE -0.25
   
    // move rectangles
    FOR i1% = 0 TO my_point_count% - 1
        IF (my_point[i1%].pos.x% = my_point[i1%].target.x%)
            IF (my_point[i1%].pos.y% = my_point[i1%].target.y%)
                find_newtarget(i1%)
            ELSE
                INC my_point[i1%].pos.y%, my_point[i1%].vec.y%
            ENDIF
        ELSE
            INC my_point[i1%].pos.x%, my_point[i1%].vec.x%
        ENDIF
        DRAWRECT my_point[i1%].pos.x%-3, my_point[i1%].pos.y%-3, 7, 7, my_point[i1%].color%
    NEXT
   
    USESCREEN 1
    ALPHATESTING 1.0
    ALPHAMODE -1.0
    // text background animation, what a crap code :D
    INC anim_pos%, 2
    IF anim_pos% > 500 THEN anim_pos% = anim_pos% - 180
    FOR i1% = 0 TO 800 STEP 5
        DRAWRECT i1%, 0, 5, 200, RGB(128*ABS(SIN(i1%+anim_pos%)), 0, 255*ABS(SIN(i1%)))
    NEXT
   
    ALPHAMODE 0.0
    glEnable(GL_BLEND)                      // change opengl blend func
    glBlendFunc(GL_ONE, GL_SRC_ALPHA)       // so we can draw magenta-pink and transparent pixel at same time
    DRAWSPRITE 3, 0, 0
   
    ALPHATESTING 1.0
    USESCREEN -1
    ALPHAMODE 0.0
    DRAWSPRITE 1, 0, 0                  // draw offscreen buffer with moving rectangles
    glBlendFunc(GL_SRC_ALPHA, GL_ONE)
    glDisable(GL_BLEND)                 // back to normal?
    //CLEARSCREEN RGB(0, 255, 0)        // for tests
    ALPHATESTING 1.0                    // draw magenta-pink as transparent
    ALPHAMODE -1.0
    DRAWSPRITE 2, txt_pos.x%, txt_pos.y%    // draw text inside
    DRAWSPRITE 4, txt_pos.x%, txt_pos.y%    // text border
    SHOWSCREEN
UNTIL endit% = 1

END

// return point2d type
FUNCTION ret_p2d AS point2d: x%, y%
    LOCAL temp AS point2d
    temp.x% = x%
    temp.y% = y%
    RETURN temp
ENDFUNCTION

// find new target-direction for rectangle
FUNCTION find_newtarget%: id%
    my_point[id%].target = ret_p2d(RND(639), RND(479))
    IF (my_point[id%].target.x% < my_point[id%].pos.x%); my_point[id%].vec.x% = -1
    ELSEIF (my_point[id%].target.x% > my_point[id%].pos.x%); my_point[id%].vec.x% = 1
    ELSE; my_point[id%].vec.x% = 0
    ENDIF
    IF (my_point[id%].target.y% < my_point[id%].pos.y%); my_point[id%].vec.y% = -1
    ELSEIF (my_point[id%].target.y% > my_point[id%].pos.y%); my_point[id%].vec.y% = 1
    ELSE; my_point[id%].vec.y% = 0
    ENDIF
ENDFUNCTION

// load image from Data section and draw with desired colors
FUNCTION prepare_txt_sprite%: screenid%, acode1%, color1%, acode2%, color2%
    LOCAL i1%, i2%, i3%, i4%, i5%, czs1$
   
    RESTORE napis_glb
    READ i1%, i2%
    USESCREEN screenid%
    ALPHATESTING 1.0            // force drawing all colors even transparent magenta-pink
    ALPHAMODE 0.0
    CLEARSCREEN 0x008000ff    // transparent color
    FOR i4% = 0 TO i2% - 1
        READ czs1$
        FOR i3% = 0 TO i1% - 1
            i5% = ASC(czs1$, i3%)
            IF (i5% = acode1%)  // => if X
                DRAWRECT i3% * 4, i4% * 4, 4, 4, color1%     // black border
            ELSEIF (i5% = acode2%)  // => if :
                DRAWRECT i3% * 4, i4% * 4, 4, 4, color2%     // transparent inside
            ENDIF
        NEXT
    NEXT
    ALPHATESTING 1.0
    ALPHAMODE 0.0
ENDFUNCTION


// forcing 4x scale
FUNCTION prepare_text%:
    LOCAL i1%, i2%, i3%, i4%, czs1$, czs2$, pix%[]

    RESTORE napis_glb
    READ i1%, i2%   // get size
    txt_pos = ret_p2d((640 - i1% * 4) / 2, (480 - i2% * 4) / 2)     // calc position
    CREATESCREEN 1, 2, i1% * 4, i2% * 4     // text effect
    CREATESCREEN 2, 3, i1% * 4, i2% * 4     // text pink outside
    CREATESCREEN 3, 4, i1% * 4, i2% * 4     // text black border

    // prepare text sprites
    prepare_txt_sprite(2, 88, 0x00000000, 58, 0x00000000)
    prepare_txt_sprite(3, 88, 0x00000000, 58, 0x008000ff)
    // now we can free those surfaces
    CREATESCREEN 2, -1, 0, 0
    CREATESCREEN 3, -1, 0, 0

    USESCREEN -1    // back to back buffer
ENDFUNCTION



STARTDATA napis_glb:

// Ascii text made with: www.patorjk.com/software/taag/
// used font: Doh
DATA 126, 16
DATA "       XXXXXXXXXXXXXXXXXXXXXXXX              XXXXXXXXXXXXXXXXX                                      XXXX                      "
DATA "     XXX::::::::::::XX:::::::::X            X::::::::::::::::X                                     X::::X                     "
DATA "   XX:::::::::::::::XX:::::::::X            X::::::XXXXXX:::::X                                     XXXX                      "
DATA "  X:::::XXXXXXXX::::XXX:::::::XX            XX:::::X     X:::::X                                                              "
DATA " X:::::X       XXXXXX  X:::::X                X::::X     X:::::X  XXXXXXXXXXXXX      XXXXXXXXXX   XXXXXXX     XXXXXXXXXXXXXXXX"
DATA "X:::::X                X:::::X                X::::X     X:::::X  X::::::::::::X   XX::::::::::X  X:::::X   XX:::::::::::::::X"
DATA "X:::::X                X:::::X                X::::XXXXXX:::::X   XXXXXXXXX:::::XXX:::::::::::::X  X::::X  X:::::::::::::::::X"
DATA "X:::::X    XXXXXXXXXX  X:::::X                X:::::::::::::XX             X::::XX::::::XXXX:::::X X::::X X:::::::XXXXXX:::::X"
DATA "X:::::X    X::::::::X  X:::::X                X::::XXXXXX:::::X     XXXXXXX:::::X X:::::X  XXXXXX  X::::X X::::::X     XXXXXXX"
DATA "X:::::X    XXXXX::::X  X:::::X                X::::X     X:::::X  XX::::::::::::X  XX:::::XX       X::::X X:::::X             "
DATA "X:::::X        X::::X  X:::::X                X::::X     X:::::X X::::XXXX::::::X    XX:::::XX     X::::X X:::::X             "
DATA " X:::::X       X::::X  X:::::X        XXXXXX  X::::X     X:::::XX::::X    X:::::XXXXXXX XX:::::XX  X::::X X::::::X     XXXXXXX"
DATA "  X:::::XXXXXXXX::::XXX:::::::XXXXXXXX:::::XXX:::::XXXXXX::::::XX::::X    X:::::XX:::::XXXX::::::XX::::::XX:::::::XXXXXX:::::X"
DATA "   XX:::::::::::::::XX:::::::::::::::::::::XX:::::::::::::::::X X:::::XXXX::::::XX::::::::::::::X X::::::X X:::::::::::::::::X"
DATA "     XXX::::::XXX:::XX:::::::::::::::::::::XX::::::::::::::::X   X::::::::::XX:::XX:::::::::::XX  X::::::X  XX:::::::::::::::X"
DATA "        XXXXXX   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX     XXXXXXXXXX  XXXX XXXXXXXXXXX    XXXXXXXX    XXXXXXXXXXXXXXXX"
ENDDATA
 
additional OpenGL functions, paste to second file:
Code: GLBasic [Select]
INLINE
#ifdef CENTERLINE_CLPP
#define signed
#endif
#define OGL                             ::
typedef unsigned int    GLenum;
typedef unsigned char   GLboolean;
typedef unsigned int    GLbitfield;
typedef void            GLvoid;
typedef signed char     GLbyte;
typedef short           GLshort;
typedef int             GLint;
typedef unsigned char   GLubyte;
typedef unsigned short  GLushort;
typedef unsigned int    GLuint;
typedef int             GLsizei;
typedef float           GLfloat;
typedef float           GLclampf;
typedef double          GLdouble;
typedef double          GLclampd;
ENDINLINE
GLOBAL GL_ALPHA_TEST                                      = 0x0BC0
GLOBAL GL_ALPHA_TEST_REF                                  = 0x0BC2
GLOBAL GL_ALPHA_TEST_FUNC                                 = 0x0BC1
GLOBAL GL_BLEND                                           = 0x0BE2
GLOBAL GL_BLEND_SRC                                       = 0x0BE1
GLOBAL GL_BLEND_DST                                       = 0x0BE0
GLOBAL GL_ZERO                                            = 0x0
GLOBAL GL_ONE                                             = 0x1
GLOBAL GL_SRC_COLOR                                       = 0x0300
GLOBAL GL_ONE_MINUS_SRC_COLOR                             = 0x0301
GLOBAL GL_SRC_ALPHA                                       = 0x0302
GLOBAL GL_ONE_MINUS_SRC_ALPHA                             = 0x0303
GLOBAL GL_DST_ALPHA                                       = 0x0304
GLOBAL GL_ONE_MINUS_DST_ALPHA                             = 0x0305
GLOBAL GL_DST_COLOR                                       = 0x0306
GLOBAL GL_ONE_MINUS_DST_COLOR                             = 0x0307
GLOBAL GL_SRC_ALPHA_SATURATE                              = 0x0308
GLOBAL GL_CONSTANT_COLOR                                  = 0x8001
GLOBAL GL_ONE_MINUS_CONSTANT_COLOR                        = 0x8002
GLOBAL GL_CONSTANT_ALPHA                                  = 0x8003
GLOBAL GL_ONE_MINUS_CONSTANT_ALPHA                        = 0x8004



INLINE
    }
    extern "C" {
        #include <cstdio>
        void __stdcall glDisable( GLenum cap );
        void __stdcall glColorMask( GLboolean red , GLboolean green , GLboolean blue , GLboolean alpha );
        void __stdcall glAlphaFunc( GLenum func , GLclampf ref );
        void __stdcall glBlendFunc( GLenum sfactor , GLenum dfactor );
        void __stdcall glEnable( GLenum cap );
        const unsigned char* __stdcall glGetString( int name );
        }
    namespace __GLBASIC__ {
ENDINLINE


FUNCTION glColorMask: red, green, blue, alpha
        INLINE
                OGL glColorMask(red, green, blue, alpha);
        ENDINLINE
ENDFUNCTION

FUNCTION glAlphaFunc: func, ref
        INLINE
                OGL glAlphaFunc(func, ref);
        ENDINLINE
ENDFUNCTION

FUNCTION glBlendFunc: sfactor, dfactor
        INLINE
                OGL glBlendFunc(sfactor, dfactor);
        ENDINLINE
ENDFUNCTION

FUNCTION glEnable: cap
        INLINE
                OGL glEnable(cap);
        ENDINLINE
ENDFUNCTION

FUNCTION glDisable: cap
        INLINE
                OGL glDisable(cap);
        ENDINLINE
ENDFUNCTION

FUNCTION glGetString$: id%
        INLINE
                return DGStr((const char*)glGetString(id));
        ENDINLINE
ENDFUNCTION
 

Waiting for entries from others :P
btw. what about shaders? They can be used to make some crazy stuff, maybe separate them to another competition.
Check my source code editor for GLBasic - link

Offline Qedo

  • Mr. Polyvector
  • ***
  • Posts: 159
  • UNUS SED LEO
    • View Profile
Re: GLBasic Contest 02: 2D Art
« Reply #11 on: 2019-Apr-27 »
And instead another plasma / fire example.
Surely there is something better but I hope you like it and above all that it is useful.

ps It's not entirely my idea. In the program the references of inspiration

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1634
  • Particle Hawk
    • View Profile
Re: GLBasic Contest 02: 2D Art
« Reply #12 on: 2019-Apr-27 »
Fantastic dreamerman, really nice!  :good:
And thank you for this, it might be useful for something i'm working on.
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: 1634
  • Particle Hawk
    • View Profile
Re: GLBasic Contest 02: 2D Art
« Reply #13 on: 2019-Apr-27 »
Qedo i don't know how that works, but i want to figgure it out!
Looks really cool!
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline dreamerman

  • Global Moderator
  • Dr. Type
  • *******
  • Posts: 288
    • View Profile
    • my personal website
Re: GLBasic Contest 02: 2D Art
« Reply #14 on: 2019-May-06 »
@Qedo: Thank You, this will be usefully as it's looking really nice and there is no need to port/rewrite other fire effect if someone needs it :D

Background of fancy sprites with black-hole effect, and text filled with such nice fire as above. This would be great :> I hope that there will be more entries, there is still time.
Check my source code editor for GLBasic - link