Quantcast
Channel: cocos2d-x - Cocos Forums
Viewing all 2747 articles
Browse latest View live

RenderTexture ignoring depth buffer

$
0
0

@aoi wrote:

I've been dealing with this for quite a while and came across something very odd so I hope someone here can help me out with this.

I'm using and following this tutorial for post processing effects for Cocos2dx: http://www.babaei.net/blog/2016/01/08/post-processing-effects-in-cocos2d-x/

For simplicity, I'm only using one Post-Processing layer at this point in time (the tutorial uses 2).

I've followed the tutorial (it's essentially copy and pasting code) and have gotten the effect. However, for whatever reason the vertexZ buffering I'm using for the Tiled Maps isn't being applied. (The depth buffering thing here: http://www.cocos2d-x.org/wiki/TileMap)

The vertex shader:

attribute vec4 a_position;
attribute vec2 a_texCoord;
attribute vec4 a_color;
varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
uniform vec2 strokeWidth;
void main()
{
    gl_Position = CC_PMatrix * a_position;
    v_fragmentColor = a_color;
    v_texCoord = a_texCoord;
}

If the fragment shader:

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
void main()
{
    vec4 c = v_fragmentColor * texture2D(CC_Texture0, v_texCoord);
    gl_FragColor = c;
}

How it should look:

How it looks:

Does anyone have any suggestions?

Posts: 2

Participants: 1

Read full topic


cocos3.10 Performance issue caused by SimpleAudioEngine on Android 5.0.2

$
0
0

@lawheihachi wrote:

Device : SM-P900
Android Version : 5.0.2
SimpleAudioEngine::sharedEngine()->playEffect()
Bad performance

It occurs only on the device.
When using the following functions:
This performance degradation occurs.

The problem does not occur during the COCOS 3.4 version.
It occurs after updating to COCOS 3.10 version

http://blog.cocos2d-x.org/2015/04/performance-issue-caused-by-simpleaudioengine-on-android-5-0/

This phenomenon seems to occur again.

Posts: 2

Participants: 2

Read full topic

EGL_BAD_ALLOC crash on some android devices

$
0
0

@dannyhe wrote:

Hi guys, i found crashs on some android devices:

ava.lang.RuntimeException
createWindowSurface failed EGL_BAD_ALLOC
android.view.HardwareRenderer$GlRenderer.createSurface(HardwareRenderer.java:1058)
android.view.HardwareRenderer$GlRenderer.createEglSurface(HardwareRenderer.java:946)
android.view.HardwareRenderer$GlRenderer.initialize(HardwareRenderer.java:780)
android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1696)
android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1125)
android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4607)
android.view.Choreographer$CallbackRecord.run(Choreographer.java:747)
android.view.Choreographer.doCallbacks(Choreographer.java:567)
android.view.Choreographer.doFrame(Choreographer.java:536)
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:733)
android.os.Handler.handleCallback(Handler.java:615)
android.os.Handler.dispatchMessage(Handler.java:92)
android.os.Looper.loop(Looper.java:153)
android.app.ActivityThread.main(ActivityThread.java:5108)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:751)
dalvik.system.NativeStart.main(Native Method)

I think the bug maybe caused by the life cycle of SurfaceView or hardware acceleration.
Does anyone have the same problem?

Posts: 1

Participants: 1

Read full topic

Box2d positioning problem

$
0
0

@nichlaspro132 wrote:

Hi!

I have this code:

b2Body* bodies[3];
 //body definition
    b2BodyDef myBodyDef;
    myBodyDef.type = b2_dynamicBody;
    //shape definition
    b2PolygonShape polygonShape;
    polygonShape.SetAsBox(1, 1); //a 2x2 rectangle
    //fixture definition
    b2FixtureDef myFixtureDef;
    myFixtureDef.shape = &polygonShape;
    myFixtureDef.density = 1;
    //create identical bodies in different positions
    for (int i = 0; i < 3; i++) {
      myBodyDef.position.Set(-10+i*10, 20);
      bodies[i] = m_world->CreateBody(&myBodyDef);
      bodies[i]->CreateFixture(&myFixtureDef);
    }
    //a static floor to drop things on
    myBodyDef.type = b2_staticBody;
    myBodyDef.position.Set(0, 0);
    polygonShape.SetAsEdge( b2Vec2(-15,0), b2Vec2(15,0) );
    m_world->CreateBody(&myBodyDef)->CreateFixture(&myFixtureDef);

