本文整理汇总了Golang中github.com/go-gl/gl.Ortho函数的典型用法代码示例。如果您正苦于以下问题:Golang Ortho函数的具体用法?Golang Ortho怎么用?Golang Ortho使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Ortho函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Enter
func (wc WindowCoords) Enter() {
w, h := GetViewportWH()
Matrix{gl.PROJECTION}.Enter()
if !wc.NoReset {
gl.LoadIdentity()
}
if wc.Invert {
gl.Ortho(0, float64(w), float64(h), 0, -1, 1)
} else {
gl.Ortho(0, float64(w), 0, float64(h), -1, 1)
}
Matrix{gl.MODELVIEW}.Enter()
gl.LoadIdentity()
}
开发者ID:pwaller,项目名称:glh,代码行数:14,代码来源:context.go
示例2: Reshape
func (v *Video) Reshape(width int, height int) {
x_offset := 0
y_offset := 0
r := ((float64)(height)) / ((float64)(width))
if r > 0.9375 { // Height taller than ratio
h := (int)(math.Floor((float64)(0.9375 * (float64)(width))))
y_offset = (height - h) / 2
height = h
} else if r < 0.9375 { // Width wider
var scrW, scrH float64
if ppu.OverscanEnabled {
scrW = 240.0
scrH = 224.0
} else {
scrW = 256.0
scrH = 240.0
}
w := (int)(math.Floor((float64)((scrH / scrW) * (float64)(height))))
x_offset = (width - w) / 2
width = w
}
gl.Viewport(x_offset, y_offset, width, height)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(-1, 1, -1, 1, -1, 1)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.Disable(gl.DEPTH_TEST)
}
开发者ID:richardjoo,项目名称:Fergulator,代码行数:33,代码来源:video.go
示例3: Reshape
func Reshape(w, h int) {
gl.Viewport(0, 0, w, h)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, 100, 0, 100, -1, 1)
gl.MatrixMode(gl.MODELVIEW)
}
开发者ID:rick-monster,项目名称:gopong,代码行数:7,代码来源:view.go
示例4: initWindow
func initWindow() {
// Function called to do the re-rendering
glut.DisplayFunc(display)
// Called when the visibility of the program changes
glut.VisibilityFunc(visible)
// Called when a regular ascii character is pressed
glut.KeyboardFunc(keyboardIn)
// Called when any non-ascii character is pressed
glut.SpecialFunc(specialIn)
// Called when the size of the window changes
glut.ReshapeFunc(reshape)
// affect our projection matrix
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity() // Load an identity matrix -> projection
// Specify the bounds of the of our scene
gl.Ortho(0, 40, 0, 40, 0, 40)
// Now affect our modelview matrix
gl.MatrixMode(gl.MODELVIEW)
// Make points be rendererd larger
gl.PointSize(3.0)
currentWindow = glut.GetWindow()
}
开发者ID:KUGDC,项目名称:GoServe,代码行数:26,代码来源:simple.go
示例5: InitDisplay
func InitDisplay() {
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, 100, 0, 100, -1, 1)
gl.MatrixMode(gl.MODELVIEW)
gl.PointSize(3.0)
}
开发者ID:rick-monster,项目名称:gopong,代码行数:7,代码来源:view.go
示例6: reshape
func reshape(w, h int) {
gl.Viewport(0, 0, w, h)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, float64(w), 0, float64(h), -1, 1)
gl.Scalef(1, -1, 1)
gl.Translatef(0, float32(-h), 0)
gl.MatrixMode(gl.MODELVIEW)
}
开发者ID:himanshushekhar,项目名称:glut,代码行数:9,代码来源:fontdemo.go
示例7: initGL
func initGL() {
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Viewport(0, 0, 800, 600)
gl.Ortho(0, 800, 600, 0, -1.0, 1.0)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.ClearColor(0.1, 0.05, 0.0, 1.0)
}
开发者ID:sixthgear,项目名称:deformable,代码行数:9,代码来源:main.go
示例8: main
func main() {
_ = fmt.Sprint()
if !glfw.Init() {
panic("Can't init glfw!")
}
defer glfw.Terminate()
// antialiasing
//glfw.WindowHint(glfw.Samples, 4)
window, err = glfw.CreateWindow(WindowWidth, WindowHeight, "Mozaik", nil, nil)
if err != nil {
panic(err)
}
defer window.Destroy()
// Ensure thread context
window.MakeContextCurrent()
//glfw.SwapInterval(1)
window.SetKeyCallback(keyCb)
window.SetMouseButtonCallback(mouseCb)
gl.Init()
gl.ClearColor(0.9, 0.85, 0.46, 0.0)
// useless in 2D
gl.Disable(gl.DEPTH_TEST)
// antialiasing
gl.Enable(gl.BLEND)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.Enable(gl.LINE_SMOOTH)
for i := int32(32); i < 72; i++ {
font := loadFonts(i)
defer font.Release()
fonts = append(fonts, font)
}
// Compute window radius
windowRadius = math.Sqrt(math.Pow(WindowHeight, 2) + math.Pow(WindowWidth, 2))
// Use window coordinates
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, WindowWidth, WindowHeight, 0, 0, 1)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
g = NewGame()
g.Start()
go eventLoop(g)
go renderLoop(g)
Main()
g.Stop()
}
开发者ID:remogatto,项目名称:mozaik,代码行数:57,代码来源:main_init.go
示例9: onResize
// TODO Dynamically fetch size and render accordingly.
func onResize(w, h int) {
gl.Viewport(0, 0, w, h)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, float64(w), float64(h), 0, -1, 1)
gl.ClearColor(0.255, 0.255, 0.255, 0)
gl.Clear(gl.COLOR_BUFFER_BIT)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
// log.Printf("resized: %dx%d\n", w, h)
}
开发者ID:nightlifelover,项目名称:GoMandelbrot,代码行数:12,代码来源:inputoutput.go
示例10: onResize
// onResize sets up a simple 2d ortho context based on the window size
func onResize(window *glfw.Window, w, h int) {
w, h = window.GetSize() // query window to get screen pixels
width, height := window.GetFramebufferSize()
gl.Viewport(0, 0, width, height)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, float64(w), 0, float64(h), -1, 1)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.ClearColor(1, 1, 1, 1)
}
开发者ID:niksaak,项目名称:chipmunk,代码行数:12,代码来源:bouncing_balls.go
示例11: reshape
func reshape(w, h int) {
// Write to both buffers, prevent flickering
gl.DrawBuffer(gl.FRONT_AND_BACK)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Viewport(0, 0, w, h)
gl.Ortho(0, float64(w), float64(h), 0, -1.0, 1.0)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
}
开发者ID:Tohie,项目名称:GoFlappyBird,代码行数:11,代码来源:flappybird.go
示例12: setupGL
func setupGL(w, h int) {
gl.Viewport(0, 0, w, h)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, float64(w), float64(h), 0, 0, 1)
gl.ShadeModel(gl.SMOOTH)
gl.ClearColor(1, 1, 1, 0)
gl.Enable(gl.BLEND)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.Disable(gl.DEPTH_TEST)
gl.Hint(gl.LINE_SMOOTH_HINT|gl.LINE_SMOOTH_HINT, gl.NICEST)
}
开发者ID:phaikawl,项目名称:gosui,代码行数:13,代码来源:window.go
示例13: onResize
func onResize(w, h int) {
// Write to both buffers, prevent flickering
gl.DrawBuffer(gl.FRONT_AND_BACK)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Viewport(0, 0, w, h)
gl.Ortho(0, float64(w), float64(h), 0, -1.0, 1.0)
gl.ClearColor(1, 1, 1, 0)
gl.Clear(gl.COLOR_BUFFER_BIT)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
}
开发者ID:jayschwa,项目名称:examples,代码行数:13,代码来源:main.go
示例14: Reshape
func Reshape(width, height int) {
gl.Viewport(0, 0, width, height)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(-1, 1, -1, 1, -1, 1)
//gl.Ortho(-2.1, 6.1, -2.25*2, 2.1*2, -1, 1) // Y debug
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.ClearColor(0, 0, 0, 1)
gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
}
开发者ID:pwaller,项目名称:go-gl-testutils,代码行数:14,代码来源:gltest.go
示例15: reshapeWindow
func reshapeWindow(window *glfw.Window, width, height int) {
ratio := float64(width) / float64(height)
gameWidth = ratio * fieldSize
gameHeight = fieldSize
gl.Viewport(0, 0, width, height)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, gameWidth, 0, gameHeight, -1.0, 1.0)
gl.MatrixMode(gl.MODELVIEW)
if wireframe {
gl.PolygonMode(gl.FRONT_AND_BACK, gl.LINE)
}
}
开发者ID:JamesClonk,项目名称:asteroids,代码行数:14,代码来源:main.go
示例16: reshape
func reshape(w, h int) {
/* Because Gil specified "screen coordinates" (presumably with an
upper-left origin), this short bit of code sets up the coordinate
system to correspond to actual window coodrinates. This code
wouldn't be required if you chose a (more typical in 3D) abstract
coordinate system. */
gl.Viewport(0, 0, w, h) /* Establish viewing area to cover entire window. */
gl.MatrixMode(gl.PROJECTION) /* Start modifying the projection matrix. */
gl.LoadIdentity() /* Reset project matrix. */
gl.Ortho(0, float64(w), 0, float64(h), -1, 1) /* Map abstract coords directly to window coords. */
gl.Scalef(1, -1, 1) /* Invert Y axis so increasing Y goes down. */
gl.Translatef(0, float32(-h), 0) /* Shift origin up to upper-left corner. */
}
开发者ID:himanshushekhar,项目名称:glut,代码行数:14,代码来源:simple.go
示例17: initGL
func initGL() {
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, 1024, 768, 0, -1, 1)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.Enable(gl.DEPTH_TEST)
// hexTex = initTexture("hex5k", HEX_WIDTH, HEX_HEIGHT)
hexTex = initTexture2("hex")
wallpaper = initTexture("[email protected]", 1024, 768)
// starTex = initTexture("hexstark", HEX_WIDTH, HEX_HEIGHT)
starTex = initTexture2("star")
borderTex = initTexture("hexborder", 76, 76)
}
开发者ID:TheOnly92,项目名称:gexic,代码行数:15,代码来源:main.go
示例18: onResize
// onResize handles window resize events.
func onResize(w, h int) {
if w < 1 {
w = 1
}
if h < 1 {
h = 1
}
gl.Viewport(0, 0, w, h)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, float64(w), float64(h), 0, 0, 1)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
}
开发者ID:jayschwa,项目名称:examples,代码行数:17,代码来源:main.go
示例19: fixProjection
// Called to adjust the projection matrix
func fixProjection(win *glfw.Window, w, h int) {
if w < 1 {
w = 1
}
if h < 1 {
h = 1
}
gl.Viewport(0, 0, w, h)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
// it's a 2d game, so use orthographic projection
gl.Ortho(0, float64(w), float64(h), 0, 0, 1)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
}
开发者ID:andrebq,项目名称:exp,代码行数:18,代码来源:main.go
示例20: Draw
// Draws the contents of the framebuffer at the requested width and height.
func (fb *Framebuffer) Draw(w int, h int) {
gl.Viewport(0, 0, w, h)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, 1, 0, 1, 1, -1)
gl.Enable(gl.TEXTURE_2D)
fb.Texture.Bind(gl.TEXTURE_2D)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.Begin(gl.QUADS)
gl.TexCoord2d(0, 0)
gl.Vertex3f(0.0, 0.0, 0)
gl.TexCoord2d(1, 0)
gl.Vertex3f(1.0, 0.0, 0)
gl.TexCoord2d(1, 1)
gl.Vertex3f(1.0, 1.0, 0)
gl.TexCoord2d(0, 1)
gl.Vertex3f(0.0, 1.0, 0)
gl.End()
gl.Flush()
}
开发者ID:pikkpoiss,项目名称:ld27,代码行数:22,代码来源:framebuffer.go
注:本文中的github.com/go-gl/gl.Ortho函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论