Page 1 of 1

4.30 Drawing to screen or sprite with opengl subsystem

Posted: Fri Dec 26, 2008 1:23 pm
by Anonymous
I wan't to draw directly on screen or sprite with this :

Code: Select all

StartDrawing()
I use opengl subsystem (for sprite3D) , we can't draw directly on the screen , then i wan't do draw on standard sprite. but , i have an error message : the spécified output is null.
The sprite as been created , it's not null.
i don't understand the problem. bug ?

Posted: Fri Dec 26, 2008 2:53 pm
by freak
Drawing on the screen/sprite is not supported with OpenGL.

http://www.purebasic.com/documentation/ ... cific.html

Posted: Fri Dec 26, 2008 3:57 pm
by Anonymous
yes , i know, but i want draw on standard pixel ( not sprite3D ) is not possible because opengl subsystem is activated ?
with opengl subsystem we can't draw image on the screen ?

Posted: Fri Dec 26, 2008 4:04 pm
by Anonymous
With OpenGL subsystem , Purebasic use SDL ?
if yes , where i can grab the pointer of SDL_Surface ?

Posted: Sat Jan 03, 2009 5:41 am
by GBeebe
*pointer.sdl_surface = SpriteID(sprite) for sprites
*pointer.sdl_surface = ScreenID() for screen

all the pixel data is then in *pointer\pixels

Posted: Sun Feb 01, 2009 9:51 am
by Philippe-felixer76-2
GBeebe wrote:*pointer.sdl_surface = SpriteID(sprite) for sprites
*pointer.sdl_surface = ScreenID() for screen

all the pixel data is then in *pointer\pixels
And is it possible to change the pixels realtime? Yes? How???

Posted: Sun Feb 01, 2009 10:49 am
by DarkDragon
Here is the best solution ever:

http://www.purebasic.fr/english/viewtop ... 854#248854

:lol:

I could also try to make it possible to draw directly on the screen. But it would also result in a code like this.

[EDIT]
Just noticed, that this code doesn't work right anymore. But it worked in PB 4.30 beta somenumber.

Posted: Sun Feb 01, 2009 4:37 pm
by Philippe-felixer76-2
DarkDragon wrote:Here is the best solution ever:

http://www.purebasic.fr/english/viewtop ... 854#248854

:lol:

I could also try to make it possible to draw directly on the screen. But it would also result in a code like this.

[EDIT]
Just noticed, that this code doesn't work right anymore. But it worked in PB 4.30 beta somenumber.
Ill check it out, tnx!

Posted: Tue Feb 24, 2009 7:48 am
by GBeebe
How do I take that sprite after i've drawn on it and make a sprite3d out of it?

Posted: Thu Feb 26, 2009 3:01 pm
by Anonymous
Philippe-felixer76-2 wrote:
GBeebe wrote:*pointer.sdl_surface = SpriteID(sprite) for sprites
*pointer.sdl_surface = ScreenID() for screen

all the pixel data is then in *pointer\pixels
And is it possible to change the pixels realtime? Yes? How???

Try this :

Code: Select all

InitSprite()

OpenWindow(0,0,0,800,600,"")
	OpenWindowedScreen(WindowID(0),0,0,800,600,0,0,0)

CreateSprite(0,256,256)
	
	
	Repeat
		Event = WindowEvent()
			ClearScreen($FF00FF)
	

	*pointer.sdl_surface = SpriteID(0)
	
	For x = 0 To 256-1
		For y = 0 To 256-1
		
		; Operation for GET or PUT any data in memory :
		; Memory + ( x * DataOffset ) + MemoryWidth * ( y* DataOffset )    
		; if is Memory structured :
		; (Memory + ( x * DataOffset ) + MemoryWidth * ( y* DataOffset )  ) + OffsetOf( Structure\Data )
		
	    PokeL(*pointer\Pixels + (x*4) + 256 * (y*4),RGB(x*255/64,x*255/64,y*255/64))
		Next 
	Next 
	
	
	DisplaySprite(0,100,100)
	
	 		FlipBuffers()
	Until Event = #PB_Event_CloseWindow