Oxygen Basic
Programming => Example Code => Topic started by: Peter on April 17, 2011, 09:44:47 AM
-
Deleted
[attachment deleted by admin]
-
Well done Peter. You have cracked it!
My fruitfly response :) Some adjustments to be made but I have compiled it for independent running.
It demonstrates binding to multiple images and and a procedure to make the background transparent from a jpg or png with a whitish background color.
Charles
[attachment deleted by admin]
-
Hi Peter,
Your Opengl example runs smoothly in Ubuntu/Wine and reports 80FPS.
In Vista we get 59.99999999999 Frames per sec :) You can fix this by doing "finit" after choose pixel format. It nobbles the FPU but I see this does not appear to happen under Wine/Linux.
Charles
-
Peter,
Choose Pixel Format tampers with the FPU control registers. I have not investigated this in detail but it is not good practice. The fpu should be returned to its original state, and it should not be necessary to reinitialise it.
I think 80FPS might be an upper limit. The frame rate is noticibly slower when there is more work to do between frames
Charles
-
Peter,
What is the handle or the address of the double buffer?
That is not hRC ! isn't it?
Opengl provides access to several buffers including the frame buffer. These are in the Graphics memory, not directly accessible by the CPU so these functions involve transferring data to and from the graphics card to a block in main memory.
glReadPixels
http://www.opengl.org/sdk/docs/man/xhtml/glReadPixels.xml
glDrawPixels
http://www.opengl.org/sdk/docs/man/xhtml/glDrawPixels.xml
glReadBuffer
http://www.opengl.org/sdk/docs/man/xhtml/glReadBuffer.xml
But most processing is done with vectors describing surfaces and all pixel creation is left to the graphics hardware.
Sprites are treated as textures "stretched" over a flat surface, the simplest being a triangle or a quad.
Charles
-
Hi Peter,
examples/GUI/OpenglWin2.o2bas reveals all the code needed to implement textures (using GDIplus). If you search through this file looking for "texn" you will find all the code involved in image loading, texture creation, texture handles, texture enabling, texture binding and texture deletion.
the first 2 procedures in inc/glo2/texture.inc are used to create the texture.
Unlike GDI GDIplus must first be initialised before access. Then it must be shut down at the end.
As you can see, there are many stages to go through before you get a texture to appear on an object.
Charles