|
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
|
|
|
|
|
|
|
I am creating a game with pygame and an image won't show up until the window is loading to be closed. This is my code so far:
import pygame
pygame.init()
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption("ALix")
icon = pygame.image.load("nater.jpg")
pygame.display.set_icon(icon)
playerImg = pygame.image.load('nater.jpg')
playerX = 400
playerY = 300
def player():
screen.blit(playerImg, (playerX, playerY))
running = True
while running:
screen.fill((255, 255, 255))
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
player()
pygame.display.update()
modified 13-Jul-20 3:22am.
|
|
|
|
|
I do not know pygame but I notice that you do not call pygame.display.update() until the end of the program. In most GUI applications you need to call update during normal running in order to keep it current.
|
|
|
|
|
I have run into a dead end in another OpenGL forum.
I have a basic understanding how (OpenGL) stencilling works.
My stencil is in 2D , no depths.
I am extracting a (circular) part of OpenGL objects, no problem.
I am trying to further manipulate the stencil result.
The task is to enlarge the result and move it to the center of the screen.
I used glTranslatef but it moves the original stencil, not the result. I want to move the result only.
I think my issue is that the stencil was build in "top of the modleview matrix" ( no push /pop) and the objects to be stencilled are in various matrix "stack" - used push / pop.
I understand the "result" is in color buffer, but it sure looks as I am manipulating the stencil buffer, which has been already disabled.
Am I correct in all this?
Do I have to rebuild all on SAME matrixview stack level ?
I am sorry if I am not using correct OpenGL terminology.
Cheers
|
|
|
|
|
First - to avoid "confusion" - I am using term "object" to describe what is created in OpenGL in-between "new " and "end" loop code.
I have a "text (object)" rendered (in OpenGL window) , I need to delete such text and replace it with another one.
I do no want to translate , rotate etc. ... just delete and replace.
What I have tried so far ALWAYS writes OVER the existing text and makes a mess.
Is that possible in OpenGL?
I think I'll try (a hack ) - moving / translating current(text) matrix off the screen....
Open to other ideas.
Cheers
|
|
|
|
|
This is just a wild guess because I can't see your code - are you missing a call to glClear in your render loop?
|
|
|
|
|
As a general "rule" NOT to invite uncalled for criticism on my under construction code I am therefore very reluctant to post code.
However, every rule has an exception so here is the latest implementation of "write text message" to OpenGL window.
It writes the message, but in wrong position - irrelevant for now.
(The disabled #ifdef / #endif code was added and that is why the message is written in wrong raster position.The raster position code must be in wrong place. )
It is my understanding that OpenGL keeps the data - bitmap in this case - in video card hardware. So to override / update the data I have to access that particular hardware .
Or in another words - OpenGL "variable / object" cannot be just overwritten like C code.
So I believe I need to keep track of "matrix" where the initial bitmap is written and then
glLoadIdentity(); should clear the entire matrix.
Correct me if I am wrong, but glClear would not work SELECTIVELY , it would clear entire buffer.( I did neglected to add "selectively" to the post title )
<pre>void OpenGL_text(char *message, float x, float y, float z) {
printf("\nOPENGL TRACE OpenGL @function %s @line %i \n", __FUNCTION__,
__LINE__);
printf("\nOPENGL TRACE STOP passed message %s @line %i\n", message,
__LINE__);
char menu[80];
strcpy(menu, message); int len;
len = strlen(menu);
glColor3f(1, 1, 1);
{ glMatrixMode( GL_PROJECTION); glPushMatrix(); glLoadIdentity();
gluOrtho2D(0, 500, 0, 500); { glMatrixMode( GL_MODELVIEW);
glPushMatrix();
glLoadIdentity(); glRasterPos3f(x, y, z);
for (int i = 0; i < len; ++i) {
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, menu[i]);
}
glPopMatrix(); } glMatrixMode( GL_PROJECTION);
glPopMatrix();
} glMatrixMode( GL_MODELVIEW);
}
|
|
|
|
|
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.
|
|
|
|
|