+ added test triangle rendering
* on close mainloop is ended
This commit is contained in:
parent
91f32eff4e
commit
39af185188
20 changed files with 994 additions and 146 deletions
66
KKK/game/include/opengl.h
Normal file
66
KKK/game/include/opengl.h
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdexcept>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <epoxy/gl.h>
|
||||
#include <epoxy/glx.h>
|
||||
|
||||
namespace endofthejedi {
|
||||
|
||||
class GLWindow {
|
||||
private:
|
||||
Display* m_display;
|
||||
Window m_rootwnd;
|
||||
GLint m_attributes[23] =
|
||||
{
|
||||
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
|
||||
GLX_RENDER_TYPE, GLX_RGBA_BIT,
|
||||
GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
|
||||
GLX_RED_SIZE, 8,
|
||||
GLX_GREEN_SIZE, 8,
|
||||
GLX_BLUE_SIZE, 8,
|
||||
GLX_ALPHA_SIZE, 8,
|
||||
GLX_DEPTH_SIZE, 24,
|
||||
GLX_STENCIL_SIZE, 8,
|
||||
GLX_DOUBLEBUFFER, True,
|
||||
None
|
||||
};
|
||||
|
||||
XVisualInfo* m_visualinfo;
|
||||
Colormap m_colormap;
|
||||
XSetWindowAttributes m_swa;
|
||||
Window m_window;
|
||||
GLXContext m_glcontext;
|
||||
XWindowAttributes m_gwa;
|
||||
Atom m_atomWmDeleteWindow;
|
||||
|
||||
unsigned int m_width;
|
||||
unsigned int m_height;
|
||||
bool m_running = false;
|
||||
|
||||
protected:
|
||||
virtual void handle(XEvent event);
|
||||
virtual void init();
|
||||
virtual void render(double time);
|
||||
virtual void resize();
|
||||
|
||||
public:
|
||||
GLWindow(unsigned int width, unsigned int height);
|
||||
~GLWindow();
|
||||
|
||||
void loop();
|
||||
void stop();
|
||||
void swap();
|
||||
|
||||
unsigned int getheight() const {
|
||||
return m_height;
|
||||
}
|
||||
|
||||
unsigned int getwidth() const {
|
||||
return m_width;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue