|
Yes, glClear does clear the whole viewport - you would then redraw all of the content for the next frame. Matrices only affect what you are going to render in the future, not what you have already sent to be rendered.
|
|
|
|
|
Since I just discover that push / pop matrix is "deprecated " clearing all maybe the only decent option anyway. Really not that hard since I keep system state...
Bottom line OpenGL was not the best choise for my application. O well...
Thanks
|
|
|
|
|
Here is the class ->
class bullet
{
private:
public:
void update();
bool check()
{
if(y>=box_len/2)
{
return true;
}
return false;
}
void draw();
};
vector <bullet*> bullets;
Here is the update function ->
void update(int value)
{
for( typeof(bullets.begin()) it= bullets.begin(); it!= bullets.end();it++)
{
if((*it)!=NULL)
{
if(*it)->check())
{
delete *it;
bullets.erase(it);
}
}
}
glutTimerFunc(10, update, 0);
}
|
|
|
|
|
|
I am going to use graphviz to generate state flow charts (i.e. blobs representing states, arrows from one blob to another representing events/transtions) based on a transition table.
There are ways to give hints about the preferred placements, in rough terms, through the "rank" specification. That is not defining the placements, just one input parameter to the placement algorithm. Ideally, I would like to give the user a mechanism to drag one or more blobs to a different position, and then redo the layout but with this one blob pinned.
I do not have the time do decipher the placement algorithm from the source code , so now I hope that either someone knows graphviz in great detail, or the placement algorithms: Is pinning of individual graphic elements at all compatible with the placement algorithm? If it is, can this be done in the dot input language to graphviz? Or in some other way?
|
|
|
|
|
I can not know which is the best free tool for create infographics.
I want to know about this. Please provide me
Best tool or site to create eye catching infographics
|
|
|
|
|
|
Hello,
I am trying to develop a 2D graphics editor on C#.
In that editor I want continuous co-ordinates where ever the mouse hovers.
I tried using Graphics class in C# but it uses the screen co-ordinates.
Instead I want to use world co-ordinates to draw different shapes.
(Some what like a Autocad Editor, but I don't want to include the complex functionalities)
How can I achieve that?
|
|
|
|
|
Member 14558696 wrote: How can I achieve that? With a lot of hard work. And what do you mean by, "I want to use world co-ordinates to draw different shapes."? It does not matter what co-ordinate system you use, drawing a shape is much the same process.
|
|
|
|
|
|
Sorry can't reply on your question, but highly recommend you to think about 3d, not 2d. With the development of technology, virtual and augmented reality - 2d images are something that might be undemanding soon enough
|
|
|
|
|
I really need your help on this topic. I designing some PSD template websites and apps is this is the right web design or I have to code also? What responsive website means for a web designer is just create the same design for mobile, tablet... or the real meaning of the automatically changing weight for each screen?
And are we able to prototype our web page in Photoshop like the prototyping feature of Adobe XD?
Thanks!
|
|
|
|
|
Using OpenTK in devStudio 15 and windows forms on my dell desktop.
When I render a color (eg red = 255, 0, 0, 255), and read the results back it is about, but not quite half of the written value, eg 127, 0, 0, 127.
private void GetHitMap()
{
IntPtr unmanagedPointer = Marshal.AllocHGlobal(_hitMap.Length);
GL.ReadBuffer(ReadBufferMode.Back);
GL.ReadPixels(0, 0, renderCanvas.Width, renderCanvas.Height, PixelFormat.Rgba, PixelType.Byte, unmanagedPointer);
Marshal.Copy(unmanagedPointer, _hitMap, 0, _hitMap.Length);
Marshal.FreeHGlobal(unmanagedPointer);
}
On a laptop, running the same code, same extremely simple shaders, but different gpu, the red is sometime red on the screen, and sometimes 'half red' and the values I read back are sometimes not exactly half,
Using a framebuffer in opengl instead of Marshalling gives the same results.
All other colors and using r,g,b or any combination gives the same result.
I was planning to use 'designated colors' to identify objects, similar to a shadow map, but the colors are not consistent.
Is this a known or expected behavior? Is it fixable? Running out of things to look for.
|
|
|
|
|
Try pixel type unsigned byte.
"(I) am amazed to see myself here rather than there ... now rather than then".
โ Blaise Pascal
|
|
|
|
|
Using unsigned byte in the GL code works much better.
Thanks for the suggestion.
Still have to verify on the laptop if this solves all or only some of the issues.
I also tried copying to a bitmap :
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(bounds2.Location, Point.Empty, bounds2.Size);
}
which returns the 'right' values from 0..255.
|
|
|
|
|
Dears,
Hope all is fine.
Here, there is an article about Creating OpenGL Windows in WPF. But is it possible to embed a pure ะก++ OpenGL-GLFW or SDL based context into the WForms/WPF, which in its turn will provide controls on the GLFW-context and objects? In other words, WForms/WPF C# editor + C++ GLFW Context.
Thanks a lot.
|
|
|
|
|
Hi
I am generating a PDF for use in a lasercutter.
The printerdriver for the laser cutter takes vectors with a specific color and stroke-width, and uses them to cut all the way through the material. All rasters/bitmaps are just burnt into the surface of the material.
I would like to be able to take a piece of text and convert it to a vector outline.
I thought this would do it:
cb.BeginText()
cb.SetLineWidth(0.01f)
cb.SetColorStroke(BaseColor.RED)
cb.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_STROKE)
But apparently the stroke generated is a raster and not a vector.
Any ideas?
I could also go from the metods in GDI+/System.Drawing if anyone knows how to do that.
Kind regards - Jakob
|
|
|
|
|
Well, I've gone with this for now: GDI+ Path to PDF[^]
If anyone else has other methods, I'd still like to hear about them ๐
/Jake
|
|
|
|
|
Marked as spam; I see a URL, but not a question.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I have need to use the Vector2.CatmullRom(...) method in a memory intensive program that currently produces extremely large pictures for testing purposes. I found the ability to do this on the XNA platform. Before adding this reference, I was able to create the pictures I need. Unfortunately, since I now have to compile a 32 bit runtime as that seems to be the only format for the XNA library, I do not have enough memory available to complete the task(s) necessary.
IS there a 64 bit version of this method in this or another library? I need the ability to turn blocky cardinal direction lines into smooth lines with easy slopes (which is why I am using this function).
|
|
|
|
|
Hello,
i am trying to code some graphics for a little game in c++ and winapi / directx9.
I have established a background as a surface. Then i put some sprites on the background.
The problem is, as i call a function that has to center the screen on the active sprite, it doesn't show the background.
Here is the code so far, if you miss an information, please ask and i will answer.
First, the part of main, that is called, when user pushes button (winapi)
<pre>case ID_ZENTRIEREN:
{
for (int x=0;x<4;x++)
if (Spieler[x].Rundenaktiv==true)
{
Spielx=Spieler[x].posx;
Spiely=Spieler[x].posy;
d3ddev->Clear(0,NULL,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_COLORVALUE(0.0f,0.0f,0.0f,1.0f), 1.0f, 0);
render_frame_center(hDlg1, Worldposx, Worldposy, Bildschirmbreite, Bildschirmhoehe, Spielx, Spiely);
if (Spieler[x].Mobilart==0) {
float Mobilposx, Mobilposy;
Mobilposx=Spieler[x].posx;
Mobilposy=Spieler[x].posy;
render_Schuerfer(oWorldposx, oWorldposy, Mobilposx, Mobilposy);
}
else if (Spieler[x].Mobilart==1) {
float Mobilposx, Mobilposy;
Mobilposx=Spieler[x].posx;
Mobilposy=Spieler[x].posy;
render_Frachter(oWorldposx, oWorldposy, Mobilposx, Mobilposy);
}
else if (Spieler[x].Mobilart==2) {
float Mobilposx, Mobilposy;
Mobilposx=Spieler[x].posx;
Mobilposy=Spieler[x].posy;
render_Flugwaechter(oWorldposx, oWorldposy, Mobilposx, Mobilposy);
}
else if (Spieler[x].Mobilart==3) {
float Mobilposx, Mobilposy;
Mobilposx=Spieler[x].posx;
Mobilposy=Spieler[x].posy;
render_Jaeger(oWorldposx, oWorldposy, Mobilposx, Mobilposy);
}
render_ZeichenaktivesMobil(Spielx, Spiely, oWorldposx, oWorldposy);
render_frame_center(hDlg1, Worldposx, Worldposy, Bildschirmbreite, Bildschirmhoehe, Spielx, Spiely);
d3ddev->Present(NULL,NULL,NULL,NULL);
}
}
break;
As next, the function that should center the background:
<pre>void render_frame_center(HWND hDlg1, float &Worldposx, float &Worldposy, float &Bildschirmbreite, float &Bildschirmhoehe, float &Spielx, float &Spiely)
{
RECT screenRect;
GetClientRect(GetDlgItem(hDlg1, ID_KARTE),&screenRect);
RECT drawRect;
if (Spielx>(screenRect.right-screenRect.left)/2&&
Spielx<1600-(screenRect.right-screenRect.left)/2&&
Spiely>(screenRect.bottom-screenRect.top)/2&&
Spiely<1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=Spiely+(screenRect.top-screenRect.bottom)/2;
drawRect.left=Spielx-(screenRect.right-screenRect.left)/2;
drawRect.right=Spielx+(screenRect.right-screenRect.left)/2;
drawRect.bottom=Spiely+(screenRect.top-screenRect.bottom)/2;
}
else if (Spielx<(screenRect.right-screenRect.left)/2&&
Spielx<1600-(screenRect.right-screenRect.left)/2&&
Spiely>(screenRect.bottom-screenRect.top)/2&&
Spiely<1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=Spiely+(screenRect.top-screenRect.bottom)/2;
drawRect.left=0;
drawRect.right=0+(screenRect.right-screenRect.left);
drawRect.bottom=Spiely+(screenRect.top-screenRect.bottom)/2;
}
else if (Spielx>(screenRect.right-screenRect.left)/2&&
Spielx>1600-(screenRect.right-screenRect.left)/2&&
Spiely>(screenRect.bottom-screenRect.top)/2&&
Spiely<1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=Spiely+(screenRect.top-screenRect.bottom)/2;
drawRect.left=1600-(screenRect.right-screenRect.left);
drawRect.right=1600;
drawRect.bottom=Spiely+(screenRect.top-screenRect.bottom)/2;
}
else if (Spielx>(screenRect.right-screenRect.left)/2&&
Spielx<1600-(screenRect.right-screenRect.left)/2&&
Spiely<(screenRect.bottom-screenRect.top)/2&&
Spiely<1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=0;
drawRect.left=Spielx-(screenRect.right-screenRect.left)/2;
drawRect.right=Spielx+(screenRect.right-screenRect.left)/2;
drawRect.bottom=0+(screenRect.top-screenRect.bottom);
}
else if (Spielx>(screenRect.right-screenRect.left)/2&&
Spielx<1600-(screenRect.right-screenRect.left)/2&&
Spiely>(screenRect.bottom-screenRect.top)/2&&
Spiely>1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=1200-(screenRect.top-screenRect.bottom);
drawRect.left=Spielx-(screenRect.right-screenRect.left)/2;
drawRect.right=Spielx+(screenRect.right-screenRect.left)/2;
drawRect.bottom=1200;
}
else if (Spielx<(screenRect.right-screenRect.left)/2&&
Spielx<1600-(screenRect.right-screenRect.left)/2&&
Spiely<(screenRect.bottom-screenRect.top)/2&&
Spiely<1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=0;
drawRect.left=0;
drawRect.right=0+(screenRect.right-screenRect.left);
drawRect.bottom=0+(screenRect.top-screenRect.bottom);
}
else if (Spielx>(screenRect.right-screenRect.left)/2&&
Spielx>1600-(screenRect.right-screenRect.left)/2&&
Spiely<(screenRect.bottom-screenRect.top)/2&&
Spiely<1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=0;
drawRect.left=1600-(screenRect.right-screenRect.left);
drawRect.right=1600;
drawRect.bottom=0+(screenRect.top-screenRect.bottom);
}
else if (Spielx<(screenRect.right-screenRect.left)/2&&
Spielx<1600-(screenRect.right-screenRect.left)/2&&
Spiely>(screenRect.bottom-screenRect.top)/2&&
Spiely>1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=1200-(screenRect.top-screenRect.bottom);
drawRect.left=0;
drawRect.right=0+(screenRect.right-screenRect.left);
drawRect.bottom=1200;
}
else if (Spielx>(screenRect.right-screenRect.left)/2&&
Spielx>1600-(screenRect.right-screenRect.left)/2&&
Spiely>(screenRect.bottom-screenRect.top)/2&&
Spiely>1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=1200-(screenRect.top-screenRect.bottom);
drawRect.left=1600-(screenRect.right-screenRect.left);
drawRect.right=1600;
drawRect.bottom=1200;
}
d3ddev->BeginScene();
d3ddev->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO, &backbuffer);
d3ddev->StretchRect(Hintergrund, &drawRect, backbuffer, NULL, D3DTEXF_NONE);
d3ddev->EndScene();
}
Here is the init for directx
<pre>void initD3D(HWND hDlg1, HWND hwndRaumkarte, float &Bildschirmbreite, float &Bildschirmhoehe)
{
HRESULT hresult;
d3d=Direct3DCreate9(D3D_SDK_VERSION);
D3DDISPLAYMODE d3ddm;
d3d->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm );
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed=TRUE;
d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow=hwndRaumkarte;
d3dpp.BackBufferFormat = d3ddm.Format;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
d3dpp.BackBufferCount=1;
d3dpp.BackBufferFormat=D3DFMT_X8R8G8B8;
d3dpp.BackBufferWidth=800;
d3dpp.BackBufferHeight=600;
d3d->CreateDevice(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
hwndRaumkarte,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp,
&d3ddev);
d3ddev->CreateVertexBuffer( 4*sizeof(Vertex), D3DUSAGE_WRITEONLY,
D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT,
&g_pVertexBuffer, NULL );
void *pVertices = NULL;
g_pVertexBuffer->Lock( 0, sizeof(g_quadVertices), (void**)&pVertices, 0 );
memcpy( pVertices, g_quadVertices, sizeof(g_quadVertices) );
g_pVertexBuffer->Unlock();
D3DXMatrixPerspectiveFovLH( &Spritematrix, D3DXToRadian( Kamerawinkel ),
800 / 600, 0.00f, 100.0f );
d3ddev->SetTransform( D3DTS_PROJECTION, &Spritematrix );
d3ddev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
d3ddev->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
d3ddev->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE);
d3ddev->SetTransform(D3DTS_WORLD, &Spritematrix);
d3ddev->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS,
D3DTTFF_DISABLE );
d3ddev->Clear(0,NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0),1.0f,0);
d3ddev->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO, &backbuffer);
hresult= d3ddev->CreateOffscreenPlainSurface(1600,1200,D3DFMT_X8R8G8B8,D3DPOOL_DEFAULT, &Hintergrund, NULL);
if (hresult !=D3D_OK)
return;
}
Further information:
the surface has 800/600, but will be presented as 1600/1200.
int Spielx, Spielx==coordinates of the ship/ sprite
It would be great if someone helps me, because i didn't find a hint in my books or in web.
|
|
|
|
|
Hi,
anyone knows free html5 templates websites?
any suggestion?
|
|
|
|
|
|
Is it possible to fragment opengl memory so it can't load a large texture despite there being "enough" memory OR does opengl use a management scheme to prevent this?
|
|
|
|
|
Hi,
I'm trying to make a small ASCII block graphics adventure game on Windows using the console terminal, and I am looking for example resources and tutorials on how to make a console window screen wrapper. I mean to change the resolution by changing the fontsize, and then just display simple graphics with ascii block character.
Any free tutorials, examples and resources will be greatly appreciated.
thanks in advance!
|
|
|
|
|