Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: lionhearts beginner open gl lesson 1a

  1. #11

    Re: lionhearts beginner open gl lesson 1b

    Quote Originally Posted by Lionheart008
    dear michael... good idea ;-)

    a) I have tried it with your advice polygon look GL_Line and GL_QUADS, but nothing has changed with the both edges of the quad (up right, up left)... ;-( it looks like the edges are cut off ...
    Nothing changend? Here is the code and a picture. The corners are not cut, you just look slightly from above to a 3D box.

    [code=thinbasic] '
    ' Lesson #2 from thinBASIC TBGL tutorials
    ' "Colors"
    '
    ' by Petr Schreiber
    ' Updated to new syntax on 10-04-2008
    ' modified by Frank Brübach (Lionheart), since 09-11.09.2008

    Uses "TBGL"

    DIM hWnd AS DWORD

    MsgBox (0, "Hello, dear thinbasic friends, \nYou should see four colorful objects soon, \ntake time and look at the picture with color changing"+$CRLF(2)+"Press ESCAPE to quit window", %MB_ICONINFORMATION, "Lionhearts Lesson 1b")

    ' We will initialize OpenGL and internal buffers
    ' Function also returns window handle
    hWnd = tbgl_CreateWindowEx( "Lionhearts OGL 'beginner' Lesson 1b - press ESC to quit the example", 640, 480, 32, %TBGL_WS_WINDOWED)
    tbgl_ShowWindow ' This will display the window on the screen

    tbgl_BackColor 0, 0, 125 ' Let's set the default background to darkblue - just one call needed !

    TBGL_RESETKEYSTATE() ' Reset status of the all keys to prevent immediate quit

    while TBGL_iswindow(hWnd) ' While window exists, we will draw and check for ESCAPE

    tbgl_ClearFrame ' This clears the frame and prepares it for drawing

    tbgl_Camera 0,0,5,0,0,0 ' We will look from point 0,0,5 to 0,0,0 ( origin of coordinates )

    tbgl_BeginPoly %GL_TRIANGLES' Here begins definition of traditional triangle polygon

    tbgl_Color 128+sin(Timer)*127, 0, 0 ' Pulsing Black-To-Red
    tbgl_Vertex -1.5,0,0

    tbgl_Color 0, 128+sin(Timer+1)*127, 0 ' Pulsing Black-To-Green
    tbgl_Vertex 1.5,0,0

    tbgl_Color 0, 0, 128+sin(Timer+2)*127 ' Pulsing Black-To-Blue
    tbgl_Vertex 0,1.5,0

    ' Second polygon
    TBGL_COLOR 255, 0, 0
    TBGL_VERTEX -3, -1, -1 '----x, y, z coordinates for one point!

    TBGL_COLOR 0, 255, 0
    TBGL_VERTEX 3, -1, -1

    TBGL_COLOR 0, 0, 255
    TBGL_VERTEX 2, 1, -1

    TBGL_ENDPOLY

    '-------- build a new box
    TBGL_COLOR 125+sin(Timer)*127, 60, 255
    tbgl_Box 0.5, 1.0, 4.0

    tbgl_PushMatrix
    tbgl_Translate 0.25, -1.5, -1 '-- tbgl_Rotate 45, 1,0,0
    TBGL_PolygonLook %GL_LINE

    '-------- build a 2. box
    TBGL_COLOR 255, 255, 255
    tbgl_Box 2.25, 0.45, 0.40
    TBGL_PolygonLook %GL_FILL

    tbgl_PopMatrix

    tbgl_DrawFrame ' This will display the scene

    ' When ESCAPE is pressed, we will leave the main loop
    IF TBGL_GetWindowKeyState( hWnd, %VK_ESCAPE ) THEN EXIT while
    Wend

    tbgl_DestroyWindow ' This will destroy the window

    [/code]

    Attached Images Attached Images

  2. #12
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    Re: lionhearts beginner open gl lesson 1b

    SUPER ! :-) I have only change the viewpoint of the camera... You are right!

    ;D

    I had just headache because of this little view problem... In german language you would say "Tomaten auf den Augen!"... it's only a view angle problem that get me such silly trouble... the code was ok... but the 'devil lives in so many details'...

    I am glad, I haven't a graphic driver problem...

    one big "icecream pot" for you.. or a "erdinger weizen" ? ;-)

    by the way:
    '-------- build a 2. box
    TBGL_PolygonLook %GL_LINES '-- QUADS
    TBGL_COLOR 0, 0, 255+sin(Timer)*127
    tbgl_Box 2.25, 0.45, 0.4
    TBGL_PolygonLook %GL_FILL
    => the code of the box object does function with "GL_LINES" and "GL_QUADS", not so bad... ;-) "GL_FILL" and "PolygonLook" I didn't know yet, very good!

    see you, best regards, Lionheart

    ps: I have added this picture and have expand the box with another color... I see it's everything fine :-)

    - "beer will come by post or live in "biergarten" meeting"
    Attached Images Attached Images
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  3. #13

    Re: lionhearts beginner open gl lesson 1b

    Quote Originally Posted by Lionheart008
    one big "icecream pot" for you.. or a "erdinger weizen" ? ;-)

    by the way:
    '-------- build a 2. box
    TBGL_PolygonLook %GL_LINES '-- QUADS
    TBGL_COLOR 0, 0, 255+sin(Timer)*127
    tbgl_Box 2.25, 0.45, 0.4
    TBGL_PolygonLook %GL_FILL
    => the code of the box object does function with "GL_LINES" and "GL_QUADS", not so bad... ;-) "GL_FILL" I didn't know yet, very good!

    see you, best regards, Lionheart

    I'm glad everything is fine now. I take both, first teh icecream and then the beer.

  4. #14
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    Re: lionhearts rotating box open gl lesson 1b

    dear all :-)
    special for michael ;-)

    I'm glad everything is fine now. I take both, first the icecream and then the beer. Smiley
    so have fun with it :-) I invite you for a fixed day in spring next year, if the summer is gone. I will send beer and icecream via post and the beer in bottles by helicopter... smile

    => last little input for my rotating box example with colors:

    - a) create a little pulsing of the box after some seconds between two colors...
    - b) one more rotating box with another speed...

    o.k., that's enough for today (this night, sorry),

    good sleep all :-)

    servus and bye, Lionheart


    Attached Images Attached Images
    Attached Files Attached Files
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  5. #15
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: lionhearts beginner open gl lesson 1a

    Lionheart, very happy to see you getting into the 3d aspect of thinBasic too. I am sure you will grow to love it as tbgl has really made massive improvements this year, especially with the entity system in place.

    Petr has many examples in the examples folder, the bonuspacks and Matthew made a lot of the nehe tutorials for thinBasic. You have the right idea in going through those and working the way you are. Thanks for sharing your adventure into all of this cool stuff!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  6. #16
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    Re: lionhearts beginner open gl lesson 1a

    hi dear kent :-)

    you are very welcome! :-D

    - yes, I will get knowledge step by step with "open gl" theme and "gui" (UI) examples...

    - it's hard to get a seriously overview about thinBasic and thinAir, all the infos here and check examples. It will take a long time to proof everything, but I pick up some examples for me to push my curiousity or learn more about this fascinating script language...

    - I have only a little "time problem" (girl friend, dog, I write a criminal detective novel!) and would like to do more, but I love nature, summer, ice cream and my music too (playing keyboard, piano...)

    - what's your topic theme here?

    best regards, wish a good day for you, Lionheart
    you can't always get what you want, but if you try sometimes you might find, you get what you need

Page 2 of 2 FirstFirst 12

Similar Threads

  1. NeHe Lesson 01
    By matthew in forum TBGL Tutorials
    Replies: 1
    Last Post: 16-03-2007, 06:38
  2. NeHe Lesson 04
    By matthew in forum TBGL Tutorials
    Replies: 0
    Last Post: 16-03-2007, 01:06
  3. NeHe Lesson 03
    By matthew in forum TBGL Tutorials
    Replies: 0
    Last Post: 16-03-2007, 01:01

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •