Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I would like to know the best way on how to implement horizontal scrolling to only part of the view and vertical scrolling to complete view. I was able to achieve horizontal and vertical scrolling to the complete view. If I have to use layers can you explain a bit more on how to achieve layers and draw shapes on those layers separately.

I tried using two different SurfaceViews it does not work. Here is my code for scrolling horizontally.

@Override public void onDrawFrame(GL10 unused) {

GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);

// Set the camera position (View matrix)
Matrix.setLookAtM(mVMatrix, 0, mXOffset, mYOffset, -3, mXOffset, mYOffset, 0f, 0.0f, 1.0f, 0.0f);


// Calculate the projection and view transformation
Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mVMatrix, 0);

mGraph.draw(mMVPMatrix);

mLine.draw(mMVPMatrix);
msquare.draw(mMVPMatrix);

}
share|improve this question
    
Are we talking about limiting camera movement or are we talking about drawing some parts of the screen always at the same position (like UI elements)? –  Mario Jan 24 '13 at 23:10
    
Thanks for the reply mario. I am not sure but i am guessing restricting the camera movement would be the one but in any case here is my scenario. I have a graph with multiple lines parllel to x-axis with diff y values. Each line has 3 buttons. I want to scroll only the graph not the buttons if the user scrolls Horizontally. If the User scrolls vertically both the buttons and graph has to be scrolled. –  deepu Jan 25 '13 at 15:15

1 Answer 1

Turns Out My Emulator wasn't working fine but the answer is just have a new Model Matrix created for the buttons without the x offset value in the model matrix.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.