int CGraphics_Threaded::Init() { // fetch pointers m_pStorage = Kernel()->RequestInterface<IStorage>(); m_pConsole = Kernel()->RequestInterface<IConsole>(); // Set all z to -5.0f for(int i = 0; i < MAX_VERTICES; i++) m_aVertices[i].m_Pos.z = -5.0f; // init textures m_FirstFreeTexture = 0; for(int i = 0; i < MAX_TEXTURES-1; i++) m_aTextureIndices[i] = i+1; m_aTextureIndices[MAX_TEXTURES-1] = -1; m_pBackend = CreateGraphicsBackend(); if(InitWindow() != 0) return -1; // fetch final resolusion m_ScreenWidth = g_Config.m_GfxScreenWidth; m_ScreenHeight = g_Config.m_GfxScreenHeight; // create command buffers for(int i = 0; i < NUM_CMDBUFFERS; i++) m_apCommandBuffers[i] = new CCommandBuffer(128*1024, 2*1024*1024); m_pCommandBuffer = m_apCommandBuffers[0]; // create null texture, will get id=0 static const unsigned char aNullTextureData[] = { 0xff,0x00,0x00,0xff, 0xff,0x00,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0xff,0x00,0xff, 0xff,0x00,0x00,0xff, 0xff,0x00,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff, 0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff, }; m_InvalidTexture = LoadTextureRaw(4,4,CImageInfo::FORMAT_RGBA,aNullTextureData,CImageInfo::FORMAT_RGBA,TEXLOAD_NORESAMPLE); return 0; }
int CGraphics_Threaded::Init() { // fetch pointers m_pStorage = Kernel()->RequestInterface<IStorage>(); m_pConsole = Kernel()->RequestInterface<IConsole>(); // init textures m_FirstFreeTexture = 0; for(int i = 0; i < MAX_TEXTURES-1; i++) m_aTextureIndices[i] = i+1; m_aTextureIndices[MAX_TEXTURES-1] = -1; m_FirstFreeVertexArrayIndex = -1; m_pBackend = CreateGraphicsBackend(); if(InitWindow() != 0) return -1; if(m_UseOpenGL3_3) m_pVertices = m_aVertices; else m_pVertices = m_aVerticesOld; // create command buffers for(int i = 0; i < NUM_CMDBUFFERS; i++) m_apCommandBuffers[i] = new CCommandBuffer(256*1024, 2*1024*1024); m_pCommandBuffer = m_apCommandBuffers[0]; // create null texture, will get id=0 static const unsigned char s_aNullTextureData[] = { 0xff,0x00,0x00,0xff, 0xff,0x00,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0xff,0x00,0xff, 0xff,0x00,0x00,0xff, 0xff,0x00,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff, 0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff, }; m_InvalidTexture = LoadTextureRaw(4,4,CImageInfo::FORMAT_RGBA,s_aNullTextureData,CImageInfo::FORMAT_RGBA,TEXLOAD_NORESAMPLE); return 0; }
int CGraphics_Threaded::Init() { // fetch pointers m_pStorage = Kernel()->RequestInterface<IStorage>(); m_pConsole = Kernel()->RequestInterface<IConsole>(); // Set all z to -5.0f for(int i = 0; i < MAX_VERTICES; i++) m_aVertices[i].m_Pos.z = -5.0f; // init textures m_FirstFreeTexture = 0; for(int i = 0; i < MAX_TEXTURES-1; i++) m_aTextureIndices[i] = i+1; m_aTextureIndices[MAX_TEXTURES-1] = -1; m_pBackend = CreateGraphicsBackend(); if(InitWindow() != 0) return -1; // fetch final resolusion m_ScreenWidth = g_Config.m_GfxScreenWidth; m_ScreenHeight = g_Config.m_GfxScreenHeight; // create command buffers for(int i = 0; i < NUM_CMDBUFFERS; i++) m_apCommandBuffers[i] = new CCommandBuffer(128*1024, 2*1024*1024); m_pCommandBuffer = m_apCommandBuffers[0]; // create null texture, will get id=0 unsigned char aNullTextureData[4*32*32]; for(int x = 0; x < 32; ++x) for(int y = 0; y < 32; ++y) { if(x < 16) { if(y < 16) { aNullTextureData[4*(y*32+x)+0] = y*8+x*8+15; aNullTextureData[4*(y*32+x)+1] = 0; aNullTextureData[4*(y*32+x)+2] = 0; } else { aNullTextureData[4*(y*32+x)+0] = 0; aNullTextureData[4*(y*32+x)+1] = y*8+x*8-113; aNullTextureData[4*(y*32+x)+2] = 0; } } else { if(y < 16) { aNullTextureData[4*(y*32+x)+0] = 0; aNullTextureData[4*(y*32+x)+1] = 0; aNullTextureData[4*(y*32+x)+2] = y*8+x*8-113; } else { aNullTextureData[4*(y*32+x)+0] = y*8+x*8-496; aNullTextureData[4*(y*32+x)+1] = y*8+x*8-496; aNullTextureData[4*(y*32+x)+2] = 0; } } aNullTextureData[4*(y*32+x)+3] = 255; } m_InvalidTexture = LoadTextureRaw(32,32,CImageInfo::FORMAT_RGBA,aNullTextureData,CImageInfo::FORMAT_RGBA,TEXLOAD_NORESAMPLE|TEXLOAD_MULTI_DIMENSION); return 0; }