论坛凯发推荐首页 web前端技术论坛

[完结15章]系统玩转opengl ai,实现各种酷炫视频特效 -欧洲杯足彩官网

浏览 252 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2023-12-20  
网盘地址:https://pan.baidu.com/s/1bpo4xx6xxmupirfp_nwqwa 提取码:5lmj
腾讯微云下载地址:https://share.weiyun.com/cvgckntd 密码:e58wuq

视频特效人才紧缺、需求量大、薪资高,学习正当时,所以今天给大家讲讲关于热门视频特效技术- opengl的相关知识,通过本文章,我将带着大家从0到1手把手实现特效美颜相机,让大家系统性掌握opengl 核心技术,从而轻松实现各种酷炫的视频特效、吃透视频特效原理,并积累大量图形学/数学知识,助力大家快速成为视频特效技术抢手人才!

那么,首先,我们先来了解一下,什么是opengl?
opengl(open graphics library)是一个跨平台、跨语言的图形编程接口(api)。它被广泛用于实现2d和3d图形渲染,并且是许多应用程序、游戏和网页浏览器的核心组件。

opengl主要功能是什么?
opengl是一个开放的三维图形软件包,它独立于窗口系统和操作系统,以它为基础开发的应用程序可以十分方便地在各种平台间移植;opengl使用简便,效率高。

opengl的glclearcolor在mesa中的实现是_mesa_clearcolor 函数。该函数用于指定颜色缓冲区的清除值,用于设置清除颜色。
void glapientry
_mesa_clearcolor( glclampf red, glclampf green, glclampf blue, glclampf alpha )
{
   get_current_context(ctx);

   ctx->popattribstate |= gl_color_buffer_bit;
   ctx->color.clearcolor.f[0] = red;
   ctx->color.clearcolor.f[1] = green;
   ctx->color.clearcolor.f[2] = blue;
   ctx->color.clearcolor.f[3] = alpha;
}
在pom.xml文件中添加swagger依赖库,这里我们使用的是swagger2版本,在ui方面,比swagger1版本要好看很多。
package com.example.emos.wx.config;

import io.swagger.annotations.apioperation;
import org.springframework.context.annotation.bean;
import org.springframework.context.annotation.configuration;
import org.springframework.web.servlet.config.annotation.webmvcconfigurer;
import springfox.documentation.builders.apiinfobuilder;
import springfox.documentation.builders.pathselectors;
import springfox.documentation.builders.requesthandlerselectors;
import springfox.documentation.service.apiinfo;
import springfox.documentation.service.apikey;
import springfox.documentation.service.authorizationscope;
import springfox.documentation.service.securityreference;
import springfox.documentation.spi.documentationtype;
import springfox.documentation.spi.service.contexts.securitycontext;
import springfox.documentation.spring.web.plugins.apiselectorbuilder;
import springfox.documentation.spring.web.plugins.docket;
import springfox.documentation.swagger2.annotations.enableswagger2;

import java.util.arraylist;
import java.util.list;

@configuration
@enableswagger2
public class swaggerconfig {

    @bean
    public docket createrestapi() {
        docket docket = new docket(documentationtype.swagger_2);

        // apiinfobuilder 用于在swagger界面上添加各种信息
        apiinfobuilder builder = new apiinfobuilder();
        builder.title("emos在线办公系统");
        apiinfo apiinfo = builder.build();
        docket.apiinfo(apiinfo);

        // apiselectorbuilder 用来设置哪些类中的方法会生成到rest api中
        apiselectorbuilder selectorbuilder = docket.select();
        selectorbuilder.paths(pathselectors.any()); //所有包下的类
        //使用@apioperation的方法会被提取到rest api中
        selectorbuilder.apis(requesthandlerselectors.withmethodannotation(apioperation.class));
        docket = selectorbuilder.build();
        /*
         * 下面的语句是开启对jwt的支持,当用户用swagger调用受jwt认证保护的方法,
         * 必须要先提交参数(例如令牌)
         */
        //存储用户必须提交的参数
        list apikey = new arraylist();
        //规定用户需要输入什么参数
        apikey.add(new apikey("token", "token", "header"));
        docket.securityschemes(apikey);

        //如果用户jwt认证通过,则在swagger中全局有效
        authorizationscope scope = new authorizationscope("global", "accesseverything");
        authorizationscope[] scopearray = {scope};
        //存储令牌和作用域
        securityreference reference = new securityreference("token", scopearray);
        list reflist = new arraylist();
        reflist.add(reference);
        securitycontext context = securitycontext.builder().securityreferences(reflist).build();
        list cxtlist = new arraylist();
        cxtlist.add(context);
        docket.securitycontexts(cxtlist);

        return docket;
    }
}
向后端提交数据之前,我们先要做好前端的数据验证,比如说验证激活码必须是6位数字。
let data = {
code: code,
nickname: nickname,
photo: avatarurl,
registercode: that.registercode
};
that.ajax(that.url.register, 'post', data, function(resp) {
let permission = resp.data.permission;
uni.setstoragesync('permission', permission);
//跳转到index页面
});
在checkincontroller类中创建createfacemodel()方法
public class checkincontroller {
@postmapping("/createfacemodel")
    @apioperation("创建人脸模型")
    public r createfacemodel(@requestparam("photo") multipartfile file, @requestheader("token") string token) {
        int userid = jwtutil.getuserid(token);
        if (file==null) {
            return r.error("没有上传文件");
        }
        string filename = file.getoriginalfilename().tolowercase();
        string path = imagefolder "/" filename;
        if (!filename.endswith(".jpg")) {
            return r.error("必须提交jpg格式图片");
        } else {
            try {
                file.transferto(paths.get(path));
                checkinservice.createfacemodel(userid, path);
                return r.ok("人脸建模成功");
            } catch (ioexception e) {
                log.error(e.getmessage());
                throw new emosexception("保存图片错误");
            } finally {
                fileutil.del(path);
            }
        }
    }
}
编写checkincontroller.java中的web方法,查询用户签到的结果。
public class checkincontroller {
……
@autowired
    private userservice userservice;

@autowired
    private systemconstants constants;

@getmapping("/searchtodaycheckin")
    @apioperation("查询用户当日签到数据")
    public r searchtodaycheckin(@requestheader("token") string token) {
        int userid = jwtutil.getuserid(token);

        hashmap map = checkinservice.searchtodaycheckin(userid);
        map.put("attendancetime", constants.attendancetime);
        map.put("closingtime", constants.closingtime);
        long days = checkinservice.searchcheckindays(userid);
        map.put("checkindays", days);

//判断日期是否在用户入职之前
        datetime hiredate = dateutil.parse(userservice.searchuserhiredate(userid));
        datetime startdate = dateutil.beginofweek(dateutil.date());
        if (startdate.isbefore(hiredate)) {
            startdate = hiredate;
        }
        datetime enddate = dateutil.endofweek(dateutil.date());
        hashmap param = new hashmap();
        param.put("startdate", startdate.tostring());
        param.put("enddate", enddate.tostring());
        param.put("userid", userid);
        arraylist list = checkinservice.searchweekcheckin(param);
        map.put("weekcheckin", list);
        return r.ok().put("result", map);
    }
}
编写tbuserdao.xml文件中的查询语句





如果你只有一小时的时间学习 opengl,并且希望使用 python,那么你的学习目标应该是理解基本的 opengl 概念,同时能够编写一个简单的程序来创建并渲染基本的2d形状


update tb_meeting
    set instance_id=#{instanceid}
    where uuid=#{uuid}

编写meetingserviceimpl中的私有业务方法
public class meetingserviceimpl implements meetingservice {
@autowired
    private tbuserdao userdao;

@value("${emos.code}")
private string code;

@value("${workflow.url}")
    private string workflow;

@value("${emos.recievenotify}")
private string recievenotify;
……
private void startmeetingworkflow(string uuid, int creatorid, string date, string start) {
        hashmap info = userdao.searchuserinfo(creatorid); //查询创建者用户信息

        jsonobject json = new jsonobject();
        json.set("url", recievenotify);
        json.set("uuid", uuid);
        json.set("openid", info.get("openid"));
json.set("code",code);
        json.set("date",date);
        json.set("start",start);
        string[] roles = info.get("roles").tostring().split(",");
        //如果不是总经理创建的会议
        if (!arrayutil.contains(roles, "总经理")) {
            //查询总经理id和同部门的经理的id
            integer managerid = userdao.searchdeptmanagerid(creatorid);
            json.set("managerid", managerid); //部门经理id
            integer gmid = userdao.searchgmid();//总经理id
            json.set("gmid", gmid);
            //查询会议员工是不是同一个部门
            boolean bool = meetingdao.searchmeetingmembersinsamedept(uuid);
            json.set("samedept", bool);
        }
        string url = workflow "/workflow/startmeetingprocess";
        //请求工作流接口,开启工作流
        httpresponse response = httprequest.post(url).header("content-type", "application/json").body(json.tostring()).execute();
        if (response.getstatus() == 200) {
            json = jsonutil.parseobj(response.body());
            //如果工作流创建成功,就更新会议状态
            string instanceid = json.getstr("instanceid");
            hashmap param = new hashmap();
            param.put("uuid", uuid);
            param.put("instanceid", instanceid);
            int row = meetingdao.updatemeetinginstanceid(param); //在会议记录中保存工作流实例的id
            if (row != 1) {
                throw new emosexception("保存会议工作流实例id失败");
            }
        }
    }
}
综上所述,st_glfinish 函数在 gallium3d 驱动层面上完成了等待命令完成和刷新前端缓冲区的操作。这是为了确保在继续执行代码之前,所有之前提交的opengl命令都已经执行完成,并将最终的渲染结果显示到屏幕上。
 
global site tag (gtag.js) - google analytics
网站地图