|
I'm working on a C++ project and need to do some graphics. This includes labeled axis and various format of data lines. How can I do it since visual studio does not have any graphics capability.
The Irishman
|
|
|
|
|
Hello everyone.
I want to create a Windows service in C# that can create a snapshot and send it to the server.
but my problem is when using "Screen.PrimaryScreen.Bounds". Visual Studio cannot speak.
I've searched a lot about this but can't seem to get any results.
thank you for helping me.
|
|
|
|
|
|
HoraceKHering wrote: it shows a little square.
That is a display problem. Might or might not be a data problem.
You are attempting to 'display' the data that you go via some mechanism so that your eyes can see it. That means that the computer must attempt to take the data and map it to a character set. That involves at least one and perhaps more than one transformation. Any of those can fail in different ways.
The surest way to show data is to learn what hex is and then create (or find) code that displays your data in hex. Every character set I have ever looked at will show hex data. (I think even EBCDIC but I could be mistaken and you are really unlikely to have to deal with that.)
|
|
|
|
|
Hi all, can you tell me what are the differences between pass-by-value and pass-by-reference in C++? thankyou
|
|
|
|
|
|
Pass-by-value is when someone presents an answer to your problem.
Pass-by-reference is when someone tells you "Why don't you just f***g google it?"
For being slightly more helpful:
Pass-by-value is when the caller makes a copy of the argument and hands this copy over to you. It carries no information about where your copy of the value is taken from - it may very well be the value of an expression directly stated in the argument list of the actual call. The copy is yours, and whatever you do to it won't affect anyone else. The value (copy) exists only as long as your method is running.
Pass-by-reference is when the caller doesn't give you a copy of the value, but rather tells you where you can find it, i.e. the location (address) in memory where the value is stored. You have to go and look there to find the value. In most cases, other parts of the program will be looking in the same location, and if your method changes the value stored, others who subsequently look there, will see your modifications to the value. The location exists both before and after the call to your method.
There is nothing C++ specific to this; it goes for all languages (or rather: all languages providing both call-by-value and call-by-reference - which are most of them).
|
|
|
|
|
Victor gave "value" AND a "reference". Should he read it out loud or copy and paste it?
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
hello every body.
I wanna to create windows service with c # that ,it able tack snapshot and send to server.
but my problem is when using "Screen.PrimaryScreen.Bounds" .visual studio cant know this.
I was so much search bout this problem but I cant get result.
thank you for help me.
|
|
|
|
|
You can't.
Services can't access the screen, keyboard, mouse, or any other element of the user interface at all. They can't start an app that can access the UI either!
Why not? Becauses services are designed to run when there is no user, and hence no user interface.
I don't know what you are trying to achieve, but you will not get this to work at all.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'm having an issue with a nested button flyout that I can't figure out.
( Screenshot of the problem --> Uwp Flyout Issue[^] )
Basically, a hamburger button's flyout contains a Splitview, where the pane is a Listview menu. When a menu item is chosen, the SplitView's content frame navigates to an associated page. Simple enough.
On a menu page, if I have a button with a flyout that contains a ColorPicker, there seems to be some sort of dismiss area overlap problem. I've tried various combination of LightDismissOverlayMode settings on the SplitView and the button flyouts, to no avail.
Here's the hamburgar button within the StackPanel of the main page:
<StackPanel>
<Button x:Name="BtnMainMenu"
Content=""
ToolTipService.ToolTip="Main Menu"
Margin="10,10,0,0"
FontFamily="Segoe MDL2 Assets"
Style="{StaticResource StandardButton}">
<Button.Flyout>
<Flyout x:Name="MainMenuFlyout"
Placement="TopEdgeAlignedLeft"
FlyoutPresenterStyle="{StaticResource MainMenuFlyoutStyle}"
Closed="MainMenuFlyout_Closed">
<SplitView x:Name="MainSplitView"
IsPaneOpen="True"
DisplayMode="Inline"
OpenPaneLength="180">
<SplitView.Pane>
<ListView
x:Name="MainMenuListView"
ItemsSource="{x:Bind MenuLinks}"
ItemTemplate="{StaticResource MainMenuItemTemplate}"
SelectionMode="Single"
Background="#FF808080"
IsItemClickEnabled="True"
ItemClick="MainMenuListView_ItemClick"/>
</SplitView.Pane>
<SplitView.Content>
<Frame x:Name="MainMenuContentFrame"/>
</SplitView.Content>
</SplitView>
</Flyout>
</Button.Flyout>
</Button>
</StackPanel>
... and the main layout StackPanel of the selected menu page that contains the ColorPicker in a button's flyout:
<StackPanel Background="{StaticResource MenuPageBg}" Width="230" Height="300">
<Border Style="{StaticResource MenuPageHeaderStyle}">
<TextBlock Text="Menu 4" Style="{StaticResource MenuPageTitleStyle}"/>
</Border>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="10"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ToggleSwitch Name ="Enabled" OnContent="Enabled" OffContent="Disabled"
Grid.Row="1" Grid.Column="1"
FontSize="18"/>
<ToggleSwitch Name="Floating" OnContent="Goodbye World" OffContent="Hello World"
Grid.Row="2" Grid.Column="1"
FontSize="18"/>
<Button x:Name="BtnColor" Grid.Row="3" Grid.Column="1"
Width="49" Height="48" Background="Gray" BorderBrush="{StaticResource WAVGray}" BorderThickness="1">
<Rectangle Width="30" Height="27">
<Rectangle.Fill>
<SolidColorBrush Color="{x:Bind TheColorPicker.Color, Mode=OneWay}"/>
</Rectangle.Fill>
</Rectangle>
<Button.Flyout>
<Flyout Placement="TopEdgeAlignedLeft">
<ColorPicker x:Name="TheColorPicker"
ColorSpectrumShape="Ring"
IsMoreButtonVisible="False"
IsColorSliderVisible="True"
IsColorChannelTextInputVisible="False"
IsHexInputVisible="False"
IsAlphaEnabled="True"
IsAlphaSliderVisible="True"
IsAlphaTextInputVisible="False" />
</Flyout>
</Button.Flyout>
</Button>
</Grid>
</StackPanel>
</Page>
Regards,
R. Wey
|
|
|
|
|
You're varying different backgrounds; it looks like you're creating a partial transparency (which might be inherited).
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
That's a good theory, and it led me to the solution.
If you refer back to the picture linked in the OP, the problem smells of two transparencies overlapping each other, but even when removing all transparent colors from my code, the problem persisted.
So, for a final test I went into my Windows Settings/Personalization/Colors and noticed "Transparency Effects" was enabled. Disabling it solved the problem, and I guess it makes sense since my app inherits its theme from the Windows settings on my PC. Nevertheless, this seems like an odd behavior from the base Windows theme for it to show up only when related to flyouts.
I'm guessing there's a way to override the base theme on a child flyout, but for now I'm just going to leave Transparency Effects disabled.
Thanks for nudging me in the right direction!
Regards,
R. Wey
|
|
|
|
|
this is bullshit, the first VAO without std::vector get drawn but not the second with vector :
Vector3f Vertices[4];
Vertices[0] = Vector3f(-1.0f, -1.0f, 0.5773f);
Vertices[1] = Vector3f(0.0f, -1.0f, -1.15475f);
Vertices[2] = Vector3f(1.0f, -1.0f, 0.5773f);
Vertices[3] = Vector3f(0.0f, 1.0f, 0.0f);
unsigned int Indices[] = { 0, 3, 1,
1, 3, 2,
2, 3, 0,
0, 1, 2 };
GLuint VBO[2];
GLuint IBO[2];
unsigned int id[2];
glGenVertexArrays(2, id);
glGenBuffers(2, VBO);
glGenBuffers(2, IBO);
glBindVertexArray(id[0]);
glBindBuffer(GL_ARRAY_BUFFER, VBO[0]);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[0]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices), Indices, GL_STATIC_DRAW);
struct Vertex
{
Vector3f position;
//Vector2f texCoord;
//Vector3f normal;
//int Boneindices[4];
//float Weights[4];
};
vector<vertex*> Vertices2;
Vertex* v=new Vertex();
v->position = Vector3f(-1.0f, -0.0f, 0);
Vertices2.push_back(v);
v->position = Vector3f(1.0f, -0.0f, -1);
Vertices2.push_back(v);
v->position = Vector3f(1.0f, -0.0f, 0);
Vertices2.push_back(v);
v->position = Vector3f(0.0f, 1.0f, 0.0f);
Vertices2.push_back(v);
struct Triangle
{
int indices[3];
};
Triangle* t = new Triangle();
t->indices[0]=0;
t->indices[1]=3;
t->indices[2]=1;
vector<triangle*> Indices2;
Indices2.push_back(t);
t->indices[0] = 1;
t->indices[1] = 3;
t->indices[2] = 2;
Indices2.push_back(t);
t->indices[0] = 2;
t->indices[1] = 3;
t->indices[2] = 0;
Indices2.push_back(t);
t->indices[0] = 0;
t->indices[1] = 1;
t->indices[2] = 2;
Indices2.push_back(t);
glBindVertexArray(id[1]);
glBindBuffer(GL_ARRAY_BUFFER, VBO[1]);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex)* Vertices2.size(), &Vertices2[0], GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[1]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Triangle)* Indices2.size(), &Indices2[0], GL_STATIC_DRAW);
for (size_t i = 0; i < 2; i++)
{
glBindVertexArray(id[i]);
glDrawElements(GL_TRIANGLES, 12, GL_UNSIGNED_INT, 0);
glBindVertexArray(0);
}
|
|
|
|
|
Your vector contains pointers to vertex , not the actual vertices. In fact it contains the same pointer four times, so even if OpenGL can handle pointers to vertex data you only have the same vertex repeated. The index buffer suffers from the same problem.
|
|
|
|
|
Isawyouoo wrote: this is bullshit Well you wrote it.
Look at the following line:
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex)* Vertices2.size(), &Vertices2[0], GL_STATIC_DRAW);
The third parameter is supposed to be a pointer to the data you wish to copy, but you are passing a pointer to a pointer. The vector contains a list of pointers to vertex elements, so &Vertices2[0] is the address of the first pointer item in the vector. It should be:
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex)* Vertices2.size(), Vertices2[0], GL_STATIC_DRAW);
Without the & on parameter three.
|
|
|
|
|
So I'm aware of MonoGame, SharpDx, etc, but these are all significant overkill for what I need, and what's more, none of them work over the remote desktop protocol.
I'm just wanting to do some very simple 2D graphics, and it doesn't even have to run at a particularly high frame rate (even 20FPS is fine). But most importantly, it has to work over the RDP, which means it has to be software rendering.
I have played with a WritableBitmap with some degree of success, but was wondering if anyone had any other ideas?
Obviously, this isn't for any sort of "real" game or anything. Just basically an exercise to keep me from forgetting how to use C#.
|
|
|
|
|
I'm somewhat new to DirectX programming and need a bit of guidance. My requirement is currently limited to video and 2D drawing and so far I've managed to get SharpDX to play a video from a file without problems, and also have been able to do my 2D drawing. This was simple enough and the performance is good.
Ultimately, my video source will need to be video input devices ( i.e. web cams, video capture cards, etc. ).
My question is: Does SharpDX.MediaFoundation include DirectShow wrappers such that I can access and play video from local video input devices? If so, can someone point me in the right direction and link some examples of using SharpDX for this purpose?
Many thanks.
|
|
|
|
|
Quote: NOTE: As of 29 Mar 2019, SharpDX is no longer being under development or maintenance Are you sure you still want to go down SharpDX path?
Sadly, the only .NET wrapper for DirectX anything that I know of, that is still in development, DirectN[^].
|
|
|
|
|
I understand it's no longer supported, but it's battle tested and I don't think the risk at present is any greater than investing in the "latest and greatest" GUI framework only to have it killed off before it gets off the ground.
Besides, I feel if I use SharpDX to get a better handle on the underlying concepts, porting to something new(er) when required would be easier.
As to my original question, I know there's other NuGet packages that make easy work of displaying camera input ( i.e. AForge, Accord ), but I'm not convinced they're taking full advantage of the GPU, which is what I'm looking for. Specifically, I need to route the capture byte stream directly to the mediaengine's render surface as I'll be dealing with larger sizes and framerates.
Regards,
R. Wey
|
|
|
|
|
|
I'm using WinForms (yeah, I know ... old school), tho I don't think that makes much difference as in the end its simply the window/control Handle that has to be specified as the swapchain.OuputHandle. I'm doing that already for playing a video file as a test and performance is very good.
When looking through SharpDX.MediaFoundation with Reflector, I get the strong feeling it provides the means for capture input, but I can't find any complete examples in that specific area.
Regards,
R. Wey
|
|
|
|
|
And herein lies the problem with using a library that's been dead in the water for two years, lack of support.
I can't help you as I've never used the thing.
|
|
|
|
|
No problem. Given that it saw over 2.5 million downloads, I figured there might be somebody that used it for this purpose and I don't think DirectX11 is going anywhere any time soon.
As for newer platforms, I unfortunately don't have a lot of experience with them so I'm concerned about the stumbling block that would present and not knowing their limitations. I could struggle my way thru UWP, but using what accelerated graphics API? Win2D? WinUI3? DirectN ?
It's hard to know which platform to choose that will still be around by the time I learn it.
Regards,
R. Wey
|
|
|
|
|
|