void gl_DrawScreen() { GLuint texture; _glClear( GL_COLOR_BUFFER_BIT ); _glGenTextures(1, &texture); _glBindTexture( GL_TEXTURE_2D, texture ); if ((VideoMode == 0) || (VideoMode == 2) || (VideoMode == 4)) { _glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); _glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); } else { _glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); _glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); } _glTexImage2D( GL_TEXTURE_2D, 0, 3, srv_screen->w, srv_screen->h, 0, GL_BGRA, GL_UNSIGNED_BYTE, texture_buffer ); _glBegin( GL_QUADS ); _glTexCoord2i( 0, 0 ); _glVertex2i( 0, 0 ); _glTexCoord2i( 1, 0 ); _glVertex2i( screen_width, 0 ); _glTexCoord2i( 1, 1 ); _glVertex2i( screen_width, screen_height ); _glTexCoord2i( 0, 1); _glVertex2i( 0, screen_height ); _glEnd(); _glDeleteTextures(1, &texture ); }
ULONG W3D_DrawElements(__REGA0(W3D_Context* context), __REGD0(ULONG primitive), __REGD1(ULONG type), __REGD2(ULONG count), __REGA1(void *indices)) { UBYTE* bp; UWORD* wp; ULONG* lp; unsigned int i; LOG; bp = NULL; wp = NULL; lp = NULL; if (context->state & W3D_TEXMAPPING && context->CurrentTex[0]) bindTexture(context->CurrentTex[0]); switch (type) { case W3D_INDEX_UBYTE: bp = (UBYTE*) indices; _glBegin(primitives[primitive]); for (i = 0; i < count; ++i) { setColor(context, bp[i]); setTexture(context, bp[i]); drawV(context, bp[i]); } _glEnd(); break; case W3D_INDEX_UWORD: wp = (UWORD*) indices; _glBegin(primitives[primitive]); for (i = 0; i < count; ++i) { setColor(context, wp[i]); setTexture(context, wp[i]); drawV(context, wp[i]); } _glEnd(); break; case W3D_INDEX_ULONG: lp = (ULONG*) indices; _glBegin(primitives[primitive]); for (i = 0; i < count; ++i) { setColor(context, lp[i]); setTexture(context, lp[i]); drawV(context, lp[i]); } _glEnd(); break; } return W3D_SUCCESS; }
ULONG W3D_DrawArray(__REGA0(W3D_Context* context), __REGD0(ULONG primitive), __REGD1(ULONG base), __REGD2(ULONG count)) { unsigned int i; LOG; if (context->state & W3D_TEXMAPPING && context->CurrentTex[0]) bindTexture(context->CurrentTex[0]); _glBegin(primitives[primitive]); for (i = base; i < base + count; ++i) { setColor(context, i); setTexture(context, i); drawV(context, i); } _glEnd(); return W3D_SUCCESS; }