// classic way void XenonGLDisplay() { // Reset states and matrices XeGlResetDirty(); xe_state.dirty = 1; // Set stream Xe_SetStreamSource(xe, 0, pVbGL, 0, 10); // update vb and ib cache !!! xe_Vertices = Xe_VB_Lock(xe, pVbGL, 0, xe_NumVerts * sizeof(glVerticesFormat_t), XE_LOCK_WRITE); Xe_VB_Unlock(xe, pVbGL); xe_indices = Xe_IB_Lock(xe, pIbGL, 0, xe_NumIndices * sizeof(short), XE_LOCK_WRITE); Xe_IB_Unlock(xe, pIbGL); // Resolve Xe_Resolve(xe); //while(!Xe_IsVBlank(xe)); Xe_Sync(xe); // Reset states Xe_InvalidateState(xe); // printf("xe_NumVerts %d xe_NumIndices %d\r\n", xe_NumVerts, xe_NumIndices); // Reset vertices xe_NumVerts = xe_PrevNumVerts = 0; xe_NumIndices = xe_PrevNumIndices = 0; ShowFPS(); }
static void render() { Xe_Resolve(g_pVideoDevice); // // Xe_Sync(g_pVideoDevice); // done in pre_render /* begin rendering in background */ Xe_Execute(g_pVideoDevice); }
void SYSVideoUpdate() { /* resize uv to viewport */ int vwidth = bitmap.viewport.w + (2 * bitmap.viewport.x); int vheight = bitmap.viewport.h + (2 * bitmap.viewport.y); update_texture_viewport(); int video_filter = getVideoFitler(); // apply video filter switch (video_filter){ case VF_2XSAI: filter_Std2xSaI_ex8(bitmap.data, bitmap.pitch, texture_buffer, vwidth, vheight); g_pTexture->width = vwidth<<1; g_pTexture->height = vheight<<1; break; case VF_BLINEAR: g_pTexture->use_filtering = 0; XeTexSubImage(g_pTexture, bitmap.viewport.x, bitmap.viewport.y, bitmap.viewport.w, bitmap.viewport.h, bitmap.data); g_pTexture->width = vwidth; g_pTexture->height = vheight; break; default: g_pTexture->use_filtering = 1; XeTexSubImage(g_pTexture, bitmap.viewport.x, bitmap.viewport.y, bitmap.viewport.w, bitmap.viewport.h, bitmap.data); g_pTexture->width = vwidth; g_pTexture->height = vheight; break; } // Refresh texture cash Xe_Surface_LockRect(g_pVideoDevice, g_pTexture, 0, 0, 0, 0, XE_LOCK_WRITE); Xe_Surface_Unlock(g_pVideoDevice, g_pTexture); // Select stream and shaders Xe_SetTexture(g_pVideoDevice, 0, g_pTexture); Xe_SetCullMode(g_pVideoDevice, XE_CULL_NONE); Xe_SetStreamSource(g_pVideoDevice, 0, vb, 0, sizeof (DrawVerticeFormats)); Xe_SetShader(g_pVideoDevice, SHADER_TYPE_PIXEL, g_pPixelTexturedShader, 0); Xe_SetShader(g_pVideoDevice, SHADER_TYPE_VERTEX, g_pVertexShader, 0); Xe_SetClearColor(g_pVideoDevice, 0xFF000000); // Draw Xe_DrawPrimitive(g_pVideoDevice, XE_PRIMTYPE_RECTLIST, 0, 1); // Resolve Xe_Resolve(g_pVideoDevice); //while (!Xe_IsVBlank(g_pVideoDevice)); Xe_Sync(g_pVideoDevice); // Reset states Xe_InvalidateState(g_pVideoDevice); }
static bool xenon360_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t *video_info) { gl_t *vid = data; ScreenUv[UV_TOP] = ((float) (width) / (float) XE_W)*2; ScreenUv[UV_LEFT] = ((float) (height) / (float) XE_H)*2; DrawVerticeFormats * Rect = Xe_VB_Lock(vid->gl_device, vid->vb, 0, 3 * sizeof(DrawVerticeFormats), XE_LOCK_WRITE); /* bottom left */ Rect[1].v = ScreenUv[UV_LEFT]; Rect[2].u = ScreenUv[UV_TOP]; Xe_VB_Unlock(vid->gl_device, vid->vb); /* Refresh texture cache */ uint16_t *dst = Xe_Surface_LockRect(vid->gl_device, vid->g_pTexture, 0, 0, 0, 0, XE_LOCK_WRITE); const uint16_t *src = frame; unsigned stride_in = pitch >>1; unsigned stride_out = vid->g_pTexture->wpitch >> 1; unsigned copy_size = width << 1; for (unsigned y = 0; y < height; y++, dst += stride_out, src += stride_in) memcpy(dst, src, copy_size); Xe_Surface_Unlock(vid->gl_device, vid->g_pTexture); /* Reset states */ Xe_InvalidateState(vid->gl_device); Xe_SetClearColor(vid->gl_device, 0); /* Select stream */ Xe_SetTexture(vid->gl_device, 0, vid->g_pTexture); Xe_SetCullMode(vid->gl_device, XE_CULL_NONE); Xe_SetStreamSource(vid->gl_device, 0, vid->vb, 0, sizeof(DrawVerticeFormats)); /* Select shaders */ Xe_SetShader(vid->gl_device, SHADER_TYPE_PIXEL, vid->g_pPixelTexturedShader, 0); Xe_SetShader(vid->gl_device, SHADER_TYPE_VERTEX, vid->g_pVertexShader, 0); #ifdef HAVE_MENU menu_driver_frame(video_info); #endif /* Draw */ Xe_DrawPrimitive(vid->gl_device, XE_PRIMTYPE_TRIANGLELIST, 0, 1); /* Resolve */ Xe_Resolve(vid->gl_device); Xe_Sync(vid->gl_device); return true; }
/** Effectue un printf rapide avec effaement de couleur/ et rafraichissement **/ void fastPrintf(int x, int y, int color, char *str) { Xe_InvalidateState(xe); XeDrawSurface2(XeBgInfo, -1, -1, 2, 2, 0); XePrintf(-0.5, 0, str, 0.6, 0xFF0000);//Bleu #if 1 //Blanc .... Xe_SetClearColor(xe, ~0); Xe_Resolve(xe); while (!Xe_IsVBlank(xe)) ; Xe_Sync(xe); #endif }
void XenonGLDisplay() { Xe_SetBlendOp(xe, XE_BLENDOP_ADD); Xe_SetSrcBlend(xe, XE_BLEND_SRCALPHA); Xe_SetDestBlend(xe, XE_BLEND_INVSRCALPHA); // update vb cache !!! Xe_VB_Lock(xe, pVbGL, 0, XE_MAX_VERTICES, XE_LOCK_WRITE); Xe_VB_Unlock(xe, pVbGL); /* // Refresh texture cash unsigned int * pBitmap = Xe_Surface_LockRect(xe, pVideoSurface, 0, 0, 0, 0, XE_LOCK_WRITE); int i; for(i = 0;i<(vid.width*vid.height);i++) { //Make an ARGB bitmap unsigned int c = (pQ2Palette[vid.buffer[i]]) >> 8 | ( 0xFF << 24 ); pBitmap[i] = c; } Xe_Surface_Unlock(xe, pVideoSurface); // Select stream and shaders Xe_SetTexture(xe, 0, pVideoSurface); Xe_SetCullMode(xe, XE_CULL_NONE); Xe_SetStreamSource(xe, 0, pVBSw, 0, 10); Xe_SetShader(xe, SHADER_TYPE_PIXEL, pPixelShader, 0); Xe_SetShader(xe, SHADER_TYPE_VERTEX, pVertexShader, 0); // Draw Xe_DrawPrimitive(xe, XE_PRIMTYPE_RECTLIST, 0, 1); */ // Resolve Xe_Resolve(xe); while(!Xe_IsVBlank(xe)); Xe_Sync(xe); // Reset states Xe_InvalidateState(xe); Xe_SetClearColor(xe, 0); xe_NumVerts = xe_PrevNumVerts = 0; ShowFPS(); }
void updateIGM(int debut, int fin) { if(debut) Xe_InvalidateState(xe); //Dessine la scene XeDrawSurface2(igmBg, -1, -1, 2, 2, 1); //XeDrawSurface(igmBarr,-1,-1,1,1,1);//Barr en haut XeDrawSurface2(igmBarr, -1, 0.7, 2, .3, 1); //event sur la manette igmInput(); switch(menuselected) { case 0: drawMenuIcon(); break; case ITEM_RETURN_TO_MENU: drawReturnToMenu(); break; case ITEM_DISPLAY_INFO: drawInformation(); break; default: drawMenuIcon(); break; } if(fin) { Xe_SetClearColor(xe, ~0); /* resolve (and clear) */ Xe_Resolve(xe); /* wait for render finish */ while (!Xe_IsVBlank(xe)); Xe_Sync(xe); } nframe=1.0f; }
void XenonEndGl() { // update vb cache !!! xe_Vertices = Xe_VB_Lock(xe, pVbGL, 0, xe_NumVerts * sizeof(glVerticesFormat_t), XE_LOCK_WRITE); Xe_VB_Unlock(xe, pVbGL); xe_indices = Xe_IB_Lock(xe, pIbGL, 0, xe_NumIndices * sizeof(short), XE_LOCK_WRITE); Xe_IB_Unlock(xe, pIbGL); // Resolve Xe_Resolve(xe); Xe_Execute(xe); // Reset vertices xe_NumVerts = xe_PrevNumVerts = 0; xe_NumIndices = xe_PrevNumIndices = 0; ShowFPS(); }
/** Effectue un printf rapide avec effaement de couleur/ et rafraichissement **/ void errorPrintf(int x, int y, int color, char *str) { Xe_InvalidateState(xe); XePrintf(-0.5, 0, str, 0.6, 0x0000FF);//Red #if 1 //Blanc .... Xe_SetClearColor(xe, ~0); Xe_Resolve(xe); while (!Xe_IsVBlank(xe)) ; Xe_Sync(xe); //Attends qu'une touche soit presser while (1) { struct controller_data_s c; if (get_controller_data(&c, 0)) { return;//Quit } } #endif }
static void render() { Xe_Resolve(g_pVideoDevice); //while (!Xe_IsVBlank(g_pVideoDevice)); Xe_Sync(g_pVideoDevice); }