How this can done in OpenGL? [video example]

Started by
3 comments, last by BytePtr 14 years, 11 months ago
Here is one video.
There is a textured grid. Grid is fixed size, each cell has it's own X,Y value. If user presses mouse button and drags mouse there is blocks (with size 64x64) drawn on the grid!! I have actually this grid, each block has fixed size (64x64), there is 256*256 (width*height) of them (this is grid max size). Is there anything general (algo, example, book) that helps me achieve that? I make a grid, and when dragging with mouse i draw blocks at mouse cursor. And i need this in OpenGL. I know that i must translate screen coords to world coords. OK, but how to draw blocks at mouse. One such block (minimum) always must be there. With mouse user can draw them more. And i have this example: But it doesnt draw cubes, but planes on grid. "From 2d to 3d in opengl, opengl coordinates tutorial" http://www.og.delcode.com/ Any help with that?
Advertisement
The technical knowledge it takes to do this is not so vast that it is out of the reach of a new programmer, however, it does take some understanding of linear algebra.

To briefly sum it up, the method used involves taking the 2d position of the mouse on the screen and using the view matrix to generate a ray. This ray, as it moves, creates a cuboid.

If you want to get into this the first thing you need to do is to learn about linear algebra, in particular, how matrices and vectors are used in 3D rendering.
Don't thank me, thank the moon's gravitation pull! Post in My Journal and help me to not procrastinate!
Thanks for reply. Im willing to learn anything that is needed to finish my project.

But mainly im like hacker. Im hacking code together until it starts working and works for me. So far this approach worked for me. Somehow im learning like that.


It's 03:15 A and im not sleeping. I just (hacked) solved this problem
http://www.gamedev.net/community/forums/topic.asp?topic_id=528945

This was indeed memory allocation problem. Allocated enough and works fine.


Thanks Brother Bob.
hi,
the video looks verry good,
perhaps this links can you help:
-> MayaCamera & FloatyCamera
i dont know whats your os is: (linux & win)
here the Link:

http://www.cis.njit.edu/~nichol/courses/it360/

hope its helpful
regards nomads
Thanks nomads for the sources.
But i don't have problems with camera or rotation. I solved them.

I have problems figuring out how to draw boxes with mouse in 3D.
Like in video.


I need examples about this. I have only one.


I need more sources related to drawing with mouse, ray picking and so on.

This topic is closed to new replies.

Advertisement