• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GPU_Log函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GPU_Log函数的典型用法代码示例。如果您正苦于以下问题:C++ GPU_Log函数的具体用法?C++ GPU_Log怎么用?C++ GPU_Log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GPU_Log函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:7,代码来源:main.c


示例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;
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:26,代码来源:main.c


示例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;
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:7,代码来源:main.c


示例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;
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:32,代码来源:main.c


示例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
    }
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:26,代码来源:main.c


示例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);
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:9,代码来源:main.c


示例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);
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:9,代码来源:main.c


示例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);
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:9,代码来源:main.c


示例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);
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:9,代码来源:main.c


示例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);
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:9,代码来源:main.c


示例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);
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:9,代码来源:main.c


示例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;
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:56,代码来源:main.c


示例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;
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:11,代码来源:main.c


示例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;
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:54,代码来源:main.c


示例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;
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:11,代码来源:main.c


示例16: LoadShaderBlock

static GPU_ShaderBlock LoadShaderBlock(GPU_Renderer* renderer, Uint32 program_object, const char* position_name, const char* texcoord_name, const char* color_name, const char* modelViewMatrix_name)
{
    GPU_ShaderBlock b;
    
    GPU_Log(" %s (dummy)\n", __func__);
    
    b.position_loc = -1;
    b.texcoord_loc = -1;
    b.color_loc = -1;
    b.modelViewProjection_loc = -1;
    return b;
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:12,代码来源:main.c


示例17: SaveImage

static Uint8 SaveImage(GPU_Renderer* renderer, GPU_Image* image, const char* filename, GPU_FileFormatEnum format)
{
    SDL_Surface* surface;
    
    GPU_Log(" %s (dummy)\n", __func__);
    
    surface = GPU_CopySurfaceFromImage(image);
    GPU_SaveSurface(surface, filename, format);
    
    SDL_FreeSurface(surface);
    return 1;
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:12,代码来源:main.c


示例18: Init

static GPU_Target* Init(GPU_Renderer* renderer, GPU_RendererID renderer_request, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags)
{
	SDL_Window* window;
	
    GPU_Log(" %s (dummy)\n", __func__);
    
	renderer->requested_id = renderer_request;
    renderer->GPU_init_flags = GPU_GetPreInitFlags();
	renderer->SDL_init_flags = SDL_flags;
	
	window = NULL;
    // Is there a window already set up that we are supposed to use?
    if(renderer->current_context_target != NULL)
        window = SDL_GetWindowFromID(renderer->current_context_target->context->windowID);
    else
        window = SDL_GetWindowFromID(GPU_GetInitWindow());
    
    if(window == NULL)
    {
        // Set up window flags
        if(!(renderer->SDL_init_flags & SDL_WINDOW_HIDDEN))
            renderer->SDL_init_flags |= SDL_WINDOW_SHOWN;
        
        window = SDL_CreateWindow("",
                                  SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
                                  w, h,
                                  renderer->SDL_init_flags);

        if(window == NULL)
        {
            GPU_PushErrorCode("GPU_Init", GPU_ERROR_BACKEND_ERROR, "Window creation failed.");
            return NULL;
        }
        
        GPU_SetInitWindow(SDL_GetWindowID(window));
    }
    else
        renderer->SDL_init_flags = SDL_flags;
	
	renderer->enabled_features = 0xFFFFFFFF;  // Pretend to support them all
	
	renderer->current_context_target = renderer->impl->CreateTargetFromWindow(renderer, SDL_GetWindowID(window), renderer->current_context_target);
    if(renderer->current_context_target == NULL)
        return NULL;
    
    
    // If the dimensions of the window don't match what we asked for, then set up a virtual resolution to pretend like they are.
    if(!(renderer->GPU_init_flags & GPU_INIT_DISABLE_AUTO_VIRTUAL_RESOLUTION) && w != 0 && h != 0 && (w != renderer->current_context_target->w || h != renderer->current_context_target->h))
        renderer->impl->SetVirtualResolution(renderer, renderer->current_context_target, w, h);
    
    return renderer->current_context_target;
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:52,代码来源:main.c


示例19: FreeTarget

static void FreeTarget(GPU_Renderer* renderer, GPU_Target* target)
{
    GPU_Log(" %s (dummy)\n", __func__);

    if(target == NULL)
        return;
    
    if(target->refcount > 1)
    {
        target->refcount--;
        return;
    }
    
    if(target->context != NULL && target->context->failed)
    {
        if(target == renderer->current_context_target)
            renderer->current_context_target = NULL;
        
        // Remove all of the window mappings that refer to this target
        GPU_RemoveWindowMappingByTarget(target);
        
        free(target->context);
        free(target);
        return;
    }
    
    if(target == renderer->current_context_target)
    {
        renderer->impl->FlushBlitBuffer(renderer);
        renderer->current_context_target = NULL;
    }
    
    if(!target->is_alias && target->image != NULL)
        target->image->target = NULL;  // Remove reference to this object
    
    if(target->context != NULL)
    {
        // Remove all of the window mappings that refer to this target
        GPU_RemoveWindowMappingByTarget(target);
        
        free(target->context);
        target->context = NULL;
    }
    
    free(target);
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:46,代码来源:main.c


示例20: LoadTarget

static GPU_Target* LoadTarget(GPU_Renderer* renderer, GPU_Image* image)
{
	GPU_Target* result;
	
    GPU_Log(" %s (dummy)\n", __func__);
    
    if(image == NULL)
        return NULL;

    if(image->target != NULL)
    {
        image->target->refcount++;
        return image->target;
    }

    if(!(renderer->enabled_features & GPU_FEATURE_RENDER_TARGETS))
        return NULL;

    result = (GPU_Target*)malloc(sizeof(GPU_Target));
    memset(result, 0, sizeof(GPU_Target));
    result->refcount = 1;
    result->data = NULL;  // Allocate a data structure as needed for other render target data
    
    result->renderer = renderer;
    result->context = NULL;
    result->image = image;
    result->w = image->w;
    result->h = image->h;
    result->base_w = image->texture_w;
    result->base_h = image->texture_h;
    
    result->viewport = GPU_MakeRect(0, 0, result->w, result->h);
    
    result->camera = GPU_GetDefaultCamera();
    
    result->use_clip_rect = 0;
    result->clip_rect.x = 0;
    result->clip_rect.y = 0;
    result->clip_rect.w = result->w;
    result->clip_rect.h = result->h;
    result->use_color = 0;

    image->target = result;
    return result;
}
开发者ID:Helios-vmg,项目名称:sdl-gpu,代码行数:45,代码来源:main.c



注:本文中的GPU_Log函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GPU_stack_link函数代码示例发布时间:2022-05-30
下一篇:
C++ GPSTK_THROW函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap