Skip to content

Commit

Permalink
opengl
Browse files Browse the repository at this point in the history
  • Loading branch information
sechshelme committed Apr 3, 2024
1 parent 13ade83 commit 45a7041
Show file tree
Hide file tree
Showing 246 changed files with 33 additions and 84,932 deletions.
66 changes: 0 additions & 66 deletions 04_-_Key_Press/Project1.lpi

This file was deleted.

151 changes: 0 additions & 151 deletions 04_-_Key_Press/Project1.pas

This file was deleted.

Binary file removed 04_-_Key_Press/down.bmp
Binary file not shown.
Binary file removed 04_-_Key_Press/left.bmp
Binary file not shown.
Binary file removed 04_-_Key_Press/press.bmp
Binary file not shown.
Binary file removed 04_-_Key_Press/right.bmp
Binary file not shown.
Binary file removed 04_-_Key_Press/up.bmp
Binary file not shown.
15 changes: 5 additions & 10 deletions OpenGL_4.5/10_-_Erstes_Beispiel/Project1.pas
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
program Project1;

uses
dglOpenGL,
oglglad_gl,
oglContext,
oglVector,
oglMatrix,
Expand Down Expand Up @@ -55,15 +55,6 @@

procedure Init_SDL_and_OpenGL;
begin
// --- OpenGL inizialisieren
if not InitOpenGL then begin
WriteLn('OpenGL-Fehler');
Halt(1);
end;
ReadExtensions;
ReadImplementationProperties;
InitOpenGLDebug;

// --- SDL inizialisieren
if SDL_Init(SDL_INIT_VIDEO) < 0 then begin
WriteLn('SDL could not initialize! SDL_Error: ', SDL_GetError);
Expand All @@ -85,6 +76,10 @@
if SDL_GL_SetSwapInterval(1) < 0 then begin
WriteLn('Warning: Unable to set VSync! SDL Error: ', SDL_GetError);
end;

// --- OpenGL inizialisieren
Load_GLADE;
InitOpenGLDebug;
end;

procedure CreateScene;
Expand Down
18 changes: 6 additions & 12 deletions OpenGL_4.5/15_-_Mehrere_Context/Project1.pas
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
program Project1;

uses
dglOpenGL,
oglglad_gl,
oglContext,
oglVector,
oglMatrix,
Expand Down Expand Up @@ -39,15 +39,6 @@
var
i: integer;
begin
// --- OpenGL inizialisieren
if not InitOpenGL then begin
WriteLn('OpenGL-Fehler');
Halt(1);
end;
ReadExtensions;
ReadImplementationProperties;
InitOpenGLDebug;

// --- SDL inizialisieren
if SDL_Init(SDL_INIT_VIDEO) < 0 then begin
WriteLn('SDL could not initialize! SDL_Error: ', SDL_GetError);
Expand Down Expand Up @@ -75,6 +66,10 @@
if SDL_GL_SetSwapInterval(1) < 0 then begin
WriteLn('Warning: Unable to set VSync! SDL Error: ', SDL_GetError);
end;

// --- OpenGL inizialisieren
Load_GLADE;
InitOpenGLDebug;
end;

procedure CreateScene;
Expand All @@ -85,11 +80,10 @@
MyShader := TShader.Create;
MyShader.LoadShaderObjectFromFile(GL_VERTEX_SHADER, 'Vertexshader.glsl');
MyShader.LoadShaderObjectFromFile(GL_FRAGMENT_SHADER, 'Fragmentshader.glsl');
MyShader.LinkProgramm;
MyShader.LinkProgram;
MyShader.UseProgram;
Color_ID := MyShader.UniformLocation('uCol');


glGenVertexArrays(1, @VAO);
glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
Expand Down
23 changes: 9 additions & 14 deletions OpenGL_4.5/20_-_Stencil/Project1.pas
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
program Project1;

uses
dglOpenGL,
oglglad_gl,
oglContext,
oglVector,
oglMatrix,
Expand Down Expand Up @@ -129,15 +129,6 @@

procedure Init_SDL_and_OpenGL;
begin
// --- OpenGL inizialisieren
if not InitOpenGL then begin
WriteLn('OpenGL-Fehler');
Halt(1);
end;
ReadExtensions;
ReadImplementationProperties;
InitOpenGLDebug;

// --- SDL inizialisieren
if SDL_Init(SDL_INIT_VIDEO) < 0 then begin
WriteLn('SDL could not initialize! SDL_Error: ', SDL_GetError);
Expand All @@ -161,14 +152,18 @@
if SDL_GL_SetSwapInterval(1) < 0 then begin
WriteLn('Warning: Unable to set VSync! SDL Error: ', SDL_GetError);
end;

// --- OpenGL inizialisieren
Load_GLADE;
InitOpenGLDebug;
end;

procedure CreateScene;
begin
Shader := TShader.Create;
Shader.LoadShaderObject(GL_VERTEX_SHADER, Vertex_Shader);
Shader.LoadShaderObject(GL_FRAGMENT_SHADER, Fragment_Shader);
Shader.LinkProgramm;
Shader.LinkProgram;
Shader.UseProgram;
with Shader do begin
ModelMatrix_ID := UniformLocation('model');
Expand Down Expand Up @@ -197,13 +192,13 @@
glBufferData(GL_ARRAY_BUFFER, Length(vertices) * sizeof(GLfloat), PGLvoid(vertices), GL_STATIC_DRAW);

glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, False, 8 * SizeOf(GLfloat), nil);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * SizeOf(GLfloat), nil);

glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, False, 8 * SizeOf(GLfloat), PGLvoid(3 * SizeOf(GLfloat)));
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * SizeOf(GLfloat), PGLvoid(3 * SizeOf(GLfloat)));

glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 2, GL_FLOAT, False, 8 * SizeOf(GLfloat), PGLvoid(6 * SizeOf(GLfloat)));
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * SizeOf(GLfloat), PGLvoid(6 * SizeOf(GLfloat)));

ViewMatrix.Uniform(ViewMatrix_ID);
ProdMatrix.Uniform(ProMatrix_ID);
Expand Down
Loading

0 comments on commit 45a7041

Please sign in to comment.