我正在尝试在python中创建一个过剩的窗口,并具有以下代码:
glutInit()
glutInitWindowSize(windowWidth, windowHeight)
glutInitWindowPosition(int(centreX - windowWidth/2), int(centreY - windowHeight/2))
glutCreateWindow("MyWindow")
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH)
glutDisplayFunc(displayFun)
glutIdleFunc(animateFun)
glutKeyboardFunc(keyboardFun)
glutPassiveMotionFunc(mouseFun)
glutReshapeFunc(reshapeFun)
initFun()
#loadTextures()
glutMainLoop()
Run Code Online (Sandbox Code Playgroud)
我在'glutCreateWindow'一行中收到错误说:
Traceback (most recent call last):
File "F:\MyProject\main.py", line 301, in <module>
glutCreateWindow("MyWindow")
File "C:\Python34\lib\site-packages\OpenGL\GLUT\special.py", line 73, in glutCreateWindow
return __glutCreateWindowWithExit(title, _exitfunc)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
Run Code Online (Sandbox Code Playgroud)
有关此函数的文档指定
int glutCreateWindow(char *name);
Run Code Online (Sandbox Code Playgroud) 简而言之,有什么方法可以检测JavaScript中的其他鼠标按钮按下情况吗?其余的鼠标输入未对此进行记录,因此我想它不在标准实现中。
是否有其他方法(例如库)可以启用额外的鼠标按钮?
我遇到了一个错误,即go不能正确解决供应商的程序包;在macOS High Sierra 10.13.6上。我将使用github.com/gorilla/mux作为示例包
$ echo $GOPATH
/Users/gregorysims/go
$ go version
go version go1.11 darwin/amd64
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/gregorysims/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/gregorysims/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/tb/6c5vksm558q5q4t0fxfscgy80000gp/T/go-build409352678=/tmp/go-build -gno-record-gcc-switches -fno-common"
Run Code Online (Sandbox Code Playgroud)
我正在导入软件包
import (
...
"github.com/gorilla/mux"
...
)
Run Code Online (Sandbox Code Playgroud)
运行时:
go build -o out main.go
Run Code Online (Sandbox Code Playgroud)
对于供应商中的每个包装,我都会收到以下错误
main.go:6:2: cannot find package "_/Users/gregorysims/go/src/site/user/project/vendor/github.com/gorilla/mux" in any of:
/usr/local/go/src/_/Users/gregorysims/go/src/site/user/project/vendor/github.com/gorilla/mux (from …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用tiny_obj_loader将其加载.obj到我的程序中。我有以下使用该库的代码:
void LoadModel(vector<Shape *> &scene, const char *path) {
attrib_t attrib;
vector<shape_t> shapes;
vector<material_t> materials;
std::string error;
bool ret = tinyobj::LoadObj(
&attrib,
&shapes,
&materials,
&error,
path
);
... // Do stuff with the returned data
Run Code Online (Sandbox Code Playgroud)
然而,这给了我以下链接器错误:
Build/skeleton.o: In function `LoadModel(std::vector<Shape*,
std::allocator<Shape*> >&, char const*)':
skeleton.cpp:(.text+0x3025): undefined reference to `tinyobj::LoadObj(tinyobj::attrib_t*, std::vector<tinyobj::shape_t, std::allocator<tinyobj::shape_t> >*, std::vector<tinyobj::material_t, std::allocator<tinyobj::material_t> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, char const*, char const*, bool)'
Makefile:43: recipe for target 'Build' failed
make: *** [Build] Error 1
Run Code Online (Sandbox Code Playgroud)
其中函数定义是: …
我正在尝试使用lwjgl在屏幕上渲染纹理矩形.我已经注册了纹理并加载了它们.我正在尝试编写一个方法,只使用纹理的指定区域来应用于矩形,这将允许使用spritesheets.我有这个代码来做到这一点:
public static void drawTexturedRectangle(int x, int y, int width,
int height, int textureX, int textureY, int textureWidth,
int textureHeight, Texture texture) {
System.out.println("Drawing tr:"); //console output to check input
System.out.println(" -input:");
System.out.println(" -x: " + x);
System.out.println(" -y: " + y);
System.out.println(" -width: " + width);
System.out.println(" -height: " + height);
System.out.println(" -tex-x: " + textureX);
System.out.println(" -tex-y: " + textureY);
System.out.println(" -tex-width: " + textureWidth);
System.out.println(" -tex-height: " + textureHeight);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getId());
GL11.glBegin(GL11.GL_QUADS);
{
System.out.println(" -rendered:");
int vx …Run Code Online (Sandbox Code Playgroud)