小编Ren*_*ger的帖子

如何在OpenGL中创建一个带三角形的偶数球?

是否有公式生成一组三角坐标,其顶点位于球体上?

我可能正在寻找与之类似的东西gluSphere.然而,我需要用特定颜色为不同的三角形着色,这样我似乎无法使用gluSphere.

另外:我确实理解gluSphere沿着具有相同经度和格度的线绘制边缘,这使得三角形在极点处与其在赤道处的尺寸相比较小.现在,如果这样的公式将生成三角形,使得它们的大小差异最小化,那将是很好的.

opengl

13
推荐指数
2
解决办法
2万
查看次数

为什么OpenGL中有glMatrixMode?

我只是不明白OpenGL的glMatrixMode用途.

据我所看到的,当glMatrixMode(GL_MODELVIEW)被调用时,它后跟glVertex,glTranslate,glRotate之类的,那就是,OpenGL命令的地方某处空间中的一些对象.在另一方面,如果glOrtho还是glFrustum还是gluProjection 被称为(放置的对象即如何渲染),它有一个电话前述glMatrixMode(GL_PROJECTION).

我想我至今写的是一个假设上有人会证明我错了,但不用不同的矩阵模式如果正好,因为有各种不同的GL-功能:那些关注的配售对象和那些如何对象被渲染?

opengl

12
推荐指数
1
解决办法
2万
查看次数

在Perl中,$匹配到底是什么?

直到几分钟前,我认为,Perl中$任何一种行尾匹配.不幸的是,我的假设结果证明是错误的.

以下脚本仅删除单词end$string3.

use warnings;
use strict;

my $string1 = " match to the end" . chr(13);
my $string2 = " match to the end" . chr(13) . chr(10);
my $string3 = " match to the end" .           chr(10);

$string1 =~ s/ end$//;
$string2 =~ s/ end$//;
$string3 =~ s/ end$//;

print "$string1\n";
print "$string2\n";
print "$string3\n";
Run Code Online (Sandbox Code Playgroud)

但我几乎75%确定我看到过$至少匹配的情况chr(13).chr(10).

那么,$原子究竟是什么(以及在什么情况下)匹配?

regex perl

12
推荐指数
2
解决办法
433
查看次数

这是一个PL/SQL错误吗?

以下是一些PL/SQL代码的摘录,我相信这些代码演示了PL/SQL错误:

if guid_ is null then
   dbms_output.put_line('guid_ is null: ' || guid_);
end if;
Run Code Online (Sandbox Code Playgroud)

执行这些行时,将打印

guid_ is null: 07D242FCC55000FCE0530A30D4928A21
Run Code Online (Sandbox Code Playgroud)

我在Oracle 11R2上

select * from v$version;

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
Run Code Online (Sandbox Code Playgroud)

我可以使用以下类型和匿名块重现这一点.对不起,但我相信我不能再缩短它了:

create type tq84_t as table of varchar2(32);
/

create type tq84_o as object (
  dummy number(1),

  not final member procedure clear

) …
Run Code Online (Sandbox Code Playgroud)

oracle plsql oracle11gr2

12
推荐指数
1
解决办法
321
查看次数

为什么Perl的foreach不要求我的变量声明?

今天,我在Perl中偶然发现了一些我不知道的事情:它"本地化"了迭代列表元素所分配的变量.

当然,这在Perl文档中有记录 - 但是我没有记住或阅读它.

以下脚本演示了我的意思:

use warnings;
use strict;

my $g = 99;

foreach $g (1..5) {
  p($g);
}

sub p {
  my $l = shift;
  printf ("%2d %2d\n", $g, $l);
}
Run Code Online (Sandbox Code Playgroud)

脚本打印

99  1
99  2
99  3
99  4
99  5
Run Code Online (Sandbox Code Playgroud)

因为$g是"本地化"到foreach循环.

据我所知,如果我在foreach循环中添加my了没有区别$g:

