Load GL
This commit is contained in:
parent
d15cb42475
commit
a92b39adaf
26
src/app.d
26
src/app.d
@ -1,22 +1,24 @@
|
||||
import std.stdio;
|
||||
import bindbc.sdl;
|
||||
import glad.gl.all;
|
||||
import glad.gl.loader;
|
||||
|
||||
enum int WIDTH = 800;
|
||||
enum int HEIGHT = 600;
|
||||
|
||||
void init()
|
||||
{
|
||||
// glActiveTexture(GL_TEXTURE0);
|
||||
// glEnable(GL_BLEND);
|
||||
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
// glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
// glClearColor (1.0, 0.7, 0.0, 0.0);
|
||||
// glViewport(0, 0, WIDTH, HEIGHT);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glClearColor (1.0, 0.6, 0.0, 0.0);
|
||||
glViewport(0, 0, WIDTH, HEIGHT);
|
||||
}
|
||||
|
||||
void display(SDL_Window * window)
|
||||
{
|
||||
// glClear(GL_COLOR_BUFFER_BIT);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
SDL_GL_SwapWindow(window);
|
||||
}
|
||||
@ -44,11 +46,11 @@ int main()
|
||||
|
||||
SDL_GLContext context = SDL_GL_CreateContext(window);
|
||||
|
||||
// if (!gladLoadGl())
|
||||
// {
|
||||
// stderr.writeln("Failed to load OpenGL");
|
||||
// return 1;
|
||||
// }
|
||||
if (!gladLoadGL())
|
||||
{
|
||||
stderr.writeln("Failed to load OpenGL");
|
||||
return 1;
|
||||
}
|
||||
|
||||
init();
|
||||
SDL_Event event;
|
||||
|
Loading…
x
Reference in New Issue
Block a user