PTK C++ game engine, how to draw one surface / image onto another and get new image
Hello,
I'm new to this forum and this site in general and I can't seem to find the info I'm looking for. It is possible that this topic was never raised.
I'm not able to find in the PTK documentation the info about how to draw one graphic onto another and, as a result, get permanent change of the original image. I'm just testing the PTK lib to see if it suits my needs. Before when I used SDL, it enabled me to draw one surface onto another and as a result get a new surface. This is very important for the debris in the game. If I need to store location of debris graphic and redraw it every time it is supposed to appear on the screen, it would slow down whole game. But if the game level surface is altered permanently there is no need to store anything, the debris graphic is always visible on the game surface. There will be a lot of debris in the game.
I was wondering if anyone with PTK experience can help me out, the PTK itself is very easy to use, make many things easy and until now I was very thrilled with it, but this lack of info is frustrating. I also mailed the question to the authors of the PTK, still no reply.
Regards
Hi,
I am no expert but if you want to draw one sprite on another, you need to have some transparency no ? otherwise you just get the last drawn.
If you have the position of what you want to draw why just not redraw it with your modifications ?
++
I am no expert but if you want to draw one sprite on another, you need to have some transparency no ? otherwise you just get the last drawn.
If you have the position of what you want to draw why just not redraw it with your modifications ?
++
Because it would slow down whole game ... I don't want to keep the positions of debris, several thousands of positions. Instead, I want to draw on level surface and forget about it.
In PTK, currently, it is not possible to render from one KGraphic object to another. The beta version of PTK that you can get access to after you purchase does have this feature, but the beta version is not complete and has several issues, since it's moving to a DX9 backend instead of DX7.
Hi,
Ok I got your point now, but why don't you render in a buffer first and then render to it before rendering to the screen ?
I should really stop talking because I don't know your engine but if it is based on openGL there must be a way to hack it somehow.
Ok I got your point now, but why don't you render in a buffer first and then render to it before rendering to the screen ?
I should really stop talking because I don't know your engine but if it is based on openGL there must be a way to hack it somehow.
If you look in the headers KWindowGL and KGraphicGL, you'll see that all the members of those classes are public - you can get the opengl context, the texture, the raw image data, etc... and work with that. Or, you can use makePictureFromArray to create an image from a pointer to data that you've loaded (or created) yourself.
Oh, thanks, but do you use glDrawPixels in the implementation, not the header files, or you use OpenGL textures in OpenGL implementation, not DirectX of PTK?
Couldn't tell you, honestly, as I've never had the need to do it. I'm sure you'd have to write separate methods for OpenGL and DirectX renderers... I just know that all the data is exposed, so you really can do whatever you want. Remember, too, if you purchase PTK, you get access to the code, so you really can do whatever you want.
I understand what you're saying and thank you, but the author of the lib said that I could test before the decision. I'm not sure if the download file PTK20.zip is the full version, but I can't seem to find what you're saying and furthermore, I can't find collision detection and other features that I need.
Please, if you purchased it, could you look at the code and tell me what there is and how its working. This is something that I can't see from the header files, only cpp, which are not available. I'm interested to know if the implementation using OpenGL is using textures and not slow glDrawPixels. Also, I need fast collision detection algorithm present for sprites, easy sprite management, etc. I can't find any of those in documentation or header files.
Thanks.
Please, if you purchased it, could you look at the code and tell me what there is and how its working. This is something that I can't see from the header files, only cpp, which are not available. I'm interested to know if the implementation using OpenGL is using textures and not slow glDrawPixels. Also, I need fast collision detection algorithm present for sprites, easy sprite management, etc. I can't find any of those in documentation or header files.
Thanks.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement