Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Kyo

#16
Hi,
when I read one pixel of a sprite with this system:
Code (glbasic) Select

LOADSPRITEMEM("1.png", w2%, h2%, pixels[])
FOREACH pix IN pixels[]
FOR x% = 0 TO value_palette
IF pix = memo[x][0]
pix =  memo[x][1]
BREAK
ENDIF
NEXT
        NEXT


the var pix return this value: -5462343
I have to convert in Hex (Exmple: #000301), it's possible?
#17
Quote from: kanonet on 2014-Oct-29
If you dont post your shader code, we cant tell you whats wrong with them. BTW you can not just copy a shader from somewhere else and expect it to work, you need to code it correctly, which means you need to learn the OpenGL shader language GLSL.

I use the sample test on the site: http://www.glbasic.com/showroom.php?site=games&game=C64colorshader

But if I lock the commands:

Code (glbasic) Select

// --------------------------------- //
// Project: C64izer
// Start: Tuesday, March 25, 2008
// IDE Version: 5.212


LOADBMP "test.png"
//X_LOADSHADER(0, "", "C64izer.frag")


DRAWRECT 0,0,64,64,RGB(0,255,0)
DRAWRECT 0,0,32,32,RGB(0,0,255)
DRAWRECT 32,32,32,32,RGB(255,255,255)
PRINT "C64", 8,8
GRABSPRITE 0,0,0,64,64

// C64izeOld()

WHILE TRUE
ROTOZOOMSPRITE 0, 140,100, GETTIMERALL()/20, SIN(GETTIMERALL()/37)+1

C64ize()
SHOWSCREEN
WEND


FUNCTION C64ize:
// Grab the 320x240 image from screen
GRABSPRITE 1000, 0,0, 320,240

// Make smooth downscaling for better quality
SMOOTHSHADING TRUE

// Set the C64 color shader
// X_SETSHADER 0

// draw the sprite 160x240 with C64 colors
STRETCHSPRITE 1000, 0,0,160,240
// unlink the shader - we're done
// X_SETSHADER -1

// grab the image 160x240
GRABSPRITE 1000, 0,0,160,240

// make hard pixels for final output
SMOOTHSHADING FALSE
// stretch by factors 4x2 -> C64 has 2 neighbored pixels of same color
STRETCHSPRITE 1000,0,0,640,480
ENDFUNCTION




so I dont understand what makes the shader!

I also tried to use this shader for Black / White (greyscale):
Code (glbasic) Select

precision lowp float;
varying vec2 v_texCoord;
uniform sampler2D u_texture;

void main()

{

    vec4 normalColor = texture2D(u_texture, v_texCoord);
    float gray = 0.299*normalColor.r + 0.587*normalColor.g + 0.114*normalColor.b;
    gl_FragColor = vec4(gray, gray, gray, normalColor.a);

}


but the result does not change!
#18
GLBasic - en / Shader Info
2014-Oct-29
Hi,

I test this example of shader (C64colorshader):

Code (glbasic) Select

// --------------------------------- //
// Project: C64izer
// Start: Tuesday, March 25, 2008
// IDE Version: 5.212


LOADBMP "test.png"
X_LOADSHADER(0, "", "C64izer.frag")


DRAWRECT 0,0,64,64,RGB(0,255,0)
DRAWRECT 0,0,32,32,RGB(0,0,255)
DRAWRECT 32,32,32,32,RGB(255,255,255)
PRINT "C64", 8,8
GRABSPRITE 0,0,0,64,64

// C64izeOld()

WHILE TRUE
ROTOZOOMSPRITE 0, 140,100, GETTIMERALL()/20, SIN(GETTIMERALL()/37)+1

C64ize()
SHOWSCREEN
WEND


FUNCTION C64ize:
// Grab the 320x240 image from screen
GRABSPRITE 1000, 0,0, 320,240

// Make smooth downscaling for better quality
SMOOTHSHADING TRUE

// Set the C64 color shader
X_SETSHADER 0

// draw the sprite 160x240 with C64 colors
STRETCHSPRITE 1000, 0,0,160,240
// unlink the shader - we're done
X_SETSHADER -1

// grab the image 160x240
GRABSPRITE 1000, 0,0,160,240

// make hard pixels for final output
SMOOTHSHADING FALSE
// stretch by factors 4x2 -> C64 has 2 neighbored pixels of same color
STRETCHSPRITE 1000,0,0,640,480
ENDFUNCTION


But if i delete all shader command the result it's the same, it's the STRETCHSPRITE command which has the effect C64 style!

I test with other .frag but the result don't change.

I would like to get the 2D effects (on sprites) as:
- Black / White (greyscale)
- Distortion
etc.

It's possible? and how?
#19
Quote from: Ian Price on 2014-Oct-04
Depends on the hardware, but I wouldn't go any larger than that (2048x2048). You can also use multiple anim strips if the animation is too large. You can also use online tools to scale the anim down too.

Have you looked into why that GIF routine is failing on Android devices? Are you sure the GIF is being found?
I think .... have used a large stip gif (4096x4096) tomorrow I test 2048x2848 .....  :S
#20
Quote from: Ian Price on 2014-Oct-03
What you can do is rip the GIF animation into a strip (there are online tools for this - I used such a tool recently, with acceptable results), and display with DRAWNIM. Not exactly GIF support for mobiles etc. but guaranteed to work.
It's great idea, but what is the maximum size supported? 2048x2048???
#21
GL_B support Animated Gif?

I found this http://www.glbasic.com/forum/index.php?topic=8472.msg71729#msg71729
but not work on Android (i not test on iphone).

Gif is great for create animated presentation (example for Logo).

Thanks for help  ;)
#22
Quote from: TheMapChap on 2014-Sep-26
It could well need a substantial upgrade.
I never put my hands on a wrapper....
you think it's difficult????
#23
But not is easier more to fix the wrapper iad for ios 8?
#24
Quote from: Kitty Hello on 2014-Sep-24
Search for tritri collision. I have such a function. Somewhere...

