mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] opengl: fixed incorrect colors and added 10-bit RGBA support
This commit is contained in:
parent
d2b83027b4
commit
4654f317ca
@ -74,7 +74,17 @@ static void lgd_null_deinitialize(void * opaque)
|
||||
|
||||
static LG_OutFormat lgd_null_get_out_format(void * opaque)
|
||||
{
|
||||
return LG_OUTPUT_BGRA;
|
||||
struct Inst * this = (struct Inst *)opaque;
|
||||
switch(this->format.type)
|
||||
{
|
||||
case FRAME_TYPE_BGRA : return LG_OUTPUT_BGRA;
|
||||
case FRAME_TYPE_RGBA : return LG_OUTPUT_RGBA;
|
||||
case FRAME_TYPE_RGBA10: return LG_OUTPUT_RGBA10;
|
||||
|
||||
default:
|
||||
DEBUG_ERROR("Unknown frame type");
|
||||
return LG_OUTPUT_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int lgd_null_get_frame_pitch(void * opaque)
|
||||
|
@ -29,7 +29,11 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
typedef enum LG_OutFormat
|
||||
{
|
||||
LG_OUTPUT_INVALID,
|
||||
|
||||
LG_OUTPUT_BGRA,
|
||||
LG_OUTPUT_RGBA,
|
||||
LG_OUTPUT_RGBA10,
|
||||
LG_OUTPUT_YUV420
|
||||
}
|
||||
LG_OutFormat;
|
||||
|
@ -96,6 +96,7 @@ struct Inst
|
||||
LG_RendererFormat format;
|
||||
GLuint intFormat;
|
||||
GLuint vboFormat;
|
||||
GLuint dataFormat;
|
||||
size_t texSize;
|
||||
const LG_Decoder* decoder;
|
||||
void * decoderData;
|
||||
@ -880,6 +881,7 @@ static bool configure(struct Inst * this, SDL_Window *window)
|
||||
{
|
||||
case FRAME_TYPE_BGRA:
|
||||
case FRAME_TYPE_RGBA:
|
||||
case FRAME_TYPE_RGBA10:
|
||||
this->decoder = &LGD_NULL;
|
||||
break;
|
||||
|
||||
@ -912,14 +914,28 @@ static bool configure(struct Inst * this, SDL_Window *window)
|
||||
switch(this->decoder->get_out_format(this->decoderData))
|
||||
{
|
||||
case LG_OUTPUT_BGRA:
|
||||
this->intFormat = GL_RGBA8;
|
||||
this->vboFormat = GL_BGRA;
|
||||
this->intFormat = GL_RGBA8;
|
||||
this->vboFormat = GL_BGRA;
|
||||
this->dataFormat = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
|
||||
case LG_OUTPUT_RGBA:
|
||||
this->intFormat = GL_RGBA8;
|
||||
this->vboFormat = GL_RGBA;
|
||||
this->dataFormat = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
|
||||
case LG_OUTPUT_RGBA10:
|
||||
this->intFormat = GL_RGB10_A2;
|
||||
this->vboFormat = GL_RGBA;
|
||||
this->dataFormat = GL_UNSIGNED_INT_2_10_10_10_REV;
|
||||
break;
|
||||
|
||||
case LG_OUTPUT_YUV420:
|
||||
// fixme
|
||||
this->intFormat = GL_RGBA8;
|
||||
this->vboFormat = GL_BGRA;
|
||||
this->intFormat = GL_RGBA8;
|
||||
this->vboFormat = GL_BGRA;
|
||||
this->dataFormat = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1029,7 +1045,7 @@ static bool configure(struct Inst * this, SDL_Window *window)
|
||||
this->format.height,
|
||||
0,
|
||||
this->vboFormat,
|
||||
GL_UNSIGNED_BYTE,
|
||||
this->dataFormat,
|
||||
(void*)0
|
||||
);
|
||||
if (check_gl_error("glTexImage2D"))
|
||||
@ -1380,7 +1396,7 @@ static bool draw_frame(struct Inst * this)
|
||||
this->format.width ,
|
||||
this->format.height,
|
||||
this->vboFormat,
|
||||
GL_UNSIGNED_BYTE,
|
||||
this->dataFormat,
|
||||
(void*)0
|
||||
);
|
||||
if (check_gl_error("glTexSubImage2D"))
|
||||
|
Loading…
Reference in New Issue
Block a user