Skip to content

Commit

Permalink
Fix the KINC_PI situation
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Mar 26, 2024
1 parent ea5a2a1 commit 406c9e2
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Graphics3::IndexBuffer::IndexBuffer(int indexCount) : IndexBufferImpl(indexCount
glGenBuffers(1, &bufferId);
glCheckErrors();
data = new int[indexCount];
#if defined(KINC_ANDROID) || defined(KINC_PI)
#if defined(KINC_ANDROID) || defined(KINC_RASPBERRY_PI)
shortData = new u16[indexCount];
#endif
}
Expand All @@ -27,13 +27,13 @@ int *Graphics3::IndexBuffer::lock() {
}

void Graphics3::IndexBuffer::unlock() {
#if defined(KINC_ANDROID) || defined(KINC_PI)
#if defined(KINC_ANDROID) || defined(KINC_RASPBERRY_PI)
for (int i = 0; i < myCount; ++i)
shortData[i] = (u16)data[i];
#endif
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferId);
glCheckErrors();
#if defined(KINC_ANDROID) || defined(KINC_PI)
#if defined(KINC_ANDROID) || defined(KINC_RASPBERRY_PI)
glBufferData(GL_ELEMENT_ARRAY_BUFFER, myCount * 2, shortData, GL_STATIC_DRAW);
glCheckErrors();
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Kore {
IndexBufferImpl(int count);
void unset();

#if defined(KINC_ANDROID) || defined(KINC_PI)
#if defined(KINC_ANDROID) || defined(KINC_RASPBERRY_PI)
u16 *shortData;
#endif
int *data;
Expand Down
4 changes: 2 additions & 2 deletions Backends/Graphics3/OpenGL1/Sources/kinc/backend/OpenGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void Graphics3::init(int windowId, int depthBufferBits, int stencilBufferBits, b
glGenVertexArraysOES(1, &arrayId[windowId]);
#elif defined(KINC_MACOS)
glGenVertexArraysAPPLE(1, &arrayId[windowId]);
#elif !defined(KINC_ANDROID) && !defined(KINC_EMSCRIPTEN) && !defined(KINC_TIZEN) && !defined(KINC_PI)
#elif !defined(KINC_ANDROID) && !defined(KINC_EMSCRIPTEN) && !defined(KINC_TIZEN) && !defined(KINC_RASPBERRY_PI)
glGenVertexArrays(1, &arrayId[windowId]);
#endif
glCheckErrors();
Expand Down Expand Up @@ -314,7 +314,7 @@ void Graphics3::drawIndexedVertices() {

void Graphics3::drawIndexedVertices(int start, int count) {
#ifdef KINC_OPENGL_ES
#if defined(KINC_ANDROID) || defined(KINC_PI)
#if defined(KINC_ANDROID) || defined(KINC_RASPBERRY_PI)
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (void *)(start * sizeof(GL_UNSIGNED_SHORT)));
#else
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, (void *)(start * sizeof(GL_UNSIGNED_INT)));
Expand Down
2 changes: 1 addition & 1 deletion Backends/Graphics3/OpenGL1/Sources/kinc/backend/ogl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <GL/glx.h>
#endif

#ifdef KINC_PI
#ifdef KINC_RASPBERRY_PI
// #define GL_GLEXT_PROTOTYPES
#include "EGL/egl.h"
#include "EGL/eglext.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ void kinc_g4_restore_render_target() {
#endif
}

#if (defined(KINC_OPENGL) && !defined(KINC_PI) && !defined(KINC_ANDROID)) || (defined(KINC_ANDROID) && KINC_ANDROID_API >= 18)
#if (defined(KINC_OPENGL) && !defined(KINC_RASPBERRY_PI) && !defined(KINC_ANDROID)) || (defined(KINC_ANDROID) && KINC_ANDROID_API >= 18)
bool kinc_g4_init_occlusion_query(unsigned *occlusionQuery) {
#if defined(KINC_OPENGL_ES) && defined(KINC_ANDROID) && KINC_ANDROID_API >= 18
if (gles_version >= 3 && glesGenQueries) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <GL/glext.h>
#endif

#ifdef KINC_PI
#ifdef KINC_RASPBERRY_PI
// #define GL_GLEXT_PROTOTYPES
#include "GLES2/gl2.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bool kinc_opengl_internal_nonPow2RenderTargetsSupported() {
static void setupDepthStencil(kinc_g4_render_target_t *renderTarget, GLenum texType, int depthBufferBits, int stencilBufferBits, int width, int height) {
if (depthBufferBits > 0 && stencilBufferBits > 0) {
renderTarget->impl._hasDepth = true;
#if defined(KINC_OPENGL_ES) && !defined(KINC_PI) && !defined(KINC_EMSCRIPTEN)
#if defined(KINC_OPENGL_ES) && !defined(KINC_RASPBERRY_PI) && !defined(KINC_EMSCRIPTEN)
GLenum internalFormat = GL_DEPTH24_STENCIL8_OES;
#elif defined(KINC_OPENGL_ES)
GLenum internalFormat = 0x88F0; // GL_DEPTH24_STENCIL8_OES
Expand Down
6 changes: 3 additions & 3 deletions Backends/System/Pi/Sources/kinc/backend/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ int createWindow(const char *title, int x, int y, int width, int height, Kore::W
else {
dst_rect.x = x;
dst_rect.y = y;
#ifdef KINC_PI_SCALING
#ifdef KINC_RASPBERRY_PI_SCALING
dst_rect.width = screen_width;
dst_rect.height = screen_height;
#else
Expand Down Expand Up @@ -236,7 +236,7 @@ int createWindow(const char *title, int x, int y, int width, int height, Kore::W
else {
nativewindow.width = width;
nativewindow.height = height;
#ifndef KINC_PI_SCALING
#ifndef KINC_RASPBERRY_PI_SCALING
openXWindow(x, y, width, height);
#endif
}
Expand Down Expand Up @@ -473,7 +473,7 @@ bool Kore::System::handleMessages() {
}
}

#ifndef KINC_PI_SCALING
#ifndef KINC_RASPBERRY_PI_SCALING
if (windowMode != Kore::WindowModeFullscreen) {
while (XPending(dpy) > 0) {
XEvent event;
Expand Down
2 changes: 1 addition & 1 deletion Sources/kinc/io/filereader.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ const char *macgetresourcepath(void);
#include <FApp.h>
#endif

#ifdef KINC_PI
#ifdef KINC_RASPBERRY_PI
#define KINC_LINUX
#endif

Expand Down
2 changes: 1 addition & 1 deletion kfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ else if (platform === Platform.Linux || platform === Platform.FreeBSD) {
}
else if (platform === Platform.Pi) {
g4 = true;
addKincDefine('PI');
addKincDefine('RASPBERRY_PI');
addBackend('System/Pi');
addBackend('System/POSIX');
addBackend('Graphics4/OpenGL');
Expand Down

0 comments on commit 406c9e2

Please sign in to comment.