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);
|
||||
}
|
||||
|
||||
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() {
|
||||
// nothing to do
|
||||
}
|
||||
|
@ -774,15 +785,16 @@ void tglLoadName(TGLuint name) {
|
|||
c->gl_add_op(p);
|
||||
}
|
||||
|
||||
void tglPolygonOffset(TGLfloat factor, TGLfloat units) {
|
||||
TGLint tglRenderMode(TGLenum mode) {
|
||||
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;
|
||||
return c->gl_RenderMode(mode);
|
||||
}
|
||||
|
||||
c->gl_add_op(p);
|
||||
void tglSelectBuffer(TGLsizei size, TGLuint *buffer) {
|
||||
TinyGL::GLContext *c = TinyGL::gl_get_context();
|
||||
|
||||
c->gl_SelectBuffer(size, buffer);
|
||||
}
|
||||
|
||||
// lists
|
||||
|
|
|
@ -29,37 +29,36 @@
|
|||
|
||||
namespace TinyGL {
|
||||
|
||||
TGLint tglRenderMode(TGLenum mode) {
|
||||
GLContext *c = gl_get_context();
|
||||
TGLint GLContext::gl_RenderMode(TGLenum mode) {
|
||||
int result = 0;
|
||||
|
||||
switch (c->render_mode) {
|
||||
switch (render_mode) {
|
||||
case TGL_RENDER:
|
||||
break;
|
||||
case TGL_SELECT:
|
||||
if (c->select_overflow) {
|
||||
result = -c->select_hits;
|
||||
if (select_overflow) {
|
||||
result = -select_hits;
|
||||
} else {
|
||||
result = c->select_hits;
|
||||
result = select_hits;
|
||||
}
|
||||
c->select_overflow = 0;
|
||||
c->select_ptr = c->select_buffer;
|
||||
c->name_stack_size = 0;
|
||||
select_overflow = 0;
|
||||
select_ptr = select_buffer;
|
||||
name_stack_size = 0;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
switch (mode) {
|
||||
case TGL_RENDER:
|
||||
c->render_mode = TGL_RENDER;
|
||||
render_mode = TGL_RENDER;
|
||||
break;
|
||||
case TGL_SELECT:
|
||||
c->render_mode = TGL_SELECT;
|
||||
assert(c->select_buffer != nullptr);
|
||||
c->select_ptr = c->select_buffer;
|
||||
c->select_hits = 0;
|
||||
c->select_overflow = 0;
|
||||
c->select_hit = nullptr;
|
||||
render_mode = TGL_SELECT;
|
||||
assert(select_buffer != nullptr);
|
||||
select_ptr = select_buffer;
|
||||
select_hits = 0;
|
||||
select_overflow = 0;
|
||||
select_hit = nullptr;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
|
@ -67,13 +66,11 @@ TGLint tglRenderMode(TGLenum mode) {
|
|||
return result;
|
||||
}
|
||||
|
||||
void tglSelectBuffer(TGLsizei size, TGLuint *buffer) {
|
||||
GLContext *c = gl_get_context();
|
||||
void GLContext::gl_SelectBuffer(TGLsizei size, TGLuint *buffer) {
|
||||
assert(render_mode != TGL_SELECT);
|
||||
|
||||
assert(c->render_mode != TGL_SELECT);
|
||||
|
||||
c->select_buffer = buffer;
|
||||
c->select_size = size;
|
||||
select_buffer = buffer;
|
||||
select_size = size;
|
||||
}
|
||||
|
||||
void GLContext::glopInitNames(GLParam *) {
|
||||
|
|
|
@ -485,6 +485,9 @@ public:
|
|||
GLSpecBuf *specbuf_get_buffer(const int shininess_i, const float shininess);
|
||||
void specbuf_cleanup();
|
||||
|
||||
TGLint gl_RenderMode(TGLenum mode);
|
||||
void gl_SelectBuffer(TGLsizei size, TGLuint *buffer);
|
||||
|
||||
GLList *alloc_list(int list);
|
||||
GLList *find_list(uint list);
|
||||
void delete_list(int list);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue