OpenGL window surface
This commit is contained in:
28
projects/apis/opengl/src/surface/opengl_surface.c
Normal file
28
projects/apis/opengl/src/surface/opengl_surface.c
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "opengl_surface.h"
|
||||
|
||||
#ifdef GN_PLATFORM_LINUX
|
||||
#ifdef GN_WINDOW_X11
|
||||
#include <X11/Xlib.h>
|
||||
gnReturnCode createGLXContext(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, gnX11WindowSurfaceInfo createInfo) {
|
||||
windowSurface->windowSurface = malloc(sizeof(gnPlatformWindowSurface));
|
||||
int attribs[] = {
|
||||
GLX_RGBA,
|
||||
GLX_DEPTH_SIZE, 24,
|
||||
GLX_DOUBLEBUFFER,
|
||||
None
|
||||
};
|
||||
|
||||
XVisualInfo* vi = glXChooseVisual(createInfo.display, 0, attribs);
|
||||
windowSurface->windowSurface->context = glXCreateContext(createInfo.display, vi, NULL, GL_TRUE);
|
||||
if (glXMakeCurrent(createInfo.display, createInfo.window, windowSurface->windowSurface->context) == GL_FALSE)
|
||||
return GN_FAILED_TO_ATTACH_WINDOW;
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GN_WINFDOW_WAYLAND
|
||||
gnReturnCode gnCreateWaylandWindowSurface(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, gnWaylandWindowSurfaceInfo createInfo) {
|
||||
return GN_FAILED_TO_ATTACH_WINDOW;
|
||||
}
|
||||
#endif
|
||||
#endif
|
13
projects/apis/opengl/src/surface/opengl_surface.h
Normal file
13
projects/apis/opengl/src/surface/opengl_surface.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include <window_surface/gryphn_surface.h>
|
||||
#include "core/src/window_surface/gryphn_surface_create_functions.h"
|
||||
|
||||
#ifdef GN_PLATFORM_LINUX
|
||||
#ifdef GN_WINDOW_X11
|
||||
#include <GL/glx.h>
|
||||
typedef struct gnPlatformWindowSurface_t {
|
||||
GLXContext context;
|
||||
} gnPlatformWindowSurface;
|
||||
gnReturnCode createGLXContext(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, gnX11WindowSurfaceInfo createInfo);
|
||||
#endif
|
||||
#endif
|
Reference in New Issue
Block a user