But the three generated boxes seem to have been placed way too much to the left?
Like the first one has a x position of lower than 0(I think)
Somebody knows why my box2d objects wont be placed where I suppose they should be?

Thanks

Posts: 4

Participants: 3

Read full topic

Sound effects lag in Android

$
0
0

@jmclaveria wrote:

My game has been lagging with the sound effects in Android since release date, it lags only in some devices though. I have tried tons of things but nothing worked. Many people are complaining about this in Google Play and I don't know how to fix it. It's frustrating because reviews are scored with 1 star despite of the user enjoys the game.

Have tried with AwesomePlayer and Nu Player, and tried with Simple Sound Engine and with the experimental Sound Engine. People plays with sound disabled because the game is unplayable with SFXs.

Is anyone having the same problem as me? I would spend days of work trying to fix the sound engine, but I don't know where to look at because I still don't know which is the thing that causes this lag.

Posts: 1

Participants: 1

Read full topic

Texture2D vs Render Texture performance

$
0
0

@jmclaveria wrote:

Currently my game is overlaping a few textures to draw the main character. Each texture has the same number of frames.

For example, the character is drawn overlapping a frame of a "body" texture, a frame of a "helmet" texture, a frame of a "weapon" texture, etc.

With this configuration I can build a lot of combinations for the character. The player chooses a combination before the game starts.

I was wondering if overlaping all the textures in a render texture on loading screen would increase the performance. Instead of drawing 4 sprites from 4 different textures a single sprite from a render texture would be drawn.

What do you think? Any tip will be appreciated smile

Posts: 5

Participants: 3

Read full topic

Android linker error (NDK10e) Undefined reference to cocos2d::ui

$
0
0

@rob_type25 wrote:

Hey

I was having issues some sdkbox and some random crashes so decided to upgrade to ndk10c.

I'm now having linking errors when using cocos2d::ui

error: undefined reference to 'cocos2d::ui::ListView::scrollToItem(int, cocos2d::Vec2 const&, cocos2d::Vec2 const&)

and

error: undefined reference to 'cocos2d::Sprite::setDisplayFrameWithAnimationName(std::string const&, int)

My android.mk file looks like this:

    LOCAL_PATH := $(call \
my-dir)

include $(CLEAR_VARS)

$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d)
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/cocos)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/extensions)
$(call import-add-path, $(LOCAL_PATH))

LOCAL_MODULE := cocos2dcpp_shared


FILE_LIST := $(wildcard $(LOCAL_PATH)/../../../Classes/*.cpp)
FILE_LIST += $(wildcard $(LOCAL_PATH)/../../../Classes/*.c)

LOCAL_SRC_FILES := hellocpp/main.cpp \
LOCAL_SRC_FILES += $(FILE_LIST:$(LOCAL_PATH)/%=%)

LOCAL_MODULE_FILENAME := libcocos2dcpp

LOCAL_CPPFLAGS := -DSDKBOX_ENABLED
LOCAL_LDLIBS := -landroid \
-llog
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../cocos2d
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../cocos2d/cocos
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../cocos2d/cocos/ui
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../cocos2d/external
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../cocos2d/extensions

LOCAL_WHOLE_STATIC_LIBRARIES := PluginFacebook \
sdkbox \
PluginSdkboxAds \
PluginAdColony \
PluginChartboost

LOCAL_STATIC_LIBRARIES := cocos2dx_static
LOCAL_STATIC_LIBRARIES += cocos_extension_static
LOCAL_STATIC_LIBRARIES += cocos_ui_static
LOCAL_STATIC_LIBRARIES += cocos_external_static

LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static

# _COCOS_HEADER_ANDROID_BEGIN
# _COCOS_HEADER_ANDROID_END



# _COCOS_LIB_ANDROID_BEGIN
# _COCOS_LIB_ANDROID_END

include $(BUILD_SHARED_LIBRARY)

$(call import-module,.)
$(call import-module, ./sdkbox)
$(call import-module, ./pluginfacebook)
$(call import-module, ./pluginsdkboxads)
$(call import-module, ./pluginadcolony)
$(call import-module, ./pluginchartboost)
$(call import-module,extensions)
$(call import-module,ui)


# _COCOS_LIB_IMPORT_ANDROID_BEGIN
# _COCOS_LIB_IMPORT_ANDROID_END

Does anyone know what i need to do to fix this problem?

Thanks

Posts: 3

Participants: 2

Read full topic

Supporting IPv6-only Networks


cocos2d-x 3.11, prebuild cocos2d-x libs failed!

$
0
0

@yixiaoqingyuz wrote:

This is the error message:
/Applications/Cocos/Cocos2d-x/cocos2d-x-3.11/tools/simulator/frameworks/runtime-src/proj.android/../../../../..//tools/simulator/libsimulator/proj.android/../lib/ProjectConfig/ProjectConfig.cpp:24: error: relocation overflow in R_ARM_THM_CALL
/Applications/Cocos/Cocos2d-x/cocos2d-x-3.11/tools/simulator/frameworks/runtime-src/proj.android/../../../../..//tools/simulator/libsimulator/proj.android/../lib/ProjectConfig/ProjectConfig.cpp:26: error: relocation overflow in R_ARM_THM_CALL
collect2: error: ld returned 1 exit status
make: *** [obj/local/armeabi/libcocos2dlua.so] Error 1
make: Leaving directory `/Applications/Cocos/Cocos2d-x/cocos2d-x-3.11/tools/simulator/frameworks/runtime-src/proj.android'
Error running command, return code: 2.
Error running command, return code: 14.

Posts: 3

Participants: 2

Read full topic

Jenkins build failed for mac - Unexpected termination of the channel

$
0
0

@alecmilne wrote:

I am trying to get a small PR through for an added function for the experimental webview class. This is to allow the user to stop the annoying grey over-scroll in iOS.

I have implemented the methods for ios, android, tizen, all building fine for them all, but I have had a problem with the mac build, that was passing fine for earlier commits. Later commits were just on the android / tizen files, so a bit confused as to why they are now failing for mac.

Link to PR:
PR15623

Copy/Paste from end of Jenkins mac console output:
Removing tools/fbx-conv/
Removing tools/tojs/userconf.ini
Removing tools/tolua/userconf.ini
Removing v3-deps-93.zip
Slave went offline during the build
ERROR: Connection was broken: java.io.IOException: Unexpected termination of the channel
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:50)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2325)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2794)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:801)
at java.io.ObjectInputStream.(ObjectInputStream.java:299)
at hudson.remoting.ObjectInputStreamEx.(ObjectInputStreamEx.java:48)
at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)

Build step 'Execute Python script' marked build as failure
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: FAILURE

Posts: 2

Participants: 2

Read full topic

Cocos2dX and El Capitan OS X

$
0
0

@luke2125 wrote:

Hi,

I'm thinking of updating my OS X from Yosemite to El Capitan, are there any known issues regarding Cocos 2dx V 3.11 or Cocos Creator? Would appreciate any feedback from developers.....Thanks and God Bless....

Sincerely,

Sunday

Posts: 2

Participants: 2

Read full topic

Cocos Particles Architect for Windows

$
0
0

@miguellara78 wrote:

Hi community,
So I have Particle Designer in my Mac, but I usually code most of the time in my Windows Machine which has much more power for all the stuff I am working on at the time, and all my computers at the office are Windows,

Since Particle Designer only runs in a Mac, when I code on Windows I either have to login in my Mac and work on certain particle effect or I have to use the tool located at: http://particle2dx.com/ which is great, but who knows how long it will survive online.

I always wanted a Particle Designer for Windows but options are very old and limited, so I decided to Code my own solution so I can have something I can create my particles effects native in Windows, and without having to worry if it would still exist online or not, plus it is helping me to practice my C++ skills smile .

Anyway, once I finish it I was wondering if there would be any interest or need for it in the community? If there is any interest, I will create a link for it so you guys can give it a try and use it for your needs. It is still in a very early state, but it is fully functional already, I just have to make it a little prettier with some graphics I am working on already and I can release it most likely by the end of the week, and just add more features in the future.

Let me know, Tks.

A couple shots of it, still not completed, still have to make it better looking, but it is getting there:

Posts: 6

Participants: 3

Read full topic

Cocos2d-x and poor updates!

$
0
0

@b12345 wrote:

Hello Everyone,

For the past several months I’ve been completely disappointed in the releases for cocos2d-x.
I don’t mean to disrespect the cocos2d-x team, But here are some issues that you guys need to consider. Since September 17th (approx. 8 months) there has been 3 releases of cocos2dx. The past 8 months, these releases didn’t even have major changes in them according to me. It seems to me that every release you guys focus on removing retain/release (Highlight of the Release) from cocos2d-x which is not even significant according to some other problems with cocos2d-x. On the other it is great that you have updated to chipmunk 7.0 and released support for Tizen.

1:Android performance is clearly not up to mark.

Most users of cocos2dx use it for iOS and Android. Android has major performance issues with cocos2dx that really need your attention. Unity on the other doesn’t have such major issues.

There have been countless posts on this issue, and it has yet to be addressed. Several of many are mentioned below.
























1 -2:I’ve also addressed this issue a few times. Here’s one.

In this post I’ve mentioned a few things which might be causing the problem. No fix was applied to later versions.

2: Will we see full gradle support anytime soon?

3: Current 3d support, makes it near impossible to start a big game for 3d.

4: Apple tv support, Not a difficult task for you guys and a lot of people are asking for this.

There are still over 350 warnings in the code... will it remain this way?
Trello: Last updated on March 17-21st. and before that Feb 22.

I hope you guys find this post useful.

Thanks!

Posts: 3

Participants: 3

Read full topic

Google Play submit rejected because of violates the malicious behavior policy

$
0
0

@forget721 wrote:

Anyone help me.

I use cocos2d-x 2.2.6, sdkbox-admob_v2.2.0.12_for_v2, sdkbox-chartboost_v2.2.0.12_for_v2, sdkbox-review_v2.2.0.12_for_v2

My game is rejected with below messages:

I reviewed your app, and had to reject it because it violates the malicious behavior policy. If you submitted an update, the previous version of your app is still live on Google Play.

Here’s how you can submit your app for another review:

Make the appropriate changes to your app. We determined that your app degrades a user’s device security by modifying or disabling SELinux on the device. Apps that introduce or exploit security vulnerabilities are explicitly prohibited.
Read through the Malicious Behavior policy for more details.
Make sure your app is compliant with all other policies listed in the Developer Program Policies. Remember that additional enforcement could occur if there are further policy issues with your apps.
Sign in to your Developer Console and submit the modified, policy compliant APK. Make sure to increment the version number of the APK.

Posts: 2

Participants: 2

Read full topic

Box2D loosing object speed C++

$
0
0

@JohnMiz wrote:

Hello,

I am trying for a long time to finish a clone of the game brick breaker.
I am having trouble with the speed of my ball, I searched all over the internet and could not get the desirable solution.
All I want is to make the ball move in constant velocity for all over the time without any changes.

When the ball is colliding with the paddle:

Vec2 vel = ballBody->getVelocity();
vel.x = (ball_center - paddle_center) * 7.5;
vel.y = -vel.y;
ballBody->setVelocity(vel);

When the ball is colliding with brick:

Vec2 vel = ballBody->getVelocity();
vel.x = vel.x;
vel.y = -vel.y;
ballBody->setVelocity(vel);

I tried almot everything.

Thanks for help!

Posts: 3

Participants: 2

Read full topic


Confused on where to start

$
0
0

@Glidos wrote:

I have a completed cocos2d-iphone game. I'm looking to port to Android. I've heard good things about Lua, but I'm struggling to find out what the current state of Lua support is in cocos2d-x. I've downloaded the cocos2d-x package and followed the installation instructions. cpp-tests is building successfully. I've looked around for the IDE called Code but it looks like that is no longer the best choice. I've seen forum posts that suggest I should download the cocos package and that will include Cocos Studio which supports Lua development. Is that right? Is that what people use? Should I delete what I've already downloaded?

I also cannot find Lua API documentation, only C++ JS. It makes me wonder whether Lua is a serious option.

Any advice much appreciated.

Posts: 1

Participants: 1

Read full topic

About SpriteIIIuminator, how to set point light type?

$
0
0

@rickystone wrote:

hi guys: i want to know how to set point light type in spriteIIIumnator, can somebody know it ? thanks:)

Posts: 6

Participants: 3

Read full topic

Cocos2d-x 2.2.6

[Help] Pause and Resume Game

$
0
0

@jecheonDaeseong wrote:

I want to implement pause and resume in my game, but it seems, i can't find a proper way in cocos v3.0. Actually i've found some way in for and google but most of it using oldest version of cocos and how to implement in cocos button newest version. If anyone has an solution method of pausing the game that'd be great.

Posts: 4

Participants: 2

Read full topic

Dust particle effect

$
0
0

@shipit wrote:

Hey guys,

I've been having lot of fun with particle effects. I have a cinematic scene where a book drops on a table, I want to display a little dust when the book hits the table. Can someone please point me to a good starting point with the particle system?

Thanks a lot!

Posts: 1

Participants: 1

Read full topic

Viewing all 2747 articles
Browse latest View live