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 std.stdio;
|
||||||
import bindbc.sdl;
|
import bindbc.sdl;
|
||||||
|
import glad.gl.all;
|
||||||
|
import glad.gl.loader;
|
||||||
|
|
||||||
enum int WIDTH = 800;
|
enum int WIDTH = 800;
|
||||||
enum int HEIGHT = 600;
|
enum int HEIGHT = 600;
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
// glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
// glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
// glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
// glClearColor (1.0, 0.7, 0.0, 0.0);
|
glClearColor (1.0, 0.6, 0.0, 0.0);
|
||||||
// glViewport(0, 0, WIDTH, HEIGHT);
|
glViewport(0, 0, WIDTH, HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void display(SDL_Window * window)
|
void display(SDL_Window * window)
|
||||||
{
|
{
|
||||||
// glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
SDL_GL_SwapWindow(window);
|
SDL_GL_SwapWindow(window);
|
||||||
}
|
}
|
||||||
@ -44,11 +46,11 @@ int main()
|
|||||||
|
|
||||||
SDL_GLContext context = SDL_GL_CreateContext(window);
|
SDL_GLContext context = SDL_GL_CreateContext(window);
|
||||||
|
|
||||||
// if (!gladLoadGl())
|
if (!gladLoadGL())
|
||||||
// {
|
{
|
||||||
// stderr.writeln("Failed to load OpenGL");
|
stderr.writeln("Failed to load OpenGL");
|
||||||
// return 1;
|
return 1;
|
||||||
// }
|
}
|
||||||
|
|
||||||
init();
|
init();
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user