Click here to Skip to main content
15,893,508 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dynamic Event Handling Pin
DustinMiles8-May-04 10:58
DustinMiles8-May-04 10:58 
GeneralRe: Dynamic Event Handling Pin
Colin Angus Mackay10-Sep-04 11:55
Colin Angus Mackay10-Sep-04 11:55 
QuestionHow to set background image of treeview? Pin
kookai7-May-04 17:10
kookai7-May-04 17:10 
AnswerRe: How to set background image of treeview? Pin
Dave Kreskowiak7-May-04 17:58
mveDave Kreskowiak7-May-04 17:58 
GeneralRe: How to set background image of treeview? Pin
Heath Stewart8-May-04 19:53
protectorHeath Stewart8-May-04 19:53 
GeneralRe: How to set background image of treeview? Pin
Dave Kreskowiak9-May-04 4:05
mveDave Kreskowiak9-May-04 4:05 
Generalterrain transformation of a 2d image into a 3d Pin
shedid7-May-04 15:36
shedid7-May-04 15:36 
GeneralRe: terrain transformation of a 2d image into a 3d Pin
kayhustle7-May-04 18:00
kayhustle7-May-04 18:00 
It depends on what kind of 2d terrain you have. If your terrain is a bump map, like what you see on a globe, where different colors or intensities correspond to different heights, then all you have to do is set for each pixel in your 2d terrain a pixel of the same height in your 3d model. So for every point (x,y) in 2d, there would be a point in 3d (x,y,z=(intensity of(x,y))/(maxintensity-lowestintensity)*scale), where your scale is something you define. However you would have to define how to connect these points in 3d using GL.Polygons, GL.Triangles, etc. Your normals would be the cross product of dx and dy. If intense2d(x,y) corresponds to the color or intensity in your 2d terrain, depending on how its defined in your terrain map. Your basic code would be:
<br />
float maxint = maximum intensity in your 2d terrain.<br />
float minint = minimum intensity in your 2d terrain.<br />
float scale = maximum altitude/maximum intensity in 2d terrain.<br />
float zscale = scale*(maxint-minint)<br />
for each x and y in 2d image <br />
float dx= intense2d(x+1,y)-intense2d(x,y), dy=intense2d(x,y+1)-intense2d(x,y);<br />
//Your normal would be the cross product of dx and dy as vectors<br />
//Vector and cross product you define yourself of course.<br />
Vector norm = cross(new Vector(1,0,dx), new Vector(0,1,dy)); <br />
Gl.glNormal3f ( (float)norm.x, (float)norm.y, (float)norm.z );<br />
// set the color if you haven't alreayd<br />
//Gl.glColor3f(rcolor,gcolor,bcolor);<br />
Gl.glVertex3f ( (float)x, (float)y, (float)intense2d(x,y)/(zscale)); 

If you are putting this terrain onto an object, then you might not neccesarily want to set the height, but just the normals at their corresponding location, which is bump-mapping.
This is the basic idea, otherwise you would have to be more specific.
GeneralRe: terrain transformation of a 2d image into a 3d Pin
shedid9-May-04 10:26
shedid9-May-04 10:26 
GeneralMS Office Add-In's: Need References... Pin
Tony Archer7-May-04 14:01
Tony Archer7-May-04 14:01 
General&lt;kicks self in head&gt; Pin
Tony Archer7-May-04 14:21
Tony Archer7-May-04 14:21 
GeneralArticles not on Office Add-Ins Pin
Tony Archer7-May-04 15:15
Tony Archer7-May-04 15:15 
GeneralRe: Articles not on Office Add-Ins Pin
Heath Stewart8-May-04 19:52
protectorHeath Stewart8-May-04 19:52 
GeneralRe: Articles not on Office Add-Ins Pin
Tony Archer9-May-04 9:07
Tony Archer9-May-04 9:07 
GeneralRe: Articles not on Office Add-Ins Pin
Heath Stewart9-May-04 9:30
protectorHeath Stewart9-May-04 9:30 
GeneralNullReference Exception in system.dll at System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback Pin
kayhustle7-May-04 13:48
kayhustle7-May-04 13:48 
GeneralRe: NullReference Exception in system.dll at System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback Pin
Heath Stewart8-May-04 19:48
protectorHeath Stewart8-May-04 19:48 
GeneralRe: NullReference Exception in system.dll at System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback Pin
kayhustle10-May-04 20:35
kayhustle10-May-04 20:35 
GeneralRe: NullReference Exception in system.dll at System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback Pin
Heath Stewart11-May-04 2:59
protectorHeath Stewart11-May-04 2:59 
GeneralDisplaying long string in tab page label Pin
Flack7-May-04 13:15
Flack7-May-04 13:15 
GeneralRe: Displaying long string in tab page label Pin
leppie7-May-04 13:52
leppie7-May-04 13:52 
GeneralRe: Displaying long string in tab page label Pin
Flack7-May-04 14:55
Flack7-May-04 14:55 
GeneralRe: Displaying long string in tab page label Pin
Heath Stewart8-May-04 19:42
protectorHeath Stewart8-May-04 19:42 
GeneralOverriding OpenFileDialog Pin
MrEyes7-May-04 13:10
MrEyes7-May-04 13:10 
GeneralRe: Overriding OpenFileDialog Pin
CWIZO7-May-04 20:59
CWIZO7-May-04 20:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.