|
I already was using locked bits, sorry. I should have mentioned that much. Looking from the code you've posted though, i've managed to fix the colouring in what I do have. The Red and the Blue were the wrong way aroung :p
Thanks for teh help
|
|
|
|
|
You mentioned SetPixel in the initial question. You're not using that after locking, right? Something similar to what's posted here (locking the bits, marshalling into a byte[], setting the byte values, marshalling it back) is the usual procedure and it is quite fast (I believe, never done it myself).
|
|
|
|
|
Nah, I'm not doing that. I'm locking and unlocking. I just used set pixel to deter people from recommending to use it. I looked back in my previous questions and saw you had made some comments
Locking and Unlocking is still not quick enough unfortunatley
|
|
|
|
|
You can always work with the bits using pointers. Christian Graus outlines a method here[^].
|
|
|
|
|
Interesting article. Its quite similar to my implementaion. In his though he changes the data in the loop. Whilst in mine on the other hand I calculate the entire image in a byte[] then transfer it to a function similar to his to write the bitmap. Maybe I could directly interact in the image processing loop.
Time to experiment
|
|
|
|
|
I wonder if what you're doing inside that pixel loop is too intensive. In particular, if you're reading R, G, B, A properties from a Color each time, that might cause speed issues. If you can have your renderer write directly into the byte array that might help.
|
|
|
|
|
Not going to lie. My ambition in this project is a raytracer. If I can realtime
|
|
|
|
|
A realtime ray tracer will be hard (understatement) without using some hardware acceleration, unless for a very small viewport.
|
|
|
|
|
true, true, Worth a shot. To get a frame a second it has to be ~300px * 150px viewport with reflections and ambient occlusion turned off. I don't know anything about handling hardware though. Currently it is all handled by c# .NET & GDI
|
|
|
|
|
It's tricky to write a software renderer that will be fast enough.
If you want direct pixel access, LockBits is indeed the answer. Depending on what your engine is producing, you may want to draw shapes instead (though if you are texture mapping and lighting, by pixel may be necessary).
|
|
|
|
|
My old engine used the graphics.DrawLine and the graphics.FillPolygon . This (even drawing a simple triangle) was much quicker than using a hand built pixel plotter using locked bits :/
My new engine has lighting and diffuse textures (working but slow at a frame per second with a few meshes on the screen)
Thanks
|
|
|
|
|
i have created a wcf service in 3.5 and trying to host it on 11s6. service was created on windows 7
when i host and browse for the service i get the error
"This collection already contains an address with scheme http. There can be at most one address per scheme in this collection"
i tried couple of things in web config but still getting the error
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://localhost/"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
any idea how to get through this
|
|
|
|
|
Are you using multiple bindings in the service? If you use multiple bindings that use same protocol, it throws error.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
i am using basichttp binding
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHTTP" sendTimeout="00:10:00" closeTimeout="00:05:00" openTimeout="00:1:00" receiveTimeout="00:05:00"
allowCookies="true" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8"
useDefaultWebProxy="true" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="Ntlm" proxyCredentialType="None" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="F2F.Service1" behaviorConfiguration="F2F.Service1Behavior">
<endpoint address="" binding="basicHttpBinding" contract="F2F.IService1">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="F2F.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
|
|
|
|
|
I am working with WCF and Rest services, where i defined a UriTempalte with some http request, i know how to call this Request and Response functionality in ASp.Net, can i cal same Request, and get Response in Javascript/Jquery. I googled alot, please any one help me regarding this...
Thnks in Advance..
|
|
|
|
|
It's been a while, but it should be something like this I think.
var val1 = document.getElementById('clientid1').value;
var val2 = document.getElementById('clientid2').value;
var val3 = document.getElementById('clientid3').selectedIndex;
var val4 = document.getElementById('clientid4').options[index].innerHTML;
var val5 = document.getElementById('clientid5').innerHTML;
var datapropt = "{'val1':'" + val1 + "'";
datapropt += ", 'val2':'" + val2 + "'";
datapropt += ", 'val3':'" + val3 + "'";
datapropt += ", 'val4':'" + val4 + "'}";
$.ajax({
type: "POST",
url: "StaticWebMethods.asmx/TheWebMethodName",
data: datapropt,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
location.reload(true);
}
});
the function in the StaticWebMethods.asmxfile would look similar to this:
[WebMethod]
public static bool TheWebMethodName(int val1, string val2, string val3, string val4){
}
Hope this helps.
V.
|
|
|
|
|
I am looking to create a small application that I can load an xml or to connect to a DB and generate some controls on a User interface.
The xml or DB needs to store only 10 controls.
Best regards,
Yous
|
|
|
|
|
Uh huh... well that's easy enough, many ways to go about it. Are you just looking to experiment? Or do you have a real scenario?
|
|
|
|
|
I have a small scenario.
I 'd like to create/store in a XML or db some controls like textbox, listbox, combobox,... Défined by the Administrator.
When the user start the gui, the user interface will be generated from the xml or db.
After,The user Will fill the datas selected with the controls and after i need to generate an XML file or db with the content.
|
|
|
|
|
OK I am a newbie and I am wondering, why You would want to do it that way? Maybe use a stored procedure to populate the form from the data how could you control The layout?
If My question seem's silly Remember I am trying to learn all I can.
Thanks
Frazzle the name say's it all
|
|
|
|
|
bysystems wrote: create/store in a XML or db some controls like textbox, listbox, combobox
Do you mean store the contents of a listbox or combobox?
|
|
|
|
|
Hi, I am going to suggest that you break this problem down into stages:
1. figure out how to create an instance of a control directly from a structured string: for example: given:
"Control:TextBox, Name:TB1, DefaultText:Enter data here.,Location:'100 200', Size:'100,24', BackGroundColor:Color.Silver, ForeColor:Color.Black"
How do you parse that string, or some similar string, and dynamically create a TextBox Control with the appropriate properties.
Hint: use 'CreateInstance.'
2. Once you know how to dynamically create controls, then focus on how you add them to the user interface (simple).
3. Finally, when you are ready to save the controls, and their properties, and/or contents, out to a file, you have many options for serialization, such as: writing XML, writing JSON (see Mehdi Gholam's excellent JSON article here on CP), etc.
good luck, Bill
"In the River of Delights, Panic has not failed me." Jorge Luis Borges
modified on Tuesday, August 30, 2011 3:10 AM
|
|
|
|
|
To start with you need to consider carefully exactly what you (and the user) think that you are going to achieve by doing this.
For example if all you want is a 'list' of values then that it fairly simple.
If you think that you are going to create a system that encapsulates user defined layouts, multi-level hierarchies, complex controls, etc then it is unlikely to provide benefit. The reason for that is that by the time someone is competent at doing that then they are essentially replicating what a programmmer would be doing in the first place (with a great deal more complexity.)
So if the first.
1. Create a simple syntax that represents a limited set of controls. Like 'list', 'radio', 'text'.
2. For 'list'/'radio' there needs to be a way to provide values. Optionally for 'text' you might provide a regex.
3. Each item needs to be able to specify an xml element name.
4. You consume a block of these entities and create a dialog that lists each top to bottom. Obviously you create controls dynamically based on the definition from 1. Optional, only AFTER everything else works, make the controls distribute themselves such that the dialog is not just a top to bottom resource.
5. On Ok the element from 1 is used to create xml.
|
|
|
|
|
I have a C#.net 2008 desktop application that I would like to stop before the first desktop screen shows up. I want to stop this application from executing immediately if the user has not been granted access to the application after looking up what access they have been granted by the active directory.
I want to stop the application before the following statement is executed: Application.Run(new Mainform());
i would like to stop the application from running in program.cs.
The only options that are close to what I want to do are:
Application.ExitThread(); or Application.Exit();
However these statements run after the Application.Run(new Mainform()); statement is executed.
Thus my questions are:
1. Is there way to not display the first desktop screen? If so, what would be code be?
2. If that is not possible, what are my other options? Do I just display the desktop tabs and let the user select the tabs they want to work with? if the user does not have access to that tab, do i display a message saying 'no access' and redisplay the screen like it was before the user clicked on the tab? if so, can you show me some example code?
3. If my options do not work, what do you suggest and can you point me to a reference of some code I can use?
|
|
|
|
|
typically Application.Run(new Mainform()); is located inside a Main() method inside the Program.cs file. There is nothing special about either one of those, so you are allowed to edit the file, and insert statements in front of the Run(Form) call. I do license checking, or other overall go-nogo decisions, right there, and when the need arises I create a small Form and show it modally i.e. with ShowDialog(); then decide whether to continue or terminate, i.e. Application.Run(new Mainform()); then sits inside an if-block near the end of Main() .
Luc Pattyn [My Articles] Nil Volentibus Arduum
modified on Monday, August 29, 2011 6:34 PM
|
|
|
|