Click here to Skip to main content
15,913,722 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: loading html Pin
simonchen.net22-Aug-03 0:07
simonchen.net22-Aug-03 0:07 
GeneralRe: loading html Pin
andyg.10122-Aug-03 16:58
andyg.10122-Aug-03 16:58 
QuestionHTML POST from C++ ? Pin
megaadam21-Aug-03 6:17
professionalmegaadam21-Aug-03 6:17 
AnswerRe: HTML POST from C++ ? Pin
theJazzyBrain24-Aug-03 22:55
theJazzyBrain24-Aug-03 22:55 
QuestionAnimated BMP? Pin
Henrik Husted20-Aug-03 23:37
Henrik Husted20-Aug-03 23:37 
AnswerRe: Animated BMP? Pin
Roger Wright21-Aug-03 7:21
professionalRoger Wright21-Aug-03 7:21 
AnswerRe: Animated BMP? Pin
theJazzyBrain24-Aug-03 23:02
theJazzyBrain24-Aug-03 23:02 
Generalloading texture image from a Web Service Pin
Siddharth Jain20-Aug-03 9:46
Siddharth Jain20-Aug-03 9:46 
Hi



I am trying to load a texture from an image I get from a Web Service. D3D provides a method TextureLoader.FromStream using which you can load a texture from a stream. This is the code I wrote to load the texture:

imageRequest = (HttpWebRequest)WebRequest.Create(URL);



URL is something like http://terraservice.net/ogcmap.ashx?version=1.1.1&request=getmap&layers=drg&styles=utmgrid_yellow&srs=epsg:4326&bbox=-122.427,36.66,-117.756,38.947913&width=1000&height=500&format=image/jpeg



imageResponse = (HttpWebResponse)imageRequest.GetResponse();

imageStream = imageResponse.GetResponseStream(); // get a "Stream" from the "Response" object

TextureLoader.FromStream(device, imageStream);

But TextureLoader.FromStream() fn. Gives an error message that “stream does not allow seeking”



Then this is the second thing I tried:

imageRequest = (HttpWebRequest)WebRequest.Create(URL);

imageResponse = (HttpWebResponse)imageRequest.GetResponse();

imageStream = imageResponse.GetResponseStream(); // get a "Stream" from the "Response" object



byte[] buffer = new byte[imageResponse.ContentLength];

imageStream.Read(buffer, 0, (int) imageResponse.ContentLength);

// imageResponse.ContentLength is long so have to cast to int

MemoryStream stream = new MemoryStream(buffer);

texture = TextureLoader.FromStream(device, stream);



but imageResponse.ContentLength is always equal to -1. I was able to save the image by doing:

Image img = Image.FromStream(imageStream);

img.Save("c:/junk/texmap.jpg", ImageFormat.Jpeg);

and it came out fine when i opened it in photoshop.



Then I tried following code (replaced imageResponse.ContentLength by imageStream.Length):

imageRequest = (HttpWebRequest)WebRequest.Create(URL);

imageResponse = (HttpWebResponse)imageRequest.GetResponse();

imageStream = imageResponse.GetResponseStream(); // get a "Stream" from the "Response" object



byte[] buffer = new byte[imageStream.Length];

imageStream.Read(buffer, 0, (int) imageStream.Length);

MemoryStream stream = new MemoryStream(buffer);

texture = TextureLoader.FromStream(device, stream);



but this gives following error while trying to access imageStream.Length while executing

byte[] buffer = new byte[imageStream.Length];



exception of type 'System.NotSupportedException' occurred in system.dll



This stream does not support seek operations.



Any ideas what to do?



sid



QuestionHow to bring Traffic to my website? Pin
mittalpa19-Aug-03 18:34
mittalpa19-Aug-03 18:34 
AnswerRe: How to bring Traffic to my website? Pin
Rocky Moore19-Aug-03 22:27
Rocky Moore19-Aug-03 22:27 
Generalscript that autimatically enters a the specified character at a certain point in a text box Pin
BPDecaf19-Aug-03 4:53
BPDecaf19-Aug-03 4:53 
GeneralRe: script that autimatically enters a the specified character at a certain point in a text box Pin
webProgrammer20-Aug-03 7:37
webProgrammer20-Aug-03 7:37 
GeneralProblem consuming java axis web service Pin
EnkelIk18-Aug-03 22:43
EnkelIk18-Aug-03 22:43 
GeneralUsing custom serializer? How? Pin
EnkelIk20-Aug-03 21:02
EnkelIk20-Aug-03 21:02 
QuestionHow to get web site designed. Pin
Segal18-Aug-03 19:34
Segal18-Aug-03 19:34 
AnswerRe: How to get web site designed. Pin
Roger Wright18-Aug-03 21:44
professionalRoger Wright18-Aug-03 21:44 
Generalmsgraph.chart ActiveX- white border, can't get rid of it... Pin
dandy7218-Aug-03 10:45
dandy7218-Aug-03 10:45 
GeneralJavascript/DOM Pin
andyg.10118-Aug-03 0:48
andyg.10118-Aug-03 0:48 
GeneralRe: Javascript/DOM Pin
DFU2318-Aug-03 5:30
DFU2318-Aug-03 5:30 
GeneralIIS keystore error Pin
darseh16-Aug-03 22:53
darseh16-Aug-03 22:53 
GeneralGenerating satellite assembly problem Pin
Member 4337813-Aug-03 18:12
Member 4337813-Aug-03 18:12 
GeneralUploading file to server Pin
pradipta12-Aug-03 3:05
pradipta12-Aug-03 3:05 
GeneralRe: Uploading file to server Pin
Not Active12-Aug-03 4:22
mentorNot Active12-Aug-03 4:22 
GeneralRe: Uploading file to server Pin
alex.barylski14-Aug-03 9:13
alex.barylski14-Aug-03 9:13 
GeneralRe: Uploading file to server Pin
Vasudevan Deepak Kumar15-Aug-03 19:46
Vasudevan Deepak Kumar15-Aug-03 19:46 

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.