gl.gbas

Previous topic - Next topic

WPShadow

Hi!

Ich wollte mal nachfragen, ob es zur "gl.gbas" und zu den OpenGL - Befehlen irgendwo ein eher einfaches Tutorial oder so gibt?

Ich habe nachgesehen und das Red Book ist irgendwie etwas komplex und etwas unleserlich für jemanden, der irgendwie so wenig Plan hat, wie ich... =/

Gruß

W.

PS.: Ich erweitere meine Frage um diesen Link:

http://www.amazon.de/OpenGL-Shading-Language-Randi-Rost/dp/0321334892/ref=pd_sim_?ie=UTF8&qid=1204275268&sr=8-1

Was haltet ihr davon? Empfehlenswert für Einsteiger?
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

Kitty Hello

Das Orange Book ist super. Wenn Du Red+Blue hast+kapiert hast. Das ist die Basis.
http://nehe.gamedev.net Ist _die_ Anlaufstelle für OpenGL.

WPShadow

Also empfiehlst du mir das Red Book für den Anfang?

Ich war schon einige Male kurz davor es mir zu kaufen, aber irgendwie konnte ich mich nicht dazu durch ringen. Sag einfach ja/nein und ich werde deine Antwort in meine Entscheidung einfließen lassen...
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

bigsofty

GLBasic example:

Code (glbasic) Select
WHILE TRUE

X_MAKE3D 1,1000,45 // Viewport 3D

    glClear(GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT)    // Clear Screen And Depth Buffer
    glLoadIdentity()                                    // Reset The Current Modelview Matrix
    glTranslatef(-1.5,0.0,-6.0)                        // Move Left 1.5 Units And Into The Screen 6.0
    glBegin(GL_TRIANGLES)                                // Drawing Using Triangles
        glColor3f(1.0,0.0,0.0)                        // Set The Color To Red
        glVertex3f( 0.0, 1.0, 0.0)                    // Top
        glColor3f(0.0,1.0,0.0)                        // Set The Color To Green
        glVertex3f(-1.0,-1.0, 0.0)                    // Bottom Left
        glColor3f(0.0,0.0,1.0)                        // Set The Color To Blue
        glVertex3f( 1.0,-1.0, 0.0)                    // Bottom Right
    glEnd()                                            // Finished Drawing The Triangle
    glTranslatef(3.0,0.0,0.0)                        // Move Right 3 Units
    glColor3f(0.5,0.5,1.0)                            // Set The Color To Blue One Time Only
    glBegin(GL_QUADS)                                    // Draw A Quad
        glVertex3f(-1.0, 1.0, 0.0)                    // Top Left
        glVertex3f( 1.0, 1.0, 0.0)                    // Top Right
        glVertex3f( 1.0,-1.0, 0.0)                    // Bottom Right
        glVertex3f(-1.0,-1.0, 0.0)                    // Bottom Left
    glEnd()                                            // Done Drawing The Quad

 SHOWSCREEN
WEND
This is a translation of one of the early Nehe demos (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=03) into GLBasic using gl.gbas. I do believe their is a full German translation of the tutorial text as well as the code also.

May I say, this is a great way of learning OpenGL.
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)

WPShadow

Sounds great!

Is there any way to use the gl* - Code with 3D - models (*.ddd)???
And something with textures?

I've found texture mapping, but X_SETTEXTURE seems to be the same! How about this effects:

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=08

Is something like that easy to make???
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

Schranz0r

Ne da ist Glaux dabei, das musste wenn dann mit einbinden...
Viel spass    ;)
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

WPShadow

Glaux??? <-- Erkläre dich...
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

Schranz0r

Erklärung:

Glaux ist...(siehe Google) ;)
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

WPShadow

#include                        // Header File For The GLaux Library

Tja, sagt mir jetzt aber auch noch nicht wirklich viel...

Bekomme ich jetzt etwas mehr Infos???
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

WPShadow

Und noch eine kleine Frage:

Ich bin bei Rendermonkey (v 1.8) auf diverse bereits fertige Shader gestoßen! Kann man die so einfach mit übernehmen?

Code (glbasic) Select
uniform float distortion_amount2;
uniform float distortion_amount1;
uniform float distortion_amount0;
uniform vec4 height_attenuation;
uniform sampler2D fire_distortion;
uniform sampler2D fire_opacity;
uniform sampler2D fire_base;

varying vec2  vTexCoord0;
varying vec2  vTexCoord1;
varying vec2  vTexCoord2;
varying vec2  vTexCoord3;

// Bias and double a value to take it from 0..1 range to -1..1 range
vec4 bx2v(vec4 x)
{
   vec4 retVal =x;
   retVal = (2.0 * x) - 1.0;
   return retVal;
}
vec4 bx2(float x)
{
   float retVal;
   retVal = 2.0 * x - 1.0;
   return vec4(retVal,retVal,retVal,retVal);
}

void main(void)
{
   // Sample noise map three times with different texture coordinates
   vec4 noise0;
   vec4 noise1;
   vec4 noise2;

   noise0 = texture2D(fire_distortion, vTexCoord1);
   noise1 = texture2D(fire_distortion, vTexCoord2);
   noise2 = texture2D(fire_distortion, vTexCoord3);

   // Weighted sum of signed noise
   vec4 noiseSum = bx2v(noise0) * distortion_amount0 +
                   bx2v(noise1) * distortion_amount1 +
                   bx2v(noise2) * distortion_amount2;

   // Perturb base coordinates in direction of noiseSum as function of height (y)
   vec2 perturbedBaseCoords = vTexCoord0 + noiseSum.xy * ( (vTexCoord0.y) * height_attenuation.x + height_attenuation.y);

   
   // Sample base and opacity maps with perturbed coordinates
   vec4 base    = texture2D(fire_base,    perturbedBaseCoords);
   vec4 opacity = texture2D(fire_opacity, perturbedBaseCoords);

   gl_FragColor =  base * opacity;
}
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

bigsofty

Quote from: WPShadowSounds great!

Is there any way to use the gl* - Code with 3D - models (*.ddd)???
And something with textures?

I've found texture mapping, but X_SETTEXTURE seems to be the same! How about this effects:

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=08

Is something like that easy to make???
The .BMP should be read by GLB (I think that "LOADSPRITE" is simpler) and the handle can be retrieved with a little C code, I'm pretty sure Gernots already  provided an example of retrieving a texture handle from GLBasic already. (Once you have the handle you can easily apply the texture to polygons in your openGL program)

I don't see why GLBasic model display routines should not work fine in the middle of all this to use .ddd's?

All the camera, screen set up, input etc... is handled by GLB, so this shortens the code by quite a bit. ;)

Not got a lot of time unfortunately, got a new baby in the house, so I'll bang nehe8 together if I can fight off the clucking Grandparents for a minute... :P
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)

bigsofty

"glTexImage2D" is missing from "gl.gbas", Gernot needs to add this I'm afraid.

Something like...

Code (glbasic) Select
void __stdcall glTexImage2D(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, const void*);
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)

sechsrad

ich möchte diese datei nachladen mit einer art >include "gl.gbas"< , wie geht das in glbasic?

mfg

Schranz0r

IDE-> Rechte seite-> auf die Registrierkarte Datein wechseln -> rechtsklick-> datei hinzufügen

Das wars schon
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

sechsrad

jup, danke.

mfg