foreach my $g (1..5) {
Run Code Online (Sandbox Code Playgroud)

实际上,我最终这样做是因为我觉得它变得更清楚,变量是循环的局部变量.

我现在的问题是:是否存在我的使用my确实有所作为的情况(鉴于$g已经全局声明).

variables perl foreach local-variables

12
推荐指数
1
解决办法
269
查看次数

如何创建一个空的日期向量?

是否可以在r中创建一个空的日期向量?

我可以创建一个整数,双精度,逻辑等的空向量:

> integer()
integer(0)
> double()
numeric(0)
> logical()
logical(0)
> length(integer())
[1] 0
Run Code Online (Sandbox Code Playgroud)

但是这个模因不适用于日期,因为date()返回当前的系统日期和时间.那么,我如何创建一个日期的emtpy向量?

r vector

11
推荐指数
3
解决办法
8851
查看次数

你好Android的世界但没有eclipse

我很确定我偶然发现了一个链接,它显示了如何在没有 eclipse的情况下创建一个hello world应用程序,但我再也找不到该链接了.它当然不一定是一个hello world应用程序,但如果有人可以指向某个地方解释创建没有eclipse的应用程序所需的步骤,那将会很好.

android

10
推荐指数
2
解决办法
4428
查看次数

如何在Perl中编写*filename*包含utf8字符的文件?

我正在努力创建一个包含非ascii字符的文件.

以下脚本工作正常,如果使用0as参数调用但在调用时死亡1.

错误消息已打开:C:\ temp\filename.pl第15行的参数无效.

该脚本在内部启动cmd.exe.

我希望它能写出一个名字相同的文件(取决于参数)äöü.txtäöü?.txt.但我无法创建包含笑脸的文件名.

use warnings;
use strict;

use Encode 'encode';

#   Text is stored in utf8 within *this* file.
use utf8;

my $with_smiley = $ARGV[0];

my $filename = 'äöü' . 
  ($with_smiley ? '?' : '' ).
   '.txt';

open (my $fh, '>', encode('cp1252', $filename)) or die "open: $!";

print $fh "Filename: $filename\n";

close $fh;
Run Code Online (Sandbox Code Playgroud)

我可能错过了一些对他人来说很明显的东西,但是我找不到,所以我很欣赏任何解决这个问题的指针.

windows perl filenames cmd utf-8

10
推荐指数
1
解决办法
4100
查看次数

流水线函数调用另一个流水线函数

这是一个包含两个流水线功能的包:

create or replace type tq84_line as table of varchar2(25);
/

create or replace package tq84_pipelined as

    function more_rows return tq84_line pipelined;
    function go        return tq84_line pipelined;

end tq84_pipelined;
/
Run Code Online (Sandbox Code Playgroud)

Ant对应的包体:

create or replace package body tq84_pipelined as

    function more_rows return tq84_line pipelined is
    begin

        pipe row('ist');
        pipe row('Eugen,');

        return;

    end more_rows;

    function go return tq84_line pipelined is
    begin

        pipe row('Mein');
        pipe row('Name');

        /* start */
        for next in (
          select column_value line from table(more_rows)
        ) 
        loop
          pipe row(next.line);
        end …
Run Code Online (Sandbox Code Playgroud)

oracle plsql

9
推荐指数
1
解决办法
2万
查看次数

有人用MinGW/MSYS成功编译了freetype吗?

我试图用MinGW/MSYS编译freetype是不成功的

这是我做的:

cmd.exe我切换到MSYS:

C:\temp\freetype-2.3.5-1\src\freetype\2.3.5\freetype-2.3.5>bash
Run Code Online (Sandbox Code Playgroud)

然后调用configure脚本

bash-3.1$ ./configure

FreeType build system -- automatic system detection

The following settings are used:

  platform                    unix
  compiler                    cc
  configuration directory     ./builds/unix
  configuration rules         ./builds/unix/unix.mk

If this does not correspond to your system or settings please remove the file
`config.mk' from this directory then read the INSTALL file for help.

Otherwise, simply type `make' again to build the library,
or `make refdoc' to build the API reference (the latter needs …
Run Code Online (Sandbox Code Playgroud)

cygwin mingw freetype gnu-make cygpath

9
推荐指数
1
解决办法
6162
查看次数