本文整理汇总了C++中GPU_Log函数的典型用法代码示例。如果您正苦于以下问题:C++ GPU_Log函数的具体用法?C++ GPU_Log怎么用?C++ GPU_Log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GPU_Log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Quit
static void Quit(GPU_Renderer* renderer)
{
GPU_Log(" %s (dummy)\n", __func__);
renderer->impl->FreeTarget(renderer, renderer->current_context_target);
renderer->current_context_target = NULL;
}
示例2: ActivateShaderProgram
static void ActivateShaderProgram(GPU_Renderer* renderer, Uint32 program_object, GPU_ShaderBlock* block)
{
GPU_Target* target = renderer->current_context_target;
GPU_Log(" %s (dummy)\n", __func__);
if(target == NULL)
return;
if((renderer->enabled_features & GPU_FEATURE_BASIC_SHADERS) == GPU_FEATURE_BASIC_SHADERS)
{
if(program_object == 0) // Implies default shader
{
// Already using a default shader?
if(target->context->current_shader_program == target->context->default_textured_shader_program
|| target->context->current_shader_program == target->context->default_untextured_shader_program)
return;
program_object = target->context->default_untextured_shader_program;
}
renderer->impl->FlushBlitBuffer(renderer);
}
target->context->current_shader_program = program_object;
}
示例3: SetWrapMode
static void SetWrapMode(GPU_Renderer* renderer, GPU_Image* image, GPU_WrapEnum wrap_mode_x, GPU_WrapEnum wrap_mode_y)
{
GPU_Log(" %s (dummy)\n", __func__);
image->wrap_mode_x = wrap_mode_x;
image->wrap_mode_y = wrap_mode_y;
}
示例4: SetWindowResolution
static Uint8 SetWindowResolution(GPU_Renderer* renderer, Uint16 w, Uint16 h)
{
GPU_Target* target = renderer->current_context_target;
GPU_Log(" %s (dummy)\n", __func__);
if(target == NULL)
return 0;
// Don't need to resize (only update internals) when resolution isn't changing.
SDL_GetWindowSize(SDL_GetWindowFromID(target->context->windowID), &target->context->window_w, &target->context->window_h);
if(target->context->window_w != w || target->context->window_h != h)
{
SDL_SetWindowSize(SDL_GetWindowFromID(target->context->windowID), w, h);
SDL_GetWindowSize(SDL_GetWindowFromID(target->context->windowID), &target->context->window_w, &target->context->window_h);
}
// Store the resolution for fullscreen_desktop changes
target->context->stored_window_w = target->context->window_w;
target->context->stored_window_h = target->context->window_h;
// Update base dimensions
target->base_w = target->context->window_w;
target->base_h = target->context->window_h;
// Resets virtual resolution
target->w = target->base_w;
target->h = target->base_h;
target->using_virtual_resolution = 0;
return 1;
}
示例5: MakeCurrent
static void MakeCurrent(GPU_Renderer* renderer, GPU_Target* target, Uint32 windowID)
{
GPU_Log(" %s (dummy)\n", __func__);
if(target == NULL || target->context == NULL)
return;
renderer->current_context_target = target;
// Reset if the target's window was changed
if(target->context->windowID != windowID)
{
// Update the window mappings
GPU_RemoveWindowMapping(windowID);
// Don't remove the target's current mapping. That lets other windows refer to it.
target->context->windowID = windowID;
GPU_AddWindowMapping(target);
// Update target's window size
SDL_GetWindowSize(SDL_GetWindowFromID(windowID), &target->context->window_w, &target->context->window_h);
target->base_w = target->context->window_w;
target->base_h = target->context->window_h;
// Reset the camera here for this window
}
}
示例6: CopyImageFromSurface
static GPU_Image* CopyImageFromSurface(GPU_Renderer* renderer, SDL_Surface* surface)
{
GPU_Log(" %s (dummy)\n", __func__);
if(surface == NULL)
return NULL;
return renderer->impl->CreateImage(renderer, surface->w, surface->h, GPU_FORMAT_RGBA);
}
示例7: CopySurfaceFromTarget
static SDL_Surface* CopySurfaceFromTarget(GPU_Renderer* renderer, GPU_Target* target)
{
GPU_Log(" %s (dummy)\n", __func__);
if(target == NULL)
return NULL;
return SDL_CreateRGBSurface(SDL_SWSURFACE, target->base_w, target->base_h, 32, 0, 0, 0, 0);
}
示例8: CopySurfaceFromImage
static SDL_Surface* CopySurfaceFromImage(GPU_Renderer* renderer, GPU_Image* image)
{
GPU_Log(" %s (dummy)\n", __func__);
if(image == NULL)
return NULL;
return SDL_CreateRGBSurface(SDL_SWSURFACE, image->texture_w, image->texture_h, 32, 0, 0, 0, 0);
}
示例9: SetAsCurrent
static void SetAsCurrent(GPU_Renderer* renderer)
{
GPU_Log(" %s (dummy)\n", __func__);
if(renderer->current_context_target == NULL)
return;
renderer->impl->MakeCurrent(renderer, renderer->current_context_target, renderer->current_context_target->context->windowID);
}
示例10: CopyImage
static GPU_Image* CopyImage(GPU_Renderer* renderer, GPU_Image* image)
{
GPU_Log(" %s (dummy)\n", __func__);
if(image == NULL)
return NULL;
return renderer->impl->CreateImage(renderer, image->w, image->h, image->format);
}
示例11: CopyImageFromTarget
static GPU_Image* CopyImageFromTarget(GPU_Renderer* renderer, GPU_Target* target)
{
GPU_Log(" %s (dummy)\n", __func__);
if(target == NULL)
return NULL;
return renderer->impl->CreateImage(renderer, target->w, target->h, GPU_FORMAT_RGBA);
}
示例12: main
int main(int argc, char* argv[])
{
GPU_Target* screen;
// Prepare renderer for SDL_gpu to use
GPU_RendererID rendererID = GPU_MakeRendererID("Dummy", GPU_ReserveNextRendererEnum(), 1, 0);
GPU_RegisterRenderer(rendererID, &create_dummy_renderer, &free_dummy_renderer);
printRenderers();
// Request this specific renderer
screen = GPU_InitRenderer(rendererID.renderer, 800, 600, GPU_DEFAULT_INIT_FLAGS);
if(screen == NULL)
return -1;
printCurrentRenderer();
{
Uint8 done;
SDL_Event event;
GPU_Image* image = GPU_LoadImage("data/test.bmp");
if(image == NULL)
GPU_Log("Failed to load image.\n");
done = 0;
while(!done)
{
while(SDL_PollEvent(&event))
{
if(event.type == SDL_QUIT)
done = 1;
else if(event.type == SDL_KEYDOWN)
{
if(event.key.keysym.sym == SDLK_ESCAPE)
done = 1;
}
}
GPU_Clear(screen);
GPU_Blit(image, NULL, screen, screen->w/2, screen->h/2);
GPU_Flip(screen);
// Long delay to keep the logging from piling up too much
SDL_Delay(500);
}
GPU_FreeImage(image);
}
GPU_Quit();
return 0;
}
示例13: SetVirtualResolution
static void SetVirtualResolution(GPU_Renderer* renderer, GPU_Target* target, Uint16 w, Uint16 h)
{
GPU_Log(" %s (dummy)\n", __func__);
if(target == NULL)
return;
target->w = w;
target->h = h;
target->using_virtual_resolution = 1;
}
示例14: SetFullscreen
static Uint8 SetFullscreen(GPU_Renderer* renderer, Uint8 enable_fullscreen, Uint8 use_desktop_resolution)
{
GPU_Target* target = renderer->current_context_target;
// These values should actually come from the window
Uint8 was_fullscreen = !enable_fullscreen;
Uint8 is_fullscreen = enable_fullscreen;
GPU_Log(" %s (dummy)\n", __func__);
//if(SetWindowFullscreen(target->context->windowID, enable_fullscreen) >= 0)
{
// If we just went fullscreen, save the original resolution
// We do this because you can't depend on the resolution to be preserved by SDL
// SDL_WINDOW_FULLSCREEN_DESKTOP changes the resolution and SDL_WINDOW_FULLSCREEN can change it when a given mode is not available
if(!was_fullscreen && is_fullscreen)
{
target->context->stored_window_w = target->context->window_w;
target->context->stored_window_h = target->context->window_h;
}
// If we're in windowed mode now and a resolution was stored, restore the original window resolution
if(was_fullscreen && !is_fullscreen && (target->context->stored_window_w != 0 && target->context->stored_window_h != 0))
SDL_SetWindowSize(SDL_GetWindowFromID(target->context->windowID), target->context->stored_window_w, target->context->stored_window_h);
// Update window dims
SDL_GetWindowSize(SDL_GetWindowFromID(target->context->windowID), &target->context->window_w, &target->context->window_h);
}
if(is_fullscreen != was_fullscreen)
{
// If virtual res is not set, we need to update the target dims and reset stuff that no longer is right
if(!target->using_virtual_resolution)
{
// Update dims
target->w = target->context->window_w;
target->h = target->context->window_h;
}
// Reset viewport
target->viewport = GPU_MakeRect(0, 0, target->context->window_w, target->context->window_h);
// Update viewport here
// Reset clip
GPU_UnsetClip(target);
// Update camera here
}
target->base_w = target->context->window_w;
target->base_h = target->context->window_h;
return is_fullscreen;
}
示例15: UnsetVirtualResolution
static void UnsetVirtualResolution(GPU_Renderer* renderer, GPU_Target* target)
{
GPU_Log(" %s (dummy)\n", __func__);
if(target == NULL)
return;
target->w = target->base_w;
target->h = target->base_h;
target->using_virtual_resolution = 0;
}