Start reimplementing immediate mode and removing dead code
This commit is contained in:
parent
e96d379796
commit
146be442f4
|
@ -67,6 +67,7 @@ void APIENTRY glKosInit() {
|
|||
initAttributePointers();
|
||||
initContext();
|
||||
initLights();
|
||||
initImmediateMode();
|
||||
|
||||
_glKosInitMatrix();
|
||||
_glKosInitTextures();
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
#include "../include/gl.h"
|
||||
#include "private.h"
|
||||
|
||||
static GLboolean IMMEDIATE_MODE_ACTIVE = GL_FALSE;
|
||||
static GLenum ACTIVE_POLYGON_MODE = GL_TRIANGLES;
|
||||
|
||||
static AlignedVector VERTICES;
|
||||
static AlignedVector COLOURS;
|
||||
|
||||
void initImmediateMode() {
|
||||
aligned_vector_init(&VERTICES, sizeof(GLfloat));
|
||||
aligned_vector_init(&COLOURS, sizeof(GLfloat));
|
||||
}
|
||||
|
||||
void APIENTRY glBegin(GLenum mode) {
|
||||
if(IMMEDIATE_MODE_ACTIVE) {
|
||||
_glKosThrowError(GL_INVALID_OPERATION, __func__);
|
||||
_glKosPrintError();
|
||||
return;
|
||||
}
|
||||
|
||||
IMMEDIATE_MODE_ACTIVE = GL_TRUE;
|
||||
ACTIVE_POLYGON_MODE = mode;
|
||||
}
|
||||
|
||||
void APIENTRY glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
|
||||
aligned_vector_push_back(&COLOURS, &r, 1);
|
||||
aligned_vector_push_back(&COLOURS, &g, 1);
|
||||
aligned_vector_push_back(&COLOURS, &b, 1);
|
||||
aligned_vector_push_back(&COLOURS, &a, 1);
|
||||
}
|
||||
|
||||
void APIENTRY glColor3f(GLfloat r, GLfloat g, GLfloat b) {
|
||||
static float a = 1.0f;
|
||||
glColor4f(r, g, b, a);
|
||||
}
|
||||
|
||||
void APIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z) {
|
||||
aligned_vector_push_back(&VERTICES, &x, 1);
|
||||
aligned_vector_push_back(&VERTICES, &y, 1);
|
||||
aligned_vector_push_back(&VERTICES, &z, 1);
|
||||
}
|
||||
|
||||
void APIENTRY glEnd() {
|
||||
IMMEDIATE_MODE_ACTIVE = GL_FALSE;
|
||||
|
||||
/* FIXME: Push pointers */
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, 0, VERTICES.data);
|
||||
glColorPointer(4, GL_FLOAT, 0, COLOURS.data);
|
||||
|
||||
glDrawArrays(ACTIVE_POLYGON_MODE, 0, VERTICES.size / 3);
|
||||
|
||||
aligned_vector_clear(&VERTICES);
|
||||
aligned_vector_clear(&COLOURS);
|
||||
|
||||
/* FIXME: Pop pointers */
|
||||
}
|
|
@ -71,6 +71,7 @@ PolyList *activePolyList();
|
|||
void initAttributePointers();
|
||||
void initContext();
|
||||
void initLights();
|
||||
void initImmediateMode();
|
||||
|
||||
pvr_poly_cxt_t* getPVRContext();
|
||||
GLubyte _glKosInitTextures();
|
||||
|
|
|
@ -395,3 +395,35 @@ void APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
|
|||
c->ey = CLAMP((maxy / 32) - 1, 0, vid_mode->height / 32);
|
||||
}
|
||||
|
||||
|
||||
GLboolean APIENTRY glIsEnabled(GLenum cap) {
|
||||
switch(cap) {
|
||||
case GL_DEPTH_TEST:
|
||||
return DEPTH_TEST_ENABLED;
|
||||
case GL_SCISSOR_TEST:
|
||||
return GL_CONTEXT.gen.clip_mode == PVR_USERCLIP_INSIDE;
|
||||
case GL_CULL_FACE:
|
||||
return CULLING_ENABLED;
|
||||
case GL_LIGHTING:
|
||||
return LIGHTING_ENABLED;
|
||||
case GL_BLEND:
|
||||
return BLEND_ENABLED;
|
||||
}
|
||||
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
void APIENTRY glGetIntegerv(GLenum pname, GLint *params) {
|
||||
switch(pname) {
|
||||
case GL_MAX_LIGHTS:
|
||||
*params = MAX_LIGHTS;
|
||||
break;
|
||||
case GL_TEXTURE_BINDING_2D:
|
||||
*params = getBoundTexture()->index;
|
||||
break;
|
||||
default:
|
||||
_glKosThrowError(GL_INVALID_ENUM, "glGetIntegerv");
|
||||
_glKosPrintError();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
170
gl-api.c
170
gl-api.c
|
@ -248,18 +248,10 @@ void APIENTRY glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a) {
|
|||
GL_KOS_VERTEX_COLOR = a << 24 | r << 16 | g << 8 | b;
|
||||
}
|
||||
|
||||
void APIENTRY glColor3f(GLfloat r, GLfloat g, GLfloat b) {
|
||||
GL_KOS_VERTEX_COLOR = PVR_PACK_COLOR(1.0f, r, g, b);
|
||||
}
|
||||
|
||||
void APIENTRY glColor3fv(const GLfloat *rgb) {
|
||||
GL_KOS_VERTEX_COLOR = PVR_PACK_COLOR(1.0f, rgb[0], rgb[1], rgb[2]);
|
||||
}
|
||||
|
||||
void APIENTRY glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
|
||||
GL_KOS_VERTEX_COLOR = PVR_PACK_COLOR(a, r, g, b);
|
||||
}
|
||||
|
||||
void APIENTRY glColor4fv(const GLfloat *rgba) {
|
||||
GL_KOS_VERTEX_COLOR = PVR_PACK_COLOR(rgba[3], rgba[0], rgba[1], rgba[2]);
|
||||
}
|
||||
|
@ -296,8 +288,6 @@ void APIENTRY glTexCoord2fv(const GLfloat *uv) {
|
|||
|
||||
//== Vertex Position Submission Functions ==//
|
||||
|
||||
void APIENTRY(*glVertex3f)(GLfloat, GLfloat, GLfloat);
|
||||
|
||||
void APIENTRY(*glVertex3fv)(const GLfloat *);
|
||||
|
||||
void APIENTRY glVertex2f(GLfloat x, GLfloat y) {
|
||||
|
@ -371,92 +361,6 @@ void APIENTRY glKosVertex2fv(const GLfloat *xy) {
|
|||
//====================================================================================================//
|
||||
//== GL Begin / End ==//
|
||||
|
||||
void APIENTRY glBegin(GLenum mode) {
|
||||
_glKosMatrixApplyRender();
|
||||
|
||||
_glKosArrayBufReset();
|
||||
|
||||
_glKosEnabledTexture2D() ? _glKosCompileHdrTx() : _glKosCompileHdr();
|
||||
|
||||
GL_KOS_VERTEX_MODE = mode;
|
||||
GL_KOS_VERTEX_COUNT = 0;
|
||||
|
||||
if(mode == GL_POINTS) {
|
||||
glVertex3f = _glKosVertex3fp;
|
||||
glVertex3fv = _glKosVertex3fpv;
|
||||
}
|
||||
else if(_glKosEnabledNearZClip()
|
||||
&& _glKosEnabledLighting()) {
|
||||
glVertex3f = _glKosVertex3flc;
|
||||
glVertex3fv = _glKosVertex3flcv;
|
||||
}
|
||||
else if(_glKosEnabledLighting()) {
|
||||
glVertex3f = _glKosVertex3fl;
|
||||
glVertex3fv = _glKosVertex3flv;
|
||||
}
|
||||
else if(_glKosEnabledNearZClip()) {
|
||||
glVertex3f = _glKosVertex3fc;
|
||||
glVertex3fv = _glKosVertex3fcv;
|
||||
}
|
||||
else {
|
||||
glVertex3f = _glKosVertex3ft;
|
||||
glVertex3fv = _glKosVertex3ftv;
|
||||
}
|
||||
}
|
||||
|
||||
void APIENTRY glEnd() {
|
||||
if(_glKosEnabledNearZClip()) { /* Z-Clipping Enabled */
|
||||
if(_glKosEnabledLighting()) {
|
||||
_glKosVertexComputeLighting(_glKosClipBufAddress(), GL_KOS_VERTEX_COUNT);
|
||||
|
||||
_glKosMatrixLoadRender();
|
||||
}
|
||||
|
||||
GLuint cverts;
|
||||
pvr_vertex_t *v = _glKosVertexBufPointer();
|
||||
|
||||
switch(GL_KOS_VERTEX_MODE) {
|
||||
case GL_TRIANGLES:
|
||||
cverts = _glKosClipTriangles(_glKosClipBufAddress(), v, GL_KOS_VERTEX_COUNT);
|
||||
_glKosTransformClipBuf(v, cverts);
|
||||
_glKosVertexBufAdd(cverts);
|
||||
break;
|
||||
|
||||
case GL_TRIANGLE_STRIP:
|
||||
cverts = _glKosClipTriangleStrip(_glKosClipBufAddress(), v, GL_KOS_VERTEX_COUNT);
|
||||
_glKosTransformClipBuf(v, cverts);
|
||||
_glKosVertexBufAdd(cverts);
|
||||
break;
|
||||
|
||||
case GL_QUADS:
|
||||
cverts = _glKosClipQuads(_glKosClipBufAddress(), v, GL_KOS_VERTEX_COUNT);
|
||||
_glKosTransformClipBuf(v, cverts);
|
||||
_glKosVertexBufAdd(cverts);
|
||||
break;
|
||||
}
|
||||
|
||||
_glKosClipBufReset();
|
||||
}
|
||||
else { /* No Z-Clipping Enabled */
|
||||
if(_glKosEnabledLighting())
|
||||
_glKosVertexComputeLighting((pvr_vertex_t *)_glKosVertexBufPointer() - GL_KOS_VERTEX_COUNT, GL_KOS_VERTEX_COUNT);
|
||||
|
||||
switch(GL_KOS_VERTEX_MODE) {
|
||||
case GL_TRIANGLES:
|
||||
_glKosFlagsSetTriangle();
|
||||
break;
|
||||
|
||||
case GL_TRIANGLE_STRIP:
|
||||
_glKosFlagsSetTriangleStrip();
|
||||
break;
|
||||
|
||||
case GL_QUADS:
|
||||
_glKosFlagsSetQuad();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//====================================================================================================//
|
||||
//== Misc. functions ==//
|
||||
|
||||
|
@ -715,12 +619,6 @@ static inline void _glKosApplyBlendFunc() {
|
|||
}
|
||||
}
|
||||
|
||||
static inline void _glKosApplyTextureFunc(GL_TEXTURE_OBJECT *tex) {
|
||||
GL_KOS_POLY_CXT.txr.uv_clamp = tex->uv_clamp;
|
||||
GL_KOS_POLY_CXT.txr.mipmap = tex->mip_map ? 1 : 0;
|
||||
GL_KOS_POLY_CXT.txr.mipmap_bias = PVR_MIPBIAS_NORMAL;
|
||||
}
|
||||
|
||||
void _glKosCompileHdr() {
|
||||
pvr_poly_hdr_t *hdr = _glKosVertexBufPointer();
|
||||
|
||||
|
@ -742,74 +640,6 @@ void _glKosCompileHdr() {
|
|||
|
||||
_glKosVertexBufIncrement();
|
||||
}
|
||||
|
||||
void _glKosCompileHdrT(GL_TEXTURE_OBJECT *tex) {
|
||||
pvr_poly_hdr_t *hdr = _glKosVertexBufPointer();
|
||||
|
||||
pvr_poly_cxt_txr(&GL_KOS_POLY_CXT,
|
||||
_glKosList() * 2,
|
||||
tex->color,
|
||||
tex->width,
|
||||
tex->height,
|
||||
tex->data,
|
||||
tex->filter);
|
||||
|
||||
GL_KOS_POLY_CXT.gen.shading = GL_KOS_SHADE_FUNC;
|
||||
|
||||
_glKosApplyDepthFunc();
|
||||
|
||||
_glKosApplyScissorFunc();
|
||||
|
||||
_glKosApplyFogFunc();
|
||||
|
||||
_glKosApplyCullingFunc();
|
||||
|
||||
_glKosApplyBlendFunc();
|
||||
|
||||
_glKosApplyTextureFunc(tex);
|
||||
|
||||
if(_glKosEnabledBlend())
|
||||
GL_KOS_POLY_CXT.txr.env = tex->env;
|
||||
|
||||
pvr_poly_compile(hdr, &GL_KOS_POLY_CXT);
|
||||
|
||||
if(GL_KOS_SUPERSAMPLE)
|
||||
hdr->mode2 |= GL_PVR_SAMPLE_SUPER << PVR_TA_SUPER_SAMPLE_SHIFT;
|
||||
|
||||
_glKosVertexBufIncrement();
|
||||
}
|
||||
|
||||
void _glKosCompileHdrMT(pvr_poly_hdr_t *dst, GL_TEXTURE_OBJECT *tex) {
|
||||
pvr_poly_cxt_txr(&GL_KOS_POLY_CXT,
|
||||
PVR_LIST_TR_POLY,
|
||||
tex->color,
|
||||
tex->width,
|
||||
tex->height,
|
||||
tex->data,
|
||||
tex->filter);
|
||||
|
||||
GL_KOS_POLY_CXT.gen.shading = GL_KOS_SHADE_FUNC;
|
||||
|
||||
_glKosApplyDepthFunc();
|
||||
|
||||
_glKosApplyScissorFunc();
|
||||
|
||||
_glKosApplyFogFunc();
|
||||
|
||||
_glKosApplyCullingFunc();
|
||||
|
||||
_glKosApplyTextureFunc(tex);
|
||||
|
||||
GL_KOS_POLY_CXT.blend.src = (GL_KOS_BLEND_FUNC & 0xF0) >> 4;
|
||||
GL_KOS_POLY_CXT.blend.dst = (GL_KOS_BLEND_FUNC & 0x0F);
|
||||
GL_KOS_POLY_CXT.txr.env = tex->env;
|
||||
|
||||
pvr_poly_compile(dst, &GL_KOS_POLY_CXT);
|
||||
|
||||
if(GL_KOS_SUPERSAMPLE)
|
||||
dst->mode2 |= GL_PVR_SAMPLE_SUPER << PVR_TA_SUPER_SAMPLE_SHIFT;
|
||||
}
|
||||
|
||||
//====================================================================================================//
|
||||
//== Internal GL KOS API State Functions ==//
|
||||
|
||||
|
|
20
gl-api.h
20
gl-api.h
|
@ -25,18 +25,6 @@ typedef struct {
|
|||
GLfloat s, t, r, q;
|
||||
} glTexCoord4f; /* 3D Texture Coordinate */
|
||||
|
||||
typedef struct {
|
||||
GLushort width;
|
||||
GLushort height;
|
||||
GLuint color; /* This is the PVR texture format */
|
||||
GLubyte env;
|
||||
GLubyte filter;
|
||||
GLubyte mip_map;
|
||||
GLubyte uv_clamp;
|
||||
GLuint index;
|
||||
GLvoid *data;
|
||||
} GL_TEXTURE_OBJECT; /* KOS Open GL Texture Object */
|
||||
|
||||
typedef struct {
|
||||
GLuint texID;
|
||||
GLsizei index;
|
||||
|
@ -95,8 +83,6 @@ unsigned char _glKosInitTextures();
|
|||
void _glKosCompileHdr();
|
||||
void _glKosCompileHdrTx();
|
||||
void _glKosCompileHdrMTx();
|
||||
void _glKosCompileHdrT(GL_TEXTURE_OBJECT *tex);
|
||||
void _glKosCompileHdrMT(pvr_poly_hdr_t *dst, GL_TEXTURE_OBJECT *tex);
|
||||
|
||||
/* Clipping Internal Functions */
|
||||
void _glKosTransformClipBuf(pvr_vertex_t *v, GLuint verts);
|
||||
|
@ -207,14 +193,8 @@ GLuint _glKosVertexColor();
|
|||
GLubyte _glKosMaxTextureUnits();
|
||||
GLubyte _glKosEnabledTextureMatrix();
|
||||
|
||||
GL_TEXTURE_OBJECT *_glKosBoundMultiTexObject();
|
||||
GL_TEXTURE_OBJECT *_glKosBoundTexObject();
|
||||
GLuint _glKosActiveTextureBoundTexID();
|
||||
|
||||
void _glKosPushMultiTexObject(GL_TEXTURE_OBJECT *tex,
|
||||
pvr_vertex_t *src,
|
||||
GLuint count);
|
||||
|
||||
static inline void _glKosVertexCopyPVR(const pvr_vertex_t *src, pvr_vertex_t *dst) {
|
||||
*dst = *src;
|
||||
}
|
||||
|
|
13
gl-arrays.c
13
gl-arrays.c
|
@ -826,19 +826,6 @@ static GLuint _glKosArraysApplyClipping(GLfloat *uvsrc, GLuint uvstride, GLenum
|
|||
return count;
|
||||
}
|
||||
|
||||
static inline void _glKosArraysApplyMultiTexture(GLenum mode, GLuint count) {
|
||||
if(GL_KOS_VERTEX_PTR_MODE & GL_KOS_USE_TEXTURE1) {
|
||||
GL_TEXTURE_OBJECT* tex = _glKosBoundMultiTexObject();
|
||||
if(tex) {
|
||||
_glKosPushMultiTexObject(tex,
|
||||
(pvr_vertex_t *)_glKosVertexBufPointer(),
|
||||
count);
|
||||
|
||||
if(mode == GL_QUADS)
|
||||
_glKosArraysSwizzleQuadsMultiTex(count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void _glKosArraysApplyVertexFlags(GLenum mode, pvr_vertex_t *dst, GLuint count) {
|
||||
switch(mode) {
|
||||
|
|
95
gl-cap.c
95
gl-cap.c
|
@ -114,101 +114,6 @@ static GLbitfield GL_KOS_ENABLE_CAP = 0;
|
|||
// }
|
||||
//}
|
||||
|
||||
GLboolean APIENTRY glIsEnabled(GLenum cap) {
|
||||
if(cap >= GL_LIGHT0 && cap <= GL_LIGHT15) return _glKosIsLightEnabled(cap & 0xFF);
|
||||
|
||||
switch(cap) {
|
||||
case GL_DEPTH_TEST:
|
||||
return _glKosEnabledDepthTest() ? GL_TRUE : GL_FALSE;
|
||||
|
||||
case GL_SCISSOR_TEST:
|
||||
return _glKosEnabledScissorTest() ? GL_TRUE : GL_FALSE;
|
||||
|
||||
case GL_CULL_FACE:
|
||||
return _glKosEnabledCulling() ? GL_TRUE : GL_FALSE;
|
||||
|
||||
case GL_FOG:
|
||||
return _glKosEnabledFog() ? GL_TRUE : GL_FALSE;
|
||||
|
||||
case GL_LIGHTING:
|
||||
return _glKosEnabledLighting() ? GL_TRUE : GL_FALSE;
|
||||
|
||||
case GL_KOS_NEARZ_CLIPPING:
|
||||
return _glKosEnabledNearZClip() ? GL_TRUE : GL_FALSE;
|
||||
|
||||
case GL_TEXTURE_2D:
|
||||
return _glKosEnabledTexture2D() ? GL_TRUE : GL_FALSE;
|
||||
|
||||
case GL_BLEND:
|
||||
return _glKosEnabledBlend() ? GL_TRUE : GL_FALSE;
|
||||
|
||||
case GL_KOS_TEXTURE_MATRIX:
|
||||
return _glKosEnabledTextureMatrix() ? GL_TRUE : GL_FALSE;
|
||||
}
|
||||
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
void APIENTRY glGetIntegerv(GLenum pname, GLint *params) {
|
||||
switch(pname) {
|
||||
case GL_ACTIVE_TEXTURE:
|
||||
*params = 0;
|
||||
break;
|
||||
|
||||
case GL_BLEND:
|
||||
*params = _glKosList();
|
||||
break;
|
||||
|
||||
case GL_BLEND_DST:
|
||||
*params = _glKosBlendSrcFunc();
|
||||
break;
|
||||
|
||||
case GL_BLEND_SRC:
|
||||
*params = _glKosBlendDstFunc();
|
||||
break;
|
||||
|
||||
case GL_CULL_FACE:
|
||||
*params = _glKosEnabledCulling();
|
||||
break;
|
||||
|
||||
case GL_CULL_FACE_MODE:
|
||||
*params = _glKosCullFaceMode();
|
||||
break;
|
||||
|
||||
case GL_DEPTH_FUNC:
|
||||
*params = _glKosDepthFunc();
|
||||
break;
|
||||
|
||||
case GL_DEPTH_TEST:
|
||||
*params = _glKosEnabledDepthTest();
|
||||
break;
|
||||
|
||||
case GL_DEPTH_WRITEMASK:
|
||||
*params = _glKosDepthMask();
|
||||
break;
|
||||
|
||||
case GL_FRONT_FACE:
|
||||
*params = _glKosCullFaceFront();
|
||||
break;
|
||||
|
||||
case GL_SCISSOR_TEST:
|
||||
*params = _glKosEnabledScissorTest();
|
||||
break;
|
||||
|
||||
case GL_MAX_LIGHTS:
|
||||
*params = _glKosGetMaxLights();
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_BINDING_2D:
|
||||
*params = _glKosActiveTextureBoundTexID();
|
||||
break;
|
||||
|
||||
default:
|
||||
_glKosThrowError(GL_INVALID_ENUM, "glGetIntegerv");
|
||||
_glKosPrintError();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void APIENTRY glGetFloatv(GLenum pname, GLfloat *params) {
|
||||
switch(pname) {
|
||||
|
|
9
gl-pvr.c
9
gl-pvr.c
|
@ -93,15 +93,6 @@ static void pvr_hdr_submit(const GLuint *src) {
|
|||
}
|
||||
#endif
|
||||
|
||||
void _glKosPushMultiTexObject(GL_TEXTURE_OBJECT *tex,
|
||||
pvr_vertex_t *src,
|
||||
GLuint count) {
|
||||
_glKosCompileHdrMT(&GL_MTOBJS[GL_MTOBJECTS].hdr, tex);
|
||||
|
||||
GL_MTOBJS[GL_MTOBJECTS].src = src;
|
||||
GL_MTOBJS[GL_MTOBJECTS++].count = count;
|
||||
}
|
||||
|
||||
void _glKosResetMultiTexObject() {
|
||||
GL_MTOBJECTS = 0;
|
||||
}
|
||||
|
|
85
gl-texture.c
85
gl-texture.c
|
@ -1,85 +0,0 @@
|
|||
/* KallistiGL for KallistiOS ##version##
|
||||
|
||||
libgl/gl-texture.c
|
||||
Copyright (C) 2014 Josh Pearson
|
||||
Copyright (C) 2016 Joe Fenton
|
||||
|
||||
Open GL Texture Submission implementation.
|
||||
*/
|
||||
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "gl.h"
|
||||
#include "glext.h"
|
||||
#include "gl-api.h"
|
||||
#include "gl-rgb.h"
|
||||
#include "containers/named_array.h"
|
||||
|
||||
//========================================================================================//
|
||||
//== Internal KOS Open GL Texture Unit Structures / Global Variables ==//
|
||||
|
||||
#define GL_KOS_MAX_TEXTURE_UNITS 2
|
||||
|
||||
|
||||
static GL_TEXTURE_OBJECT *GL_KOS_TEXTURE_UNIT[GL_KOS_MAX_TEXTURE_UNITS] = { NULL, NULL };
|
||||
static NamedArray TEXTURE_OBJECTS;
|
||||
|
||||
static GLubyte GL_KOS_ACTIVE_TEXTURE = GL_TEXTURE0_ARB & 0xF;
|
||||
|
||||
//========================================================================================//
|
||||
|
||||
|
||||
GLuint _glKosTextureWidth(GLuint index) {
|
||||
GL_TEXTURE_OBJECT *tex = (GL_TEXTURE_OBJECT*) named_array_get(&TEXTURE_OBJECTS, index);
|
||||
return tex->width;
|
||||
}
|
||||
|
||||
GLuint _glKosTextureHeight(GLuint index) {
|
||||
GL_TEXTURE_OBJECT *tex = (GL_TEXTURE_OBJECT*) named_array_get(&TEXTURE_OBJECTS, index);
|
||||
return tex->height;
|
||||
}
|
||||
|
||||
GLvoid *_glKosTextureData(GLuint index) {
|
||||
GL_TEXTURE_OBJECT *tex = (GL_TEXTURE_OBJECT*) named_array_get(&TEXTURE_OBJECTS, index);
|
||||
return tex->data;
|
||||
}
|
||||
|
||||
void _glKosCompileHdrTx() {
|
||||
return GL_KOS_TEXTURE_UNIT[GL_TEXTURE0_ARB & 0xF] ?
|
||||
_glKosCompileHdrT(GL_KOS_TEXTURE_UNIT[GL_TEXTURE0_ARB & 0xF]) : _glKosCompileHdr();
|
||||
}
|
||||
|
||||
GL_TEXTURE_OBJECT *_glKosBoundTexObject() {
|
||||
return GL_KOS_TEXTURE_UNIT[GL_TEXTURE0_ARB & 0xF];
|
||||
}
|
||||
|
||||
GL_TEXTURE_OBJECT *_glKosBoundMultiTexObject() {
|
||||
return GL_KOS_TEXTURE_UNIT[GL_TEXTURE1_ARB & 0xF];
|
||||
}
|
||||
|
||||
GLuint _glKosBoundMultiTexID() {
|
||||
return GL_KOS_TEXTURE_UNIT[GL_TEXTURE1_ARB & 0xF] ?
|
||||
GL_KOS_TEXTURE_UNIT[GL_TEXTURE1_ARB & 0xF]->index : 0;
|
||||
}
|
||||
|
||||
GLuint _glKosBoundTexID() {
|
||||
return GL_KOS_TEXTURE_UNIT[GL_TEXTURE0_ARB & 0xF] ?
|
||||
GL_KOS_TEXTURE_UNIT[GL_TEXTURE0_ARB & 0xF]->index : 0;
|
||||
}
|
||||
|
||||
GLuint _glKosActiveTextureBoundTexID() {
|
||||
return (GL_KOS_ACTIVE_TEXTURE) ? _glKosBoundMultiTexID() : _glKosBoundTexID();
|
||||
}
|
||||
|
||||
GLubyte _glKosMaxTextureUnits() {
|
||||
return GL_KOS_MAX_TEXTURE_UNITS;
|
||||
}
|
||||
|
||||
//========================================================================================//
|
||||
//== Public KOS Open GL API Texture Unit Functionality ==//
|
||||
|
||||
|
||||
|
||||
|
|
@ -445,7 +445,7 @@ GLAPI void APIENTRY glKosVertex2f(GLfloat x, GLfloat y);
|
|||
GLAPI void APIENTRY glKosVertex2fv(const GLfloat *xy);
|
||||
|
||||
/* Primitive 3D Position Submission */
|
||||
GLAPI void APIENTRY(*glVertex3f)(GLfloat, GLfloat, GLfloat);
|
||||
GLAPI void APIENTRY glVertex3f(GLfloat, GLfloat, GLfloat);
|
||||
GLAPI void APIENTRY(*glVertex3fv)(const GLfloat *);
|
||||
|
||||
/* 2D Non-Textured Rectangle Submission */
|
||||
|
|
Loading…
Reference in New Issue
Block a user