OpenGLES3-OpenGLES畫板

SoundEffect 為畫筆添加系統(tǒng)提示聲音

1.初始化系統(tǒng)聲音方法
    +(id)soundEffectWithContentsOfFile:(NSString *)aPath
    -(id)initWithContentsOfFile:(NSString *)path

2.播放系統(tǒng)聲音方法
    -(void)play

3.釋放聲音資源
    -(void)dealloc

DrawingBoardVC 實(shí)現(xiàn)UI,并切換畫筆顏色、清空屏幕事件

1.實(shí)現(xiàn)UI、添加事件按鈕
    - (void)setUpUI
3.清理屏幕 
    - (IBAction)earse:(id)sender 
  播放系統(tǒng)聲音并抹去視圖
    - (void)eraseView
  調(diào)用PaintView中的erase?方法

2.修改畫筆顏色,選擇控制器事件響應(yīng) 
    -(void)changBrushColor:(id)sender
   調(diào)用PaintView 中的- (void)setBrushColorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue

PaintView 實(shí)現(xiàn)繪制、修改畫筆顏色、 清空屏幕等事件

1.初始化PaintView
    initWithCoder:(NSCoder *)aDecoder

2.-(void)layoutSubviews
    沒(méi)有初始化initialized 繪制”加 油!”
        -(BOOL)initGL 
        手寫著?器程序
            pointv.vsh
            pointf.fsh
        加載紋理 - (textureInfo_t)textureFromName:(NSString *)name
        加載Shader - (void)setupShaders
        繪制已經(jīng)存儲(chǔ)頂點(diǎn)的”加油” -(void)paint
        在2點(diǎn)之間繪制線條 -(void)renderLineFromPoint:(CGPoint)start toPoint:(CGPoint)end
    已經(jīng)初始化
        - (BOOL)resizeFromLayer:(CAEAGLLayer *)layer
   
3.修改畫筆顏?
    - (void)setBrushColorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue

 4.清理屏幕
    -(void)erase

5.開(kāi)始繪制(任意圖形、線條)
    -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
    -(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event 
        將2點(diǎn)繪制成線條 
            -(void)renderLineFromPoint:(CGPoint)start toPoint:(CGPoint)end
    -(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event 
        將2點(diǎn)繪制成線條
            -(void)renderLineFromPoint:(CGPoint)start toPoint:(CGPoint)end
    -(void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event

Demo: 05-OpenGLES畫板

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容