首页 \ 问答 \ 需要OpenGL ES 2.0仿真器(Need OpenGL ES 2.0 Emulator)

需要OpenGL ES 2.0仿真器(Need OpenGL ES 2.0 Emulator)

我正在进入Android开发,我正在寻找一个比AVD更好的OpenGL ES模拟器(还没有完整的opengl es 2.0支持)

建议欢迎!

必须是免费的。

优选易于使用

谢谢!


I'm getting into Android development and am looking for a good OpenGL ES emulator other than the AVD (doesn't have full opengl es 2.0 support yet)

Suggestions welcome!

Must be free.

Preferably easy to use

thanks!


原文:https://stackoverflow.com/questions/4295950
更新时间:2022-03-27 09:03

最满意答案

关于指针类型的常量应该“从右到左”读取(并且"const T * buffer" ”实际上意味着“指向const内容的指针”,而不是“指向内容的const指针”,也不是“指向const内容的const指针”)。

因此,您将使用可变指针到const char缓冲区并将其用于const版本的结构(要求您的const结构具有可变字段 - 这是显示警告的原因)。 如果您打算摆脱警告,您必须移动“const”这样的事情:

void show_string(char * const buffer, const int length) { // <== move const to the right of "*"
    const string_t str = // <== tricky assignment here
        (const string_t) {
        buffer, length
    };
    show_string_internal(str);
}

如果您计划同时拥有const缓冲区,则必须重新定义string_t结构(或作为单独的类型引入):

typedef struct {
    const uchar_t * buffer; // <== add "const" here
    uint_t length; // excluding null-terminating character
} string_t;
...
void show_string(const char * const buffer, const int length) { // two "const" clauses there
    const string_t str = // <== tricky assignment here
        (const string_t) {
        buffer, length
    };
    show_string_internal(str);
}

希望这可以帮助。


Constness about pointer types should be read "from right to left" (and "const T * buffer" means "pointer to const content" actually, not "const pointer to content" nor "const pointer to const content).

So, you was about to use mutable pointer to const char buffer and use it for const version of structure (asking your const struct having mutable field - this is a reason for the warning shown). In case you plan to get rid of the warning you have to move "const" thing like that:

void show_string(char * const buffer, const int length) { // <== move const to the right of "*"
    const string_t str = // <== tricky assignment here
        (const string_t) {
        buffer, length
    };
    show_string_internal(str);
}

In case you plan to have const buffer itself as well, you have to redefine your string_t structure (or introduce as separate type):

typedef struct {
    const uchar_t * buffer; // <== add "const" here
    uint_t length; // excluding null-terminating character
} string_t;
...
void show_string(const char * const buffer, const int length) { // two "const" clauses there
    const string_t str = // <== tricky assignment here
        (const string_t) {
        buffer, length
    };
    show_string_internal(str);
}

Hope this helps.

相关问答

更多
  • 像这样: ImmutablePoint *make_immutable_point(int x, int y) { ImmutablePoint init = { .x = x, .y = y }; ImmutablePoint *p = malloc(sizeof *p); if (p == NULL) abort(); memcpy(p, &init, sizeof *p); return p; } (请注意,与C ++不同,不需要在C中转换malloc的返回值,并且它通常被认 ...
  • 关于指针类型的常量应该“从右到左”读取(并且"const T * buffer" ”实际上意味着“指向const内容的指针”,而不是“指向内容的const指针”,也不是“指向const内容的const指针”)。 因此,您将使用可变指针到const char缓冲区并将其用于const版本的结构(要求您的const结构具有可变字段 - 这是显示警告的原因)。 如果您打算摆脱警告,您必须移动“const”这样的事情: void show_string(char * const buffer, const int ...
  • { .pages = 50}构造是一个指定的初始化程序 ,一个不受MS C编译器支持的C99特性(我告诉它是一个C89编译器)。 这也限制了您仅通过其第一个成员初始化联合的能力。 我可以看到这些限制的方法:使用{ 50 }来初始化pages 。 然后忘记const并显式初始化.blength.seconds 。 const声明对象的效果是高估的:-) The { .pages = 50} construct is a designated initializer, a C99 feature unsuppo ...
  • 在第一种情况下,您将创建一个int的副本。 const int的副本不必是const,因此它可以工作。 在第二种情况下,您正在创建指向const int的指针的副本,并将其指定给指向int的指针 - 这是不允许的,这就是它不能编译的原因。 In the first case you are creating a copy of an int. Copy of const int does not have to be const so it works. In the second case you are ...
  • 它们将按照给定翻译单元中的定义顺序和任何其他对象或变量之前进行初始化。 They will be initialized in the order of definition in given translation unit and before any other objects or variables.
  • 常量声明不能包含函数调用(有一些例外,见下文),它们必须在编译时计算,同时在运行时执行函数调用。 引用规范:常量: 常量值由符文 , 整数 , 浮点 , 虚数或字符串文字表示,表示常量的标识符, 常量表达式 ,结果为常量的转换或某些内置的结果值函数如unsafe.Sizeof应用于任何值, cap或len应用于某些表达式 , real和imag应用于complex常量和复数应用于数字常量。 引用Spec:Constant表达式: 常量表达式可能只包含常量操作数,并在编译时进行求值 。 请注意,有一unsaf ...
  • @MM的评论帮助我走上了正确的方向。 他问这个符号是否已导出。 从技术上讲,是的,它是导出的,因为它在导出列表中,但显然我还需要导出定义 。 因此,我不需要在.def文件中包含全局符号,而是需要在两个地方用__declspec(dllexport)或__declspec(dllimport)手动标记它,所以最后它看起来像这样: #ifdef _MSC_VER #ifdef CBFOREST_EXPORTS #define CBFOREST_API __declspec(dllexport) #else #d ...
  • 如果你不想混淆你的全局命名空间并希望得到类似C风格初始化的东西,你总是可以使用lambda表达式构造和对象。 const timespec ARMAGEDDON = []() -> timespec { timespec result; result.tv_sec = std::numeric_limits::max(); result.tv_nsec = std::numeric_limits
  • 为什么不删除最后一个const ? struct S{ const float * const * data;}; 这样你可以随意初始化data但它仍然无法用于修改它所指向的任何内容。 data本身可以被修改,但是如果要防止它,它应该只是private 。 Why not just remove the last const? struct S{ const float * const * data;}; That way you can initialize data however you like ...
  • 但有没有办法在不放入第二组指针( _a , _b , _c )的情况下执行此操作? 当然。 您可以使用: foo(int a, int b, int c) : a(new int(a)), b(new int(b)), c(new int(c)) {} 请记住The Rule of Three ,并为foo适当地实现复制构造函数,复制赋值运算符和析构函数。 but is there a way to do this without putting in the second set of ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)