首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NSString没有绘图吗?

NSString没有绘图吗?
EN

Stack Overflow用户
提问于 2012-08-18 00:16:24
回答 1查看 211关注 0票数 0

我正在尝试绘制一个NSString,但是由于某种原因它不能被渲染。

代码语言:javascript
复制
- (void)renderScene {
    // Make sure we are renderin to the frame buffer
    [EAGLContext setCurrentContext:context];

    glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);

    // Clear the color buffer with the glClearColor which has been set      
    glClear(GL_COLOR_BUFFER_BIT);

    //Render the game Scene 
    if(gameState == 0){

        //MENU
        [menu renderAtPoint: CGPointMake(0, 0) centerOfImage: NO];

    } else if(gameState == 1){

        //GAMEPLAY

        [bk renderAtPoint: CGPointMake(0, 0) centerOfImage: NO];

        [self drawScore];

        [player draw];

        [squares render];

        [scoreString drawAtPoint: CGPointMake(262, 250) withFont:[UIFont fontWithName:@"TimesNewRoman" size: 1.0f]]; //RIGHT HERE IS THE DRAW STRING

    } else if(gameState ==2){

        //DEATH SCREEN

        [squared renderAtPoint: CGPointMake(0, 0) centerOfImage: NO];

    }
EN

回答 1

Stack Overflow用户

发布于 2012-08-20 16:38:29

您正在尝试混合核心图形和OpenGL。解决这个问题的一种简单方法是创建子窗口(UIView或UILabel),然后在子窗口中设置文本字符串。您还可以设置子视图的透明度。

还有其他方法(如绘制到位图,然后将其用作OpenGL纹理,或使用OpenGL将字体绘制为位图或轮廓),但它们的工作量更大-取决于您的需要。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12009387

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档