orthographic

OpenGL switching between ortho and perspecive problems

三世轮回 提交于 2019-12-11 06:09:59
问题 I've integrated a model into OpenGL and implemented some keyboard functions for example to switch between orthografic and perspective view. Also you can zoom in and out and change the camera view. Now what i've recognize is after switching to orthografic and then back to perspective the model gets a lot of issues. First one: If i now change the horizontal camera view in the perspective view the model gets lost after a time (after pressing the camera view key often). And the second issue is

flash 10 orthographic projection

我只是一个虾纸丫 提交于 2019-12-11 01:57:21
问题 I've been playing a bit with the new flash 10 3d possibilities, and found out that rotating a sprite in 3d is fairly easy: var card:Sprite = new MyCard() card.x = 100 card.y = 100 card.z = 200 card.rotationX = -60 addChild(card) Simple and effective, this shows the card rotated with perspective. Now I want to use an orthographic projection, and I have no clue where to start. DisplayObject does have a perspectiveProjection member, but that can only make perspective projections of course. Maybe

Draw texture according to viewport and camera

陌路散爱 提交于 2019-12-08 10:12:01
问题 I don't manage to draw my textures so that they are resized according to the screen resolution. I am using ScreenViewport (as I want my font to be smooth and without distorsion). float w = Gdx.graphics.getWidth(); float h = Gdx.graphics.getHeight(); gameCam = new OrthographicCamera(2f * h/w, 2f); gamePort = new ScreenViewport(gameCam); Weirdly, whatever the height and width of the camera the result is the same. In the resize method, I tried a lot of things : @Override public void resize(int

Sprite not moving properly. libgdx

╄→尐↘猪︶ㄣ 提交于 2019-12-08 09:45:20
问题 I'm new to libgdx, I'm trying to make a sprite move while the camera follows. I can make the sprite move perfectly until I attach the camera to it. When I click, the sprite will move wherever it feels like (it seems) and the camera will follow properly. I've tried a few different things but at this point its just guessing and checking. public class MyGdxGame implements ApplicationListener { OrthographicCamera mCamera; SpriteBatch mBatch; Texture mTexture, mMap; Sprite sprite; float touchX,

Why doesn't alpha blending work in ortho?

时光总嘲笑我的痴心妄想 提交于 2019-12-08 05:23:00
问题 This is how I turn on ortho projection after drawing 3D objects: glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0,Screen_Width,Screen_Height,0,0,1); And this is how I turn on blending and draw textures in ortho after drawing 3D objects: glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glColor4f(1,1,1,1); glBindTexture(GL_TEXTURE_2D,Texture1); glBegin(GL_QUADS); //draw 1st quad glEnd(); glBindTexture(GL_TEXTURE_2D,Texture2); glBegin(GL

unity3d (2d!) - Camera to centre on player, but never exceed “map” bounds

馋奶兔 提交于 2019-12-06 04:54:36
问题 I am creating a game which has up to 4 orthographic cameras (for up to 4 players), which take up various amounts of the screen, depending on the amount of players. I have a script which controls all the cameras, setting their position relative to the players they are watching. What I want to achieve is a simple overhead-runner style of movement, whereby the camera will follow the player, but not go outside the bounds of the map. I have managed to get the boundaries working in the top-left

three.js orthographic camera: zoom all for a cube with perspective

别等时光非礼了梦想. 提交于 2019-12-04 05:40:25
问题 I have developed a simple three.js application that renders a cube. I have created three files: index.html , viewer_style.css and viewer.js . The content of index.html is the following: <!DOCTYPE html> <html> <head> <meta charset=utf-8> <title>My first three.js app</title> <link rel='stylesheet' type='text/css' href='viewer_style.css'> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="js/three.js"></script> <script src="js/controls

Orthographic projection with origin at screen bottom left

五迷三道 提交于 2019-12-04 02:31:32
问题 I'm using the python OpenGL bindings, and trying to only use modern opengl calls. I have a VBO with verticies, and I am trying to render with an orthographic projection matrix passed to the vertex shader. At present I am calculating my projection matrix with the following values: from numpy import array w = float(width) h = float(height) n = 0.5 f = 3.0 matrix = array([ [2/w, 0, 0, 0], [ 0, 2/h, 0, 0], [ 0, 0, 1/(f-n), -n/(f-n)], [ 0, 0, 0, 1], ], 'f') #later projectionUniform =

Plotting world map in orthographic projection is giving “non finite points”

ⅰ亾dé卋堺 提交于 2019-12-03 15:55:11
I have a shapefile of world countries, downloaded from here . I can plot it in R using countries <- readOGR("shp","TM_WORLD_BORDERS-0.3",encoding="UTF-8",stringsAsFactors=F) par(mar=c(0,0,0,0),bg=rgb(0.3,0.4,1)) plot(countries,col=rgb(1,0.8,0.4)) Now I wanna plot it in orthographic projection (Earth seen from outer space), so I'm trying countries <- spTransform(countries,CRS("+proj=ortho +lat_0=-10 +lon_0=-60")) I also played with the x_0 and y_0 parameters (as stated here ), but I always get the error: non finite transformation detected: [1] 45.08332 39.76804 Inf Inf Erro em .spTransform

Othographic Projection in XTK

爱⌒轻易说出口 提交于 2019-12-02 08:40:20
So I am using XTK to develop a app that will allow users to view multiple 3D meshes in one renderer. The problem is that it uses a perspective camera instead of a orthographic, which causes panning to 'rotate' the meshes a bit. Has anyone been successful in getting XTK to render orthographically without modifying source code? I would rather not modify it but if I have to I will. Thank you! So from what I can see, there's no way to set a 3D camera to be in orthographic perspective without modifying the source code. However, it seems fairly straight forward to add that functionality. If you add