# OpenGL How this can done in OpenGL? [video example]

This topic is 3442 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
hi,
the video looks verry good,
perhaps this links can you help:
-> MayaCamera & FloatyCamera
i dont know whats your os is: (linux & win)

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

##### Share on other sites
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 more sources related to drawing with mouse, ray picking and so on.

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632989
• Total Posts
3009741
• ### Who's Online (See full list)

There are no registered users currently online

×