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?
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.
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...
GLBasic example:
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.
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???
Ne da ist Glaux dabei, das musste wenn dann mit einbinden...
Viel spass ;)
Glaux??? <-- Erkläre dich...
Erklärung:
Glaux ist...(siehe Google) ;)
#include // Header File For The GLaux Library
Tja, sagt mir jetzt aber auch noch nicht wirklich viel...
Bekomme ich jetzt etwas mehr Infos???
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?
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;
}
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
"glTexImage2D" is missing from "gl.gbas", Gernot needs to add this I'm afraid.
Something like...
void __stdcall glTexImage2D(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, const void*);
ich möchte diese datei nachladen mit einer art >include "gl.gbas"< , wie geht das in glbasic?
mfg
IDE-> Rechte seite-> auf die Registrierkarte Datein wechseln -> rechtsklick-> datei hinzufügen
Das wars schon
jup, danke.
mfg
die befehle in der eingebundenen datei "gl.gbas " werden nicht erkannt :
"gl-system.gbas"(7) error : call to undefined function : glClear
wenn ich diese datei direkt unter meinem hauptprogramm setze, läuft es.
wie wird denn eine verknüpfung dorthin eingeleitet?
mfg
Das geht wunderbar, hatte da noch nie probleme!
lade mal oben das openl-demoprogramm und binde die gl.gbas extra ein, ob es bei dir funktioniert, vielleicht geht das mit keiner inline!
du brauchst kein inline!
das sind gewrappte Befehle für GLBasic!
EDIT:
Hier ne Demo wie es geht http://www.styleattax.de/OpenGL_in_GLBasic.rar
he, du bist klasse, danke. diese kleine demo ist die lösung.
mfg
gehts auf GP2X ?
Quotegpc_temp1.cpp:(.text+0x8ed4): undefined reference to `glTexCoordPointer'
alle opengl-befehle werden beim compilieren im gp2x-modus rausgeschmissen, wie es oben steht.
macht aber nichts. diese demo ist eine sehr gute hilfe für die arbeit unter windows.
mfg
NEIN! GP2X hat kein OpenGL.
konnte ich nicht wissen :(
Kein Problem. Wollte es nur klarstellen.
Hmm hab wohl vergessen hier was zu schreiben ;)
der gp2x hat bisher nur 1 spiel das mit open gl funktioniert aber die lib ist nich gerade ausgereift und vorallem irgendwie nirgends zu finden ?!?!?!
Quote from: bigsofty"glTexImage2D" is missing from "gl.gbas", Gernot needs to add this I'm afraid.
Something like...
void __stdcall glTexImage2D(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, const void*);
Was this fixed Gernot?
Also, am I right in saying that the PDA 3D lib is OpenGLES?