highgfx module
BlitzMax Forums/BlitzMax Programming/highgfx module
| ||
I have just finshed work on a new module which allows you to 3 key things: * Draw textured polygons * Draw glowing lines * Draw to an image (render to texture) Shot of a demo created with the module: ![]() Code for above demo: I created these modules because I will find them usefull and as such I will update, etc. when I need to (or if there are are enough requests for a feature, and I know how to add the feature :) There are limits of course: You can only use it with GLMax2DDriver(): You can not use Max2D drawimage, etc. with them. I have included custom drawimage() and drawimagerect() commands and I might add tileimage and drawimageblock if needed. You can use it for commercial/free projects, no restrictions apply. Get It From Here! Documents are in diablo.mod/highgfx.mod/doc |
| ||
very nice, thanks! *edit* top marks for the neat integration with max2d, and having the source is extremely useful! makes it very easy to use |
| ||
Great Thanks! Testing with it now, agree that open source is useful to users who want to learn. |
| ||
Would it be possible to use the render to texture to select an image to render to, then use normal OpenGL commands with custom textures to do your own rendering, then use your module again to switch back to drawing to the backbuffer? Also what are the requirements for render to texture, does it rely on having a certain version of OpenGL or a certain extension? |
| ||
Would it be possible to use the render to texture to select an image to render to, then use normal OpenGL commands with custom textures to do your own rendering, then use your module again to switch back to drawing to the backbuffer? You should be able to do this. When you call the SetBuffer with an image it stores what texture it was using. Also what are the requirements for render to texture, does it rely on having a certain version of OpenGL or a certain extension? It requires opengl 1.1 and it shouldnt need any certain extensions |
| ||
Then how are you rendering to a texture without using an extension? Is it really a texture in memory or is it basically rendering to a locked image pixmap in main memory? |
| ||
you could always d/load the source and look for yourself, if you can't be bothered, why should Diablo... ;p |
| ||
Diablo this is great module. About the restriction of drawingImages. Have you tried to use the enableTx and disableTex that are stricted in the GLMax2D? |
| ||
A BIG BIG BIG thanks!!!! [edit:] your examples are very well explained! |
| ||
About the restriction of drawingImages. Have you tried to use the enableTx and disableTex that are stricted in the GLMax2D? I did have a lil look, but it didnt work... till now! :/. I'll test it out a bit more and update the module (i'll try and make it so you dont have to change offical mods). Then how are you rendering to a texture without using an extension? Is it really a texture in memory or is it basically rendering to a locked image pixmap in main memory? Its done using glCopyTexImage2D, I might change it to glCopyTexSubImage2D because I just tried some test on the old laptop and it seemed a lot faster. I'm going to have a read about the differeance's and do some tests using each method. To be honest, the render to texture was an after thought which I only put in to day, havent had much time to try it out fully. your examples are very well explained! Thanks, I pride my self on it. |
| ||
Ooops wrong. I meant private not strict. Well I have writen what I had found out about this and how to draw textured polyies in this Topic. |
| ||
Hmm. If I remember, copying from the backbuffer into a texture uses the CPU usually and is not very fast, and certainly not as fast as rendering directly to a texture - you can't really call it render-to-texture when it's really just `render to backbuffer and copy to texture`. |
| ||
Update: ModuleInfo "History: 1.01" ModuleInfo "History: You can now yous Max2D Commands while not in SetBuffer()...EndBuffer()" ModuleInfo "History: Added GetImageName()" ModuleInfo "History: Added BindTexture()" ModuleInfo "History: Added UnBindTexture()" ModuleInfo "History: Added SetTextureBuffer()" ModuleInfo "History: Added a mode flag to setbuffer()" ModuleInfo "History: Added flags 'HI_RENDERTOTEXTURE_MODE_DIRECT" The most important info of this new update is the new mode argument in SetBuffer(). This can be of any of the following: HI_RENDERTOTEXTURE_MODE_COPY HI_RENDERTOTEXTURE_MODE_FASTCOPY HI_RENDERTOTEXTURE_MODE_DIRECT Direct mode is done using fbo's, but it should do a check if you try and use that mode when its not supported and return false (otherwise true). Also You should now be able to use normal blitzmax 2d draw commands as long as your not in a setbuffer()...endbuffer() And... I added SetTextureBuffer() which takes an opengl texture to rendered to. note you need to give width & height for that function. Added custom bind texture and unbind for better support of max2d. Also added getimagename which will return the texture name (%) of the give image (create one if highgfx dosent have it stored). I'm sure i missed some stuff. Havent really got the time to bug test it today :( Download from Here Or the link in my new and imroved slimline sig :) PS: Yer I no i said I wouldnt add fbo's but It was easier then I thought (dont worry if you dont know what i'm on about) EDITZ: Oh I knew I forgot somthing... I added a Init function which you have to call if you are going to use HI_REDNERTOTEXTURE_MODE_DIRECT. |
| ||
Can you explain the differences between those three render-to-texture modes? What actualy happens? |
| ||
I didnt make OpengGL so i cant tell you the inner workings - however... HI_RENDERTOTEXTURE_MODE_COPY - Is the mode that was first in there (render to backbuffer and copy) HI_RENDERTOTEXTURE_MODE_FASTCOPY - Is done using glCopyTexSubImage2D which is less acurrate (sometimes) but a bit faster then using glCopyTexImage2D HI_RENDERTOTEXTURE_MODE_DIRECT - is done using FBO's or framebuffers which should be the fastest out of the lot but isnt as wildly supported. Just google the terms for more info. |
| ||
HI_RENDERTOTEXTURE_MODE_DIRECT nice if it works, i'll be trying that out sometime soon. |
| ||
How is FASTCOPY mode less accurate sometimes? I use the same call to do a copy of the backbuffer into a texture, and it doesn't seem to give different results ever. |
| ||
I only said that because sometimes the results I got with it were different to what i got when i just used copy. i could have been of my head at the time tho ;) Edit: if i recall it had somthing to do with the source image size. As I said I havent had the time to debug it to day, but I should be able to over the week end. Further Edits: Any way I thought I'd let you decide what mode you want to use. |
| ||
Update: ModuleInfo "History: 1.02a" ModuleInfo "History: The results of SetBuffer()...EndBuffer() can now be used with Max2D DrawImage, etc." ModuleInfo "History: Copy mode no longer works correctly :( (Going to phase it out as it dosent have any advantages)" I also updated the Render To Texture demo. Download from Here |
| ||
Is this no longer available then? Cheers Charlie |
| ||
Not at the moment. Mess up on my part - uploaded a seriously bugged version and erm, forgot to back up *ducks for cover*. Once the new version is working I'll re-upload. |
| ||
Hi Diablo, Has you got a new link for HighGfx yet? |
| ||
check back in a couple of weeks, im to busy to even help people atm. |
| ||
Errr, two weeks ;) If you think bugged version is unsavable, then sorry for the hasstle. Any news? |
| ||
Yea, its half-term now. I can finally get some true code fixing done |
| ||
Hi. Again three weeks. I'm really looking forward to the release. : ) |
| ||
:P cant do a damm thing atm, I cant upload a single thing ad cant figure out why. Its really annoying me too ! |
| ||
diablo can I use this to add laser images, and would it be possible to test for collision with something created with this module? |
| ||
If you need someone to host the files for you then let me know. Cheers Charlie |
| ||
I don't suppose this is going to be available anytime soon is it? |
| ||
I've got plenty of space if you need somewhere to host it.. |
| ||
I don't suppose this is available anywhere, is it? I've e-mailed Diablo but haven't gotten a response yet. Basically I really want to see how he got the OpenGL framebuffer extension working because I keep getting memory exceptions whenever I try to do anything with them. |
| ||
i have 404 =( |
| ||
Was it OpenGL-only? I get a 404, too... |
| ||
I get a 404, too... Not surprising, since that is what the previous poster got 4 years ago as well. :-? Anyhoo, I uploaded a copy just now since I happened to find it on my drive: http://www.xlsior.org/temp/diablo.mod.zip (It uses DX7 under windows, it seems) |