Gesendet von meinem GT-N7100 mit Tapatalk



In gl_b forum I can't find ...
sure that the name is tritri collision?
#26
Quote from: spacefractal on 2014-Sep-23
Its would been nice a ios ads could been supported extractly same way im did with Android Extras, so the functions can been reused.
support the request! =D

But no one knows how to update the wrapper of iAd??
It's very difficult?  :blink:

http://www.glbasic.com/forum/index.php?topic=5932.0
#27
Quote from: mentalthink on 2014-Sep-23
Hi Kyo in my game I use circles and box collision(without rotating), because you can do any collision with this 2 shapes or aproximate to any shape.

I did an Collision Editor and if I want an especific collision I paint them.

If you need more help about this comment me, I think I have the code well ordened and not problem to give you.

For  circles and box collision(without rotating) I have no problem.
But for isometric game I have to use or box with rotation or shape zone.

Quote from: Moru on 2014-Sep-23
Have a try with these:
http://gamedevelopment.tutsplus.com/tutorials/collision-detection-using-the-separating-axis-theorem--gamedev-169
http://www.wildbunny.co.uk/blog/2011/04/20/collision-detection-for-dummies/

Thanks, now I study this!  :good:

#28
Quote from: Moru on 2014-Sep-23
Short answer: No.

Long(er) answer: Depends on what you want to do :-)

You could draw the objects on a sprite and then do pixel perfect collision detection on the sprites.

I don't want to use the pixel perfect collision because it's slow on big images!
The best way is definitely the shape collisions, so if anyone can help me with the code I would be grateful  :nw:
#29
Technically it seems simple, but make it happen not is easy!  :blink:
#30
Hi Guys!
I want to give you a few questions on collisions!

there is a function to calculate the collision between two triangles??


there is a function to calculate the collision between two rotated rectangles?


and if I want to use the shape collisions?


Thanks for help!