2 Copyright 2004-2005 Chris Tallon, 2006,2011-2012 Marten Richter
\r
4 This file is part of VOMP.
\r
6 VOMP is free software; you can redistribute it and/or modify
\r
7 it under the terms of the GNU General Public License as published by
\r
8 the Free Software Foundation; either version 2 of the License, or
\r
9 (at your option) any later version.
\r
11 VOMP is distributed in the hope that it will be useful,
\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 GNU General Public License for more details.
\r
16 You should have received a copy of the GNU General Public License
\r
17 along with VOMP; if not, write to the Free Software
\r
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
22 #include "osdopengl.h"
\r
24 #include "videovpeogl.h"
\r
25 #include "surfaceopengl.h"
\r
28 #include "message.h"
\r
29 #include "command.h"
\r
31 #include "shaders/generic__vertex_shader.h"
\r
32 #include "shaders/osd__frag_shader.h"
\r
34 #define BACKBUFFER_WIDTH 1920
\r
35 #define BACKBUFFER_HEIGHT 1080
\r
39 long long getTimeMS() {
\r
41 clock_gettime(CLOCK_MONOTONIC, &ts);
\r
42 return ts.tv_sec*1000+ts.tv_nsec/1000000LL;
\r
47 OsdOpenGL::OsdOpenGL()
\r
51 external_driving=false;
\r
53 lastrendertime=getTimeMS();
\r
60 #ifdef BENCHMARK_FPS
\r
61 last_benchmark_time=getTimeMS();
\r
62 num_benchmark_frames=0;
\r
68 OsdOpenGL::~OsdOpenGL()
\r
81 int OsdOpenGL::getFD()
\r
83 if (!initted) return 0;
\r
87 Surface * OsdOpenGL::createNewSurface() {
\r
88 return (Surface*)new SurfaceOpenGL();
\r
91 int OsdOpenGL::init(void* device)
\r
93 if (initted) return 0;
\r
94 Video* video = Video::getInstance();
\r
95 //window=*((HWND*)device);
\r
97 // May be this device specific part should go to a device specific child class
\r
99 //init broadcom chipset (Move to video?)
\r
102 //First get connection to egl
\r
103 egl_display=eglGetDisplay(EGL_DEFAULT_DISPLAY);
\r
105 if (egl_display==EGL_NO_DISPLAY) {
\r
106 Log::getInstance()->log("OSD", Log::WARN, "Could not get egl display! %x",eglGetError());
\r
112 if (eglInitialize(egl_display, NULL, NULL)==EGL_FALSE) {
\r
113 Log::getInstance()->log("OSD", Log::WARN, "Initialising display failed! %x",eglGetError());
\r
117 const char *query_str=eglQueryString(egl_display,EGL_CLIENT_APIS);
\r
118 if (query_str) Log::getInstance()->log("OSD", Log::NOTICE, "%s",query_str);
\r
119 else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x",eglGetError());
\r
120 query_str=eglQueryString(egl_display,EGL_EXTENSIONS);
\r
121 if (query_str) Log::getInstance()->log("OSD", Log::NOTICE, "%s",query_str);
\r
122 else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x",eglGetError());
\r
124 const EGLint attributs[]={
\r
125 EGL_RED_SIZE,8,EGL_GREEN_SIZE, 8,EGL_BLUE_SIZE, 8,EGL_ALPHA_SIZE, 8,
\r
126 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
\r
127 EGL_CONFORMANT, EGL_OPENGL_ES2_BIT,
\r
129 }; // Here, we might have to select the resolution!
\r
134 if (eglChooseConfig(egl_display, attributs, &egl_ourconfig, 1, &number)==EGL_FALSE) {
\r
135 Log::getInstance()->log("OSD", Log::WARN, "Choosing egl config failed! %d",eglGetError());
\r
139 const EGLint attr_context[]={
\r
140 EGL_CONTEXT_CLIENT_VERSION,2,
\r
144 egl_context=eglCreateContext(egl_display,egl_ourconfig,EGL_NO_CONTEXT,attr_context);
\r
145 if (egl_context==EGL_NO_CONTEXT) {
\r
146 Log::getInstance()->log("OSD", Log::WARN, "Creating egl context failed! %d",eglGetError());
\r
150 // warning broadcom specific, get display size!
\r
151 display_width=display_height=0;
\r
152 if (graphics_get_display_size(0, &display_width, &display_height)<0) {
\r
153 Log::getInstance()->log("OSD", Log::WARN, "Getting display size failed! (BCM API) ");
\r
156 Log::getInstance()->log("OSD", Log::NOTICE, "Displaysize is %d x %d ",display_width, display_height);
\r
157 VC_RECT_T dst_rect ={0,0,display_width,display_height};
\r
158 VC_RECT_T src_rect={0,0,display_width<<16,display_height<<16};
\r
159 DISPMANX_DISPLAY_HANDLE_T bcm_display;
\r
160 DISPMANX_ELEMENT_HANDLE_T bcm_element;
\r
161 DISPMANX_UPDATE_HANDLE_T bcm_update;
\r
164 bcm_display=vc_dispmanx_display_open(0);
\r
165 bcm_update=vc_dispmanx_update_start(0);
\r
166 bcm_element=vc_dispmanx_element_add(bcm_update,bcm_display,
\r
168 &src_rect,DISPMANX_PROTECTION_NONE,0, 0, (DISPMANX_TRANSFORM_T) 0);
\r
170 vc_dispmanx_update_submit_sync(bcm_update);
\r
171 static EGL_DISPMANX_WINDOW_T nativewindow;
\r
172 nativewindow.element=bcm_element;
\r
173 nativewindow.height=display_height;
\r
174 nativewindow.width=display_width;
\r
176 egl_surface = eglCreateWindowSurface(egl_display,egl_ourconfig, &nativewindow,NULL );
\r
177 if (egl_surface==EGL_NO_SURFACE) {
\r
178 Log::getInstance()->log("OSD", Log::WARN, "Creating egl window surface failed!");
\r
182 if (eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context)== EGL_FALSE) {
\r
183 Log::getInstance()->log("OSD", Log::WARN, "Making egl Current failed");
\r
190 //Now we will create the Screen
\r
191 screen = (Surface*) new SurfaceOpenGL(Surface::SCREEN);
\r
193 screen->create(video->getScreenWidth(), video->getScreenHeight());
\r
195 initted = 1; // must set this here or create surface won't work
\r
197 //glGenBuffers(1, &vB);
\r
198 //glGenBuffers(1, &iB);
\r
200 //Preparing the Shaders
\r
202 gen_shader=CreateShader(generic_vertex_shader, GL_VERTEX_SHADER);
\r
203 osd_shader=CreateShader(osd_frag_shader, GL_FRAGMENT_SHADER);
\r
206 osd_program=glCreateProgram();
\r
207 if (osd_program==0) {
\r
208 Log::getInstance()->log("OSD", Log::WARN, "Creating glsl program failed!%d",glGetError());
\r
211 glAttachShader(osd_program,gen_shader);
\r
212 glAttachShader(osd_program,osd_shader);
\r
213 glBindAttribLocation(osd_program,0,"vec_pos");
\r
214 glBindAttribLocation(osd_program,1,"tex_coord");
\r
216 osd_sampler_loc=glGetUniformLocation(osd_program,"texture");
\r
218 glLinkProgram(osd_program);
\r
220 glGetShaderiv(osd_program,GL_LINK_STATUS, &link_status);
\r
222 if (!link_status) {
\r
224 glGetProgramInfoLog(osd_program,1024,NULL,buffer);
\r
225 Log::getInstance()->log("OSD", Log::WARN, "Compiling Programm failed!");
\r
226 Log::getInstance()->log("OSD", Log::WARN, "%s",buffer);
\r
227 glDeleteProgram(osd_program);
\r
231 glClearColor(0.0f,0.0f,0.0f,1.f);
\r
233 eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
\r
235 if (((VideoVPEOGL*)Video::getInstance())->initUsingOSDObjects()!=1) { //call Video for init opengl stuff
\r
247 GLuint OsdOpenGL::CreateShader(const GLchar * source, GLenum type)
\r
251 ret_shad=glCreateShader(type);
\r
252 if (ret_shad==0 ) {
\r
253 Log::getInstance()->log("OSD", Log::WARN, "Creating Shader failed! %d",glGetError());
\r
256 glShaderSource(ret_shad,1,&source,NULL);
\r
257 glCompileShader(ret_shad);
\r
259 glGetShaderiv(ret_shad,GL_COMPILE_STATUS, &comp_status);
\r
261 if (!comp_status) {
\r
263 Log::getInstance()->log("OSD", Log::WARN, "Compiling Shader failed!");
\r
264 glGetShaderInfoLog(ret_shad,1024,NULL,buffer);
\r
265 Log::getInstance()->log("OSD", Log::WARN, "%s",buffer);
\r
266 glDeleteShader(ret_shad);
\r
273 void OsdOpenGL::InitVertexBuffer(float scalex,float scaley)
\r
275 Video* video=Video::getInstance();
\r
278 OSDCOLOR osdcolor={1.f,1.f,1.f,1.f};
\r
280 // osdvertices[0].c=osdcolor;
\r
281 osdvertices[0].x= (scalex);
\r
282 osdvertices[0].y=-scaley;
\r
283 osdvertices[0].z=0.5;
\r
284 osdvertices[0].u=texx;
\r
285 osdvertices[0].v=texy;
\r
286 // osdvertices[1].c=osdcolor;
\r
287 osdvertices[1].x=(scalex);
\r
288 osdvertices[1].y=(scaley);
\r
289 osdvertices[1].z=0.5f;
\r
290 osdvertices[1].u=texx;
\r
291 osdvertices[1].v=0.f;
\r
292 // osdvertices[0].c=osdcolor;
\r
293 osdvertices[2].x=(-scalex);
\r
294 osdvertices[2].y=-scaley;
\r
295 osdvertices[2].z=0.5f;
\r
296 osdvertices[2].u=0.f;
\r
297 osdvertices[2].v=texy;
\r
298 // osdvertices[3].c=osdcolor;
\r
299 osdvertices[3].x=-scalex;
\r
300 osdvertices[3].y=(scaley);
\r
301 osdvertices[3].z=0.5f;
\r
302 osdvertices[3].u=0.f;
\r
303 osdvertices[3].v=0.f;
\r
315 // glBindBuffer(GL_ARRAY_BUFFER, vB);
\r
316 // glBufferData(GL_ARRAY_BUFFER, sizeof(osdvertices), osdvertices, GL_STATIC_DRAW);
\r
319 // glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, iB);
\r
320 //glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(osdindices), osdindices, GL_STATIC_DRAW);
\r
327 int OsdOpenGL::shutdown()
\r
329 if (!initted) return 0;
\r
332 (((VideoVPEOGL*)Video::getInstance())->shutdownUsingOSDObjects());
\r
335 if (osd_shader!=0) glDeleteShader(osd_shader);
\r
336 if (gen_shader!=0) glDeleteShader(gen_shader);
\r
337 if (osd_program!=0) glDeleteProgram(osd_program);
\r
339 glClear(GL_COLOR_BUFFER_BIT);
\r
340 eglSwapBuffers(egl_display, egl_surface);
\r
341 eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
\r
342 eglDestroySurface(egl_display,egl_surface);
\r
343 eglDestroyContext(egl_display,egl_context);
\r
344 eglTerminate(egl_display );
\r
349 void OsdOpenGL::screenShot(const char* fileName)
\r
351 screen->screenShot(fileName);
\r
354 void OsdOpenGL::threadMethod()
\r
356 // We have to claim the gl context for this thread
\r
359 //glmutex.Unlock();
\r
362 unsigned int waittime=10;
\r
364 // if (evrstate==EVR_pres_off || evrstate==EVR_pres_pause)
\r
367 //TODO get surfaces from Video object
\r
368 /* } else if (evrstate==EVR_pres_started)
\r
370 LPDIRECT3DSURFACE9 surf;
\r
371 if (dsallocator) dsallocator->GetNextSurface(&surf,&waittime);
\r
380 if (dsallocator) dsallocator->DiscardSurfaceandgetWait(&waittime);
\r
385 if (waittime!=0) MILLISLEEP(min(10,waittime));
\r
388 //eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
\r
392 void OsdOpenGL::threadPostStopCleanup()
\r
399 // This function is called from the WinMain function in order to get Screen updates
\r
400 void OsdOpenGL::Render()
\r
402 if (!initted) return ;
\r
403 if (external_driving) {
\r
404 long long time1=getTimeMS();
\r
406 if ((time1-lastrendertime)>200) {//5 fps for OSD updates are enough, avoids tearing
\r
407 InternalRendering(NULL);
\r
408 lastrendertime=getTimeMS();
\r
410 //Sleep(5); //Sleep for 5 ms, in order to avoid blocking the other threads
\r
413 struct timespec ts;
\r
414 clock_gettime(CLOCK_MONOTONIC, &ts);
\r
415 long long time1=ts.tv_sec*1000+ts.tv_nsec/1000000LL;
\r
416 if ((time1-lastrendertime)>50) {//10 fps for OSD updates are enough, avoids tearing
\r
417 InternalRendering(NULL);
\r
418 lastrendertime=getTimeMS();
\r
427 void OsdOpenGL::RenderDS(GLuint present){
\r
428 if (!initted) return;
\r
429 if (external_driving) {
\r
430 InternalRendering(present);
\r
431 lastrendertime=getTimeMS();
\r
436 void OsdOpenGL::InternalRendering(GLuint present){
\r
438 /* HRESULT losty=d3ddevice->TestCooperativeLevel();
\r
439 if (losty==D3DERR_DEVICELOST) {
\r
442 return; //Device Lost
\r
444 if (losty==D3DERR_DEVICENOTRESET){
\r
449 WaitForSingleObject(event,INFINITE);
\r
454 LPDIRECT3DSURFACE9 targetsurf;
\r
457 targetsurf=swapsurf;
\r
458 d3ddevice->SetRenderTarget(0,swapsurf);//Stupid VMR manipulates the render target
\r
462 targetsurf=d3drtsurf;
\r
463 d3ddevice->SetRenderTarget(0,d3drtsurf);//Stupid VMR manipulates the render target
\r
465 D3DSURFACE_DESC targetdesc;
\r
466 targetsurf->GetDesc(&targetdesc);
\r
468 if (external_driving) {
\r
469 //Copy video to Backbuffer
\r
470 if (present!=NULL ) {
\r
471 VideoWin* video =(VideoWin*) Video::getInstance();
\r
472 /*calculating destination rect *
\r
473 RECT destrect={0,0,/*video->getScreenWidth()* targetdesc.Width,
\r
474 /*video->getScreenHeight()*targetdesc.Height};
\r
475 UCHAR mode=video->getMode();
\r
477 case Video::EIGHTH:
\r
478 destrect.right=destrect.right/2;
\r
479 destrect.bottom=destrect.bottom/2;
\r
480 case Video::QUARTER:
\r
481 destrect.right=destrect.right/2+video->getPosx()*2;
\r
482 destrect.bottom=destrect.bottom/2+video->getPosy()*2;
\r
483 destrect.left=video->getPosx()*2;
\r
484 destrect.top=video->getPosy()*2;
\r
485 d3ddevice->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,0,0),1.0f,0);
\r
488 D3DSURFACE_DESC surf_desc;
\r
489 present->GetDesc(&surf_desc);//for chop sides
\r
490 RECT sourcerect= {0,0,surf_desc.Width,surf_desc.Height};
\r
491 if (video->getPseudoTVsize()==Video::ASPECT4X3
\r
492 && video->getMode()==Video::NORMAL
\r
493 && video->getAspectRatio()==Video::ASPECT16X9) {
\r
494 unsigned int correction=((double) (surf_desc.Width))*4.*9./3./16.;
\r
495 sourcerect.left=(surf_desc.Width-correction)/2;
\r
496 sourcerect.right=sourcerect.left+correction;
\r
498 d3ddevice->StretchRect(present,&sourcerect,targetsurf ,&destrect,filter_type);
\r
502 VideoWin* video =(VideoWin*) Video::getInstance();
\r
504 if (!video->isVideoOn()) d3ddevice->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,0,0),1.0f,0);
\r
508 //InitVertexBuffer(display_width,display_height);
\r
509 InitVertexBuffer(1.f,1.f);
\r
512 glViewport(0, 0, display_width,display_height);
\r
514 glClear(GL_COLOR_BUFFER_BIT);
\r
515 glUseProgram(osd_program);
\r
517 glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE,sizeof(OSDVERTEX), osdvertices);
\r
518 glEnableVertexAttribArray(0);
\r
519 glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE,sizeof(OSDVERTEX), &(osdvertices[0].u));
\r
520 glEnableVertexAttribArray(1);
\r
525 glActiveTexture(GL_TEXTURE0);
\r
526 glBindTexture(GL_TEXTURE_2D,((SurfaceOpenGL*)screen)->getTexture());
\r
528 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
\r
529 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
\r
531 glUniform1i(osd_sampler_loc,0);
\r
533 if (0) { //This is ok for ffmpeg rendering not OMX
\r
534 glEnable(GL_BLEND);
\r
535 glBlendFuncSeparate (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,GL_ZERO,GL_ONE);
\r
538 /* glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE,sizeof(OSDVERTEX),
\r
539 (GLvoid*)(((char*)osdvertices)+3*sizeof(GLfloat)));
\r
540 glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE,sizeof(OSDVERTEX),
\r
541 (GLvoid*)(((char*)osdvertices)+3*sizeof(GLfloat)+sizeof(OSDCOLOR)));*/
\r
542 //glDisable(GL_LIGHTING);
\r
543 //glEnable(GL_TEXTURE_2D);
\r
544 //glEnable(GL_BLEND);
\r
545 //glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
\r
546 //glDepthFunc(GL_ALWAYS);
\r
547 //glDisable(GL_DEPTH_TEST);
\r
548 //glDisable(GL_STENCIL_TEST);
\r
549 //glDisable(GL_CULL_FACE);
\r
554 glActiveTexture(GL_TEXTURE0);
\r
555 glBindTexture(GL_TEXTURE_2D,((SurfaceOpenGL*)screen)->getTexture());
\r
556 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
\r
557 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);*/
\r
558 // glUniform1i(mTextureUniformHandle, present);
\r
562 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
\r
564 //glDrawElements(GL_TRIANGLES, sizeof(osdindices)/sizeof(osdindices[0]), GL_UNSIGNED_BYTE, 0);
\r
569 /* glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE,sizeof(OSDVERTEX), 0);
\r
570 glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE,sizeof(OSDVERTEX),
\r
571 (GLvoid*)(3*sizeof(GLfloat)));
\r
572 glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE,sizeof(OSDVERTEX),
\r
573 (GLvoid*)(3*sizeof(GLfloat)+sizeof(OSDCOLOR)));*/
\r
575 //glDisable(GL_BLEND);
\r
576 //glDisable(GL_TEXTURE_2D);
\r
578 //Show it to the user!
\r
579 eglSwapBuffers(egl_display, egl_surface);
\r
582 #ifdef BENCHMARK_FPS
\r
583 num_benchmark_frames++;
\r
584 if (getTimeMS()-last_benchmark_time>4000) {
\r
585 float fps=1000./(float)(getTimeMS()-last_benchmark_time);
\r
586 fps*=((float)num_benchmark_frames);
\r
587 num_benchmark_frames=0;
\r
588 Log::getInstance()->log("OSD", Log::NOTICE, "Current FPS %g", fps);
\r
589 last_benchmark_time=getTimeMS();
\r
596 // if (!external_driving) {
\r
597 // Sleep(4);//The User can wait for 4 milliseconds to see his changes
\r
601 bool OsdOpenGL::DoLost(){
\r
603 Log::getInstance()->log("OSD", Log::WARN, "Direct3D Device Lost! Reobtaining...");
\r
605 if (external_driving && dsallocator!=NULL) {
\r
606 dsallocator->LostDevice(d3ddevice,d3d); //Propagate the information through DS
\r
608 //First we free up all resources
\r
609 Video* video = Video::getInstance();
\r
610 ((SurfaceWin*)screen)->ReleaseSurface();
\r
611 if (d3drtsurf) d3drtsurf->Release();
\r
613 D3DPRESENT_PARAMETERS d3dparas;
\r
614 ZeroMemory(&d3dparas,sizeof(d3dparas));
\r
615 d3dparas.BackBufferWidth=BACKBUFFER_WIDTH;
\r
616 d3dparas.BackBufferHeight=BACKBUFFER_HEIGHT;
\r
617 d3dparas.Windowed=TRUE;
\r
618 d3dparas.SwapEffect=D3DSWAPEFFECT_COPY;
\r
620 if (swapsurf) {swapsurf->Release();swapsurf=NULL;};
\r
621 if (swappy) {swappy->Release();swappy=NULL;};
\r
623 if (d3ddevice->Reset(&d3dparas)!=D3D_OK){
\r
626 d3ddevice->GetRenderTarget(0,&d3drtsurf);
\r
627 if (d3ddevman) d3ddevman->ResetDevice(d3ddevice,dxvatoken);
\r
628 //InitVertexBuffer();
\r
629 //Redraw Views, Chris could you add a member function to BoxStack, so that
\r
630 // I can cause it to completely redraw the Views?
\r
631 // Otherwise the OSD would be distorted after Device Lost
\r
637 screen->create(video->getScreenWidth(), video->getScreenHeight());
\r
638 screen->display();*/
\r
645 void OsdOpenGL::BeginPainting() {//We synchronize calls to d3d between different threads
\r
648 if (eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context)== EGL_FALSE) {
\r
649 Log::getInstance()->log("OSD", Log::WARN, "Making egl Current failed in thread %d",eglGetError());
\r
655 void OsdOpenGL::EndPainting() {
\r
656 eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
\r
660 void OsdOpenGL::setExternalDriving(/*DsAllocator* dsall,*/unsigned int width, unsigned height) {
\r
665 d3ddevice->StretchRect(swapsurf,NULL,d3drtsurf,NULL,filter_type);
\r
666 LPDIRECT3DSWAPCHAIN9 temp=swappy;
\r
667 LPDIRECT3DSURFACE9 tempsurf=swapsurf;
\r
671 tempsurf->Release();
\r
676 external_driving=false;
\r
680 WaitForSingleObject(event,INFINITE);//We will only return if we are initted
\r
683 if (width>BACKBUFFER_WIDTH || height>BACKBUFFER_HEIGHT)
\r
685 D3DPRESENT_PARAMETERS d3dparas;
\r
686 ZeroMemory(&d3dparas,sizeof(d3dparas));
\r
687 d3dparas.BackBufferWidth=width;
\r
688 d3dparas.BackBufferHeight=height;
\r
689 d3dparas.Windowed=TRUE;
\r
690 d3dparas.SwapEffect=D3DSWAPEFFECT_COPY;
\r
691 if (d3ddevice->CreateAdditionalSwapChain(&d3dparas,&swappy)!=D3D_OK){
\r
692 Log::getInstance()->log("OSD", Log::WARN, "Could not create Swap Chain!");
\r
695 swappy->GetBackBuffer(0,D3DBACKBUFFER_TYPE_MONO,&swapsurf);
\r
697 Log::getInstance()->log("OSD", Log::INFO, "Create Additional Swap Chain %d %d!",width,height);
\r
701 external_driving=true;
\r
706 void OsdOpenGL::Blank() {
\r
708 glClearColor(0.15f, 0.25f, 0.35f, 1.0f); // change this to black after testing
\r
709 glClear( GL_COLOR_BUFFER_BIT );
\r
710 glClear( GL_DEPTH_BUFFER_BIT );
\r