TINYGL: Split/move functions to API and internal implementation.
This commit is contained in:
parent
af399f0a50
commit
a70168e416
3 changed files with 40 additions and 28 deletions
|
@ -632,6 +632,17 @@ void tglClearStencil(TGLint s) {
|
||||||
c->gl_add_op(p);
|
c->gl_add_op(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tglPolygonOffset(TGLfloat factor, TGLfloat units) {
|
||||||
|
TinyGL::GLContext *c = TinyGL::gl_get_context();
|
||||||
|
TinyGL::GLParam p[3];
|
||||||
|
|
||||||
|
p[0].op = TinyGL::OP_PolygonOffset;
|
||||||
|
p[1].f = factor;
|
||||||
|
p[2].f = units;
|
||||||
|
|
||||||
|
c->gl_add_op(p);
|
||||||
|
}
|
||||||
|
|
||||||
void tglFlush() {
|
void tglFlush() {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
@ -774,15 +785,16 @@ void tglLoadName(TGLuint name) {
|
||||||
c->gl_add_op(p);
|
c->gl_add_op(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tglPolygonOffset(TGLfloat factor, TGLfloat units) {
|
TGLint tglRenderMode(TGLenum mode) {
|
||||||
TinyGL::GLContext *c = TinyGL::gl_get_context();
|
TinyGL::GLContext *c = TinyGL::gl_get_context();
|
||||||
TinyGL::GLParam p[3];
|
|
||||||
|
|
||||||
p[0].op = TinyGL::OP_PolygonOffset;
|
return c->gl_RenderMode(mode);
|
||||||
p[1].f = factor;
|
}
|
||||||
p[2].f = units;
|
|
||||||
|
|
||||||
c->gl_add_op(p);
|
void tglSelectBuffer(TGLsizei size, TGLuint *buffer) {
|
||||||
|
TinyGL::GLContext *c = TinyGL::gl_get_context();
|
||||||
|
|
||||||
|
c->gl_SelectBuffer(size, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// lists
|
// lists
|
||||||
|
|
|
@ -29,37 +29,36 @@
|
||||||
|
|
||||||
namespace TinyGL {
|
namespace TinyGL {
|
||||||
|
|
||||||
TGLint tglRenderMode(TGLenum mode) {
|
TGLint GLContext::gl_RenderMode(TGLenum mode) {
|
||||||
GLContext *c = gl_get_context();
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
switch (c->render_mode) {
|
switch (render_mode) {
|
||||||
case TGL_RENDER:
|
case TGL_RENDER:
|
||||||
break;
|
break;
|
||||||
case TGL_SELECT:
|
case TGL_SELECT:
|
||||||
if (c->select_overflow) {
|
if (select_overflow) {
|
||||||
result = -c->select_hits;
|
result = -select_hits;
|
||||||
} else {
|
} else {
|
||||||
result = c->select_hits;
|
result = select_hits;
|
||||||
}
|
}
|
||||||
c->select_overflow = 0;
|
select_overflow = 0;
|
||||||
c->select_ptr = c->select_buffer;
|
select_ptr = select_buffer;
|
||||||
c->name_stack_size = 0;
|
name_stack_size = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case TGL_RENDER:
|
case TGL_RENDER:
|
||||||
c->render_mode = TGL_RENDER;
|
render_mode = TGL_RENDER;
|
||||||
break;
|
break;
|
||||||
case TGL_SELECT:
|
case TGL_SELECT:
|
||||||
c->render_mode = TGL_SELECT;
|
render_mode = TGL_SELECT;
|
||||||
assert(c->select_buffer != nullptr);
|
assert(select_buffer != nullptr);
|
||||||
c->select_ptr = c->select_buffer;
|
select_ptr = select_buffer;
|
||||||
c->select_hits = 0;
|
select_hits = 0;
|
||||||
c->select_overflow = 0;
|
select_overflow = 0;
|
||||||
c->select_hit = nullptr;
|
select_hit = nullptr;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
|
@ -67,13 +66,11 @@ TGLint tglRenderMode(TGLenum mode) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tglSelectBuffer(TGLsizei size, TGLuint *buffer) {
|
void GLContext::gl_SelectBuffer(TGLsizei size, TGLuint *buffer) {
|
||||||
GLContext *c = gl_get_context();
|
assert(render_mode != TGL_SELECT);
|
||||||
|
|
||||||
assert(c->render_mode != TGL_SELECT);
|
select_buffer = buffer;
|
||||||
|
select_size = size;
|
||||||
c->select_buffer = buffer;
|
|
||||||
c->select_size = size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLContext::glopInitNames(GLParam *) {
|
void GLContext::glopInitNames(GLParam *) {
|
||||||
|
|
|
@ -485,6 +485,9 @@ public:
|
||||||
GLSpecBuf *specbuf_get_buffer(const int shininess_i, const float shininess);
|
GLSpecBuf *specbuf_get_buffer(const int shininess_i, const float shininess);
|
||||||
void specbuf_cleanup();
|
void specbuf_cleanup();
|
||||||
|
|
||||||
|
TGLint gl_RenderMode(TGLenum mode);
|
||||||
|
void gl_SelectBuffer(TGLsizei size, TGLuint *buffer);
|
||||||
|
|
||||||
GLList *alloc_list(int list);
|
GLList *alloc_list(int list);
|
||||||
GLList *find_list(uint list);
|
GLList *find_list(uint list);
|
||||||
void delete_list(int list);
|
void delete_list(int list);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue