博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
The Use Of Class Pointer
阅读量:6908 次
发布时间:2019-06-27

本文共 1352 字,大约阅读时间需要 4 分钟。

Problem:

  A error occurred when I defined "NormalMapping normal"( used for manaing relative shader ) in my OpenGLApp class. The compiler return error message "access violation at location 00000000 ".

 

Analysis:

  The error message seems to indicate that I had invoked some gl-function before invoking glewInit. So I tried to find where I had behaved like that. Then I found that I have define " OpenGLApp app " before invoking glewInit function. And it automatically constructed object "normal" who automatically initialized shader in its constructor which need to invoke glLinkProgram and so on.

 

Solution:

  1.I recalled that the use of class pointer in others' code. So I replace the definition "NormalMap normal" by NormalMap* normal and add a statement "normal = new NormalMap()" after invoking glewInit. Then the program work fine.

  2.Anothe solution would be OK. Such as putting the definition of app after invoking glewInit.

 

Conclusion:

  When defining a class pointer,the object is not defined before the statement "pointer = new Class()". So the constructor would not be called when just define a class pointer. But if define a objec, the constructor is called automatically meanwhile. So it is better to use class pointer to avoid invoking some function before relative library initialized.

转载于:https://www.cnblogs.com/swdever/p/3395583.html

你可能感兴趣的文章
让域控制器强制向DNS服务器注册SRV记录
查看>>
Dalvik虚拟机的运行过程分析
查看>>
docker集群存储软件etcd安装
查看>>
技术面试备忘录,饭可以乱吃,话不能乱说!
查看>>
Oracle ASM实例同filesystem间的文件传输
查看>>
两种快速打造App的方法
查看>>
数据仓库入门(实验9)查询多维数据集
查看>>
linux find命令详解
查看>>
通过SSH远程连接Cisco设备
查看>>
瑞星与华为共筑自主产权虚拟化安全屏障
查看>>
你有“高大上”,我有“小而美”,存储发展与智能手机是一样一样的啊
查看>>
[转]Memory Management Functions
查看>>
Getting Started with iOS Development
查看>>
程序员第一定律:关于技能与收入
查看>>
刘墉先生说过一句话
查看>>
SqlServer数据库几种字段类型对比
查看>>
怎样花两年时间去面试一个人
查看>>
Grails的目录结构
查看>>
使用SqlConnection显示连接信息
查看>>
TAM安装过程中遇到的问题
查看>>