# dgcoventry

Members

33

184 Neutral

• Rank
Member

• Interests
Art
Design
DevOps
Programming
1. ## Trandforming a 3D point to the 2D screen given the view direction

Cheers, Mussie, that is very helpful.
2. ## Trandforming a 3D point to the 2D screen given the view direction

Thanks for your patience. You define the right vector as the cross product of the view and the up vector right = Cross(view, (0, 0, 1)); But then you define the up vector as the cross product of the right and the view. Is that correct? up = Cross(right, view); Reducing the View vector to one unit I get: (-0.415978346717368, -0.863157423028074, 0.286218933919161) The cross product of the view and the up (0,0,1) vectors gives: (-0.863157423028074, -0.415978346717368, 0) I now have the three columns but, if I derive the up from the cross between the right vector and the view, I get the new up vector of (-0.1190608789309, -0.247051997423505, 0.57200275199075). Is that right? $$\begin{vmatrix} -0.863157423028074 & -0.1190608789309 & -0.415978346717368\\ -0.415978346717368 & -0.247051997423505 & -0.863157423028074\\ 0 & 0.57200275199075 & 0.286218933919161 \end{vmatrix}$$
3. ## Trandforming a 3D point to the 2D screen given the view direction

I'm afraid my difficulties with matrices continues. Supposing I have a point (100,100,50) My view direction is defined by the vector (-0.720495631362985, -1.49503251161485, 0.495745735636187) Up is in the direction (0,0,1) The cross product of (-0.720495631362985, -1.49503251161485, 0.495745735636187) and (0,0,1) is (0,0.720495631362985,-1.49503251161485). Is this right? If I cross this with (100,100,50), this gives (72.0495631362985,149.503251161485,-185.528032729634). So my screenx=72 and screeny=150?
4. ## Trandforming a 3D point to the 2D screen given the view direction

Thanks. I have been searching Google using the terms "lookat" and "matrix", but I'm not terribly familiar with the nomenclature used. I've found something here, but again, I am unsure of how it applies to my proposed implementation. As I explained above, I'm planning to generate a SVG file. Most views of the file will be in the plan view (just the x and y coordinates), but I want to make sure that the 3D capability is preserved if needed.
5. ## Trandforming a 3D point to the 2D screen given the view direction

How can I derive the transformation matrix from the view direction? It strikes me that the values given for the view vector have already been reduced to be plugged into a formula to calculate the screen coordinates. Or do I still need to find the cosines and sines and angles in 3d? (Thanks for the assistance, by the way)
6. ## Trandforming a 3D point to the 2D screen given the view direction

Thanks. I'll have a look at the link. I want to render portions of the file as an SVG to be loaded into the browser, so I just need to know the 2D screen projection points in the event of the veiw being anything other than in plan. Hence OpenGL solutions are not really applicable.
7. ## Trandforming a 3D point to the 2D screen given the view direction

How do I translate a point onto the screen? I want to get the screen-x and screen-y, given that the viewing direction is x=-0.720495631362985,y= -1.49503251161485, z=0.495745735636187 and the view is orthographic. If a line is from (0,0,0) to (100,100,100), how is it represented on the screen, given the viewing direction above? I hope this is clearer. I've had this conversation before on here, but it was years ago and I can't remember how it was resolved.
8. ## Trandforming a 3D point to the 2D screen given the view direction

I have a DXF file that I want to render onto the screen as an orthographic 2D image. The view direction vector is given in the following format: -0.720495631362985, -1.49503251161485, 0.495745735636187 I want to translate a point onto the screen, given the x, y and z coordinates in the form screen-x, screen-y. Google mostly delivers opengl solutions. If the View direction is looking straight down (ie. the z-coordinate is removed), then the vector is as follows: 0,0,1 In which case ((int)x, (int)y)==(screen-x,screen-y) I have asked this question before, but it would seem that that was before the board was upgraded.
9. ## OpenGL Bitblit from buffer to screen

Thanks for the responses.   Here's what I have: #include <GL/glut.h> void display(void) { glClear(GL_COLOR_BUFFER_BIT); glFlush(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(600, 600); glutInitWindowPosition(100, 10); glutCreateWindow(argv[0]); glutDisplayFunc(display); glutMainLoop(); return 0; } This produces a black window.   What I want is to be able to have a white block at the bottom of the window in which to draw text.   I also want to be able to draw lines and text in the black area as depicted in the attached image. [attachment=24729:opengl.png]   I want both areas to be drawn to off screen and to be bit blitted onto the screen as needed, so I need 2 (or more) separate scratch areas to draw to.
10. ## OpenGL Bitblit from buffer to screen

I've been reading up on OpenGL, but I'm particularly interested in swapping out bitmaps from a buffer onto a screen and visa versa.   My main function is as follows: int main(int argc, char** argv) { init_font(); glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE); glutInitWindowSize(500,500); glutInitWindowPosition(0,0); glutCreateWindow("Griddle"); glutDisplayFunc(renderFunction); glutMainLoop(); return 0; } void renderFunction() { glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glFlush(); } This opens a window with a black backgound.   My understanding is that I should define a Framebuffer: glGenFramebuffers(1, &frameBufferID); and then bind it: glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer); Am I correct in thinking that anything drawn on the FBO is rendered on the screen?   How can I assign a 2D array to a buffer and then render it to the screen?
11. ## Make file unreadable by an external program

You could try aligning the bytes of the files so that they're not on a byte boundary.
12. ## Isometric Viewports

Please don't be so condescending.   I have already searched on Google and have looked at most of those results, and I find it insulting that you think that I haven't.   I'm asking here because Gamedev.net is the place most likely to have tutorials and articles that will address this.   If it isn't then fine, tell me that there is nothing here that will help me and I'll continue searching on Google.
13. ## Isometric Viewports

Is there a tutorial on using an Orthographic Projection Matrix?
14. ## Isometric Viewports

Hi, FLeBlanc, thanks for taking the time to respond.   Sorry, I wasn't clear. I'm not talking about the angles of the view, but rather that there is no perspective.   So the position of the camera doesn't matter, merely the direction in which it points.   if I have a line in my model that is represented by p1(0,0,0) and p2 (100,0,100), then viewed from above, that line is horizontal and 100 units long.   I want to view it from an angle (say viewing in the direction -1,-1,1), then the same line (in 2D, because the viewport only has 2 dimensions) is   p1(0,0)<- remains the same because it is at the origin p2(70.7,122.5 )   (I got that from drawing the line in a CAD programme; I have no idea how to calculate it - that's what I'm hoping to find out!)   So, to summarise, I want to transpose all points in my model so that I can display them in a 2D viewport, depending on the angle of the viewport relative to the x-y plane.   I hope this is a little clearer.
15. ## Isometric Viewports

I have a 3D model which is defined by cartesian coordinates, each point of each object having an x, y and z.   I want to depict the model as it would appear in 2D in a viewport.   The camera is isometric (ie, there is no perspective element) and is defined only by it's normal vector.   Where would I get a tutorial on how to do this?   Alternatively, is there a standard matrix to apply to effect this?   Kind regards,   Dave