[QUOTE=JohnnyOnFlame;36557088]No dude, like, I can enable/disable it, and it works.
But problem is, that can only be done on the Java part of my app, when I really need it to work on the native, glEnable/Disableing it gives me nothing on native, while it DOES on the java part.[/QUOTE]
That doesn't make any sense because you definitely need a depth buffer to do depth tests. Taken from the OpenGL 3.3 reference pages: "GL_DEPTH_TEST: If enabled, do depth comparisons and update the depth buffer." I don't know what you mean by the java part of your app and the native but if your successfully enabling it then something it automatically creating a depth buffer most likely. Also: "glDepthFunc specifies the function used to compare each incoming pixel depth value with the depth value present in the depth buffer." This may be your problem. Make sure you call that function at some point. I'm pretty sure it has a default setting but it couldn't hurt trying.
[QUOTE=flayne;36557567]That doesn't make any sense because you definitely need a depth buffer to do depth tests. Taken from the OpenGL 3.3 reference pages: "GL_DEPTH_TEST: If enabled, do depth comparisons and update the depth buffer." I don't know what you mean by the java part of your app and the native but if your successfully enabling it then something it automatically creating a depth buffer most likely. Also: "glDepthFunc specifies the function used to compare each incoming pixel depth value with the depth value present in the depth buffer." This may be your problem. Make sure you call that function at some point. I'm pretty sure it has a default setting but it couldn't hurt trying.[/QUOTE]
It is already called, thing is, the problem is not in the code, this is tested and works.
The problem is in the way android does it. What I need is a way to overcome that or expose the gl.glEnable/Disable functions so that I can call the java ones from C.
[QUOTE=JohnnyOnFlame;36557846]It is already called, thing is, the problem is not in the code, this is tested and works.
The problem is in the way android does it. What I need is a way to overcome that or expose the gl.glEnable/Disable functions so that I can call the java ones from C.[/QUOTE]
Sorry I'm just not understanding your problem. You are trying to use OpenGL ES and when you call glEnable(GL_DEPTH_TEST) it doesn't work is what I'm getting. First what exactly is and isn't happening in your app. Btw Depth buffer creation should be done when you create the OpenGL context, there should be some kind of option that allows you to specify bit depth and if it's not set to zero OpenGL will create one.
[QUOTE=flayne;36558138]Sorry I'm just not understanding your problem. You are trying to use OpenGL ES and when you call glEnable(GL_DEPTH_TEST) it doesn't work is what I'm getting. First what exactly is and isn't happening in your app. Btw Depth buffer creation should be done when you create the OpenGL context, there should be some kind of option that allows you to specify bit depth and if it's not set to zero OpenGL will create one.[/QUOTE]
Apps on Android can have two approaches, pure java or Java+Binary Library.
I'm using the Java+LIB approach, what happens is that java does part of the work, and then you set the videomode and other stuff on the Library part.
If you do glEnable on the java side of things, it will work.
If you do glEnable on the native side of things... well, nothing happens, no errors and no depth testing either.
what is funny is that it ACTUALLY WORKS. If enabled on java side, it is.
What I need is either a way of doing the depth test by other means, or expose the gl object to the native side so I can call its members.
[QUOTE=JohnnyOnFlame;36558391]Apps on Android can have two approaches, pure java or Java+Binary Library.
I'm using the Java+LIB approach, what happens is that java does part of the work, and then you set the videomode and other stuff on the Library part.
If you do glEnable on the java side of things, it will work.
If you do glEnable on the native side of things... well, nothing happens, no errors and no depth testing either.
what is funny is that it ACTUALLY WORKS. If enabled on java side, it is.
What I need is either a way of doing the depth test by other means, or expose the gl object to the native side so I can call its members.[/QUOTE]
I don't know it sounds like something automated is happening (like the creation of a depth buffer) on one side and not the other. You say there are these two different approachs. I'm not sure if there is multithreading involved but you may not have a proper context set current for one side of it. Beyond that I really don't know.
What is the proper way to dynamically allocate a two dimensional int array in C?
Here is the code I have right now:
[code]
int **players;
...
//Because players is 2D, we first have to allocate space for the first dimension consisting of int pointers
players = (int **) malloc(num_players * sizeof(int *));
//Then we can fill in each index with the actual memory pointers to our ints
for(i=0; i < num_players; i++)
{
players[i] = (int *) malloc(NUM_ATTRIBS);
}
[/code]
When it was statically declared it I used:
[code]
int players[num_players][NUM_ATTRIBS];
[/code]
Hey, this is quite a general question. I want to make a relatively simple looking user interface for a program I am working on. I am wondering does anyone know what was used to make the Zune software interface? Is it something that is on .net or no? And if not what would be the best way to emulate such an interface? I was looking at processing and java.
It seems like it is working fine, I've just never done this in the past and wanted to be sure I wasn't making some grave error :v:
[editline]29th June 2012[/editline]
mah automerge
[QUOTE=Rayjingstorm;36558851]What is the proper way to dynamically allocate a two dimensional int array in C?
Here is the code I have right now:
[code]
int **players;
...
//Because players is 2D, we first have to allocate space for the first dimension consisting of int pointers
players = (int **) malloc(num_players * sizeof(int *));
//Then we can fill in each index with the actual memory pointers to our ints
for(i=0; i < num_players; i++)
{
players[i] = (int *) malloc(NUM_ATTRIBS);
}
[/code]
When it was statically declared it I used:
[code]
int players[num_players][NUM_ATTRIBS];
[/code][/QUOTE]
I would only use static versions, but basically you have done it correctly as far as I am aware. I wouldn't recommend doing that though because it wastes a lot of extra space. Unfortunately you simply can't treat a pointer pointer as a static two dimensional array. I would do the following:
[cpp]
int *players = malloc(NUM_ATTRIBS * NUM_PLAYERS);
//Assume we are using row majoring like normal two dimensional arrays
//When we need to access instead of this:
//players[player][attrib] = 2;
//We use this:
players[player + attrib*NUM_PLAYERS] = 2; //Since NUM_PLAYERS is effectively number of columns
[/cpp]
[QUOTE=flayne;36558941]I would only use static versions, but basically you have done it correctly as far as I am aware. I wouldn't recommend doing that though because it wastes a lot of extra space. Unfortunately you simply can't treat a pointer pointer as a static two dimensional array. I would do the following:
[cpp]
int *players = malloc(NUM_ATTRIBS * NUM_PLAYERS);
//Assume we are using row majoring like normal two dimensional arrays
//When we need to access instead of this:
//players[player][attrib] = 2;
//We use this:
players[player + attrib*NUM_PLAYERS] = 2; //Since NUM_PLAYERS is effectively number of columns
[/cpp][/QUOTE]
This makes a lot of sense actually. The map itself is a 1D array of characters representing a 2D map because it was just as easy to check for the end of a row (when the next index is divisible by the width) and to move up and down, left and right (+width, -width, ++, --) but I didn't think about something similar for the players array. Right now I barely even need the multiple dimensions: I'm only keeping track of a position and direction but it just seemed a little more aesthetically pleasing to use the two dimensional syntax ( players[index][POS] and players[index][DIR] instead of player_pos[index] player_dir[index]). Is there any way to use the same syntax ([][]) to access an array allocated as you suggest? I suppose it isn't a big gripe but it's worth an ask.
[QUOTE=flayne;36558799]I don't know it sounds like something automated is happening (like the creation of a depth buffer) on one side and not the other. You say there are these two different approachs. I'm not sure if there is multithreading involved but you may not have a proper context set current for one side of it. Beyond that I really don't know.[/QUOTE]
Trust me, that's not the case, in the case you activate the DEPTH_TEST flag in the Java side of things, you wont be able to disable it on native.
[QUOTE=JohnnyOnFlame;36559170]Trust me, that's not the case, in the case you activate the DEPTH_TEST flag in the Java side of things, you wont be able to disable it on native.[/QUOTE]
Do other OpenGL functions work well on native?
[QUOTE=flayne;36559267]Do other OpenGL functions work well on native?[/QUOTE]
Besides a few issues that need some polishing, you can play the game quite well (if you ignore the fact that you have something like a malfunctioning wallhack at all moments)
Which means that enabling stuff like scissors, alpha tests and other stuff seems to be working, or else you'd have weird stuff like sprites with black borders and the like.
edit:
Yeah, ended up fixing it all, no more help needed, thanks tho
More of a design question, but would a 640x480 screen size with 16x16 tiles and 16x32 characters be appealing to the eye?
[QUOTE=WTF Nuke;36572236]More of a design question, but would a 640x480 screen size with 16x16 tiles and 16x32 characters be appealing to the eye?[/QUOTE]
Resolution and tile size don't matter anywhere near as much as the actual graphical content. Why don't you try it out and see? :)
Then I shall!
I tried to follow [url]http://open.gl/drawing[/url] in OpenTK, but I get an access violation on [I]GL.DrawElements(BeginMode.Triangles, 6, DrawElementsType.UnsignedInt, 0);[/I].
Using [I]GL.DrawArrays(BeginMode.TriangleFan, 0, 4);[/I] instead works.
Code:
[csharp]class Program
{
static void Main(string[] args)
{
new OpenTKGameWindow().Run();
}
}[/csharp]
OpenTKGameWindow: [URL="http://pastebin.com/5FHNL8h9"]http://pastebin.com/5FHNL8h9[/URL]
The method call is near the end, in [I]protected override void OnRenderFrame(FrameEventArgs e){ ... }[/I].
[QUOTE=Tamschi;36578066]I tried to follow [url]http://open.gl/drawing[/url] in OpenTK, but I get an access violation on [I]GL.DrawElements(BeginMode.Triangles, 6, DrawElementsType.UnsignedInt, 0);[/I].
Using [I]GL.DrawArrays(BeginMode.TriangleFan, 0, 4);[/I] instead works.
Code:
[csharp]class Program
{
static void Main(string[] args)
{
new OpenTKGameWindow().Run();
}
}[/csharp]
OpenTKGameWindow: [URL="http://pastebin.com/5FHNL8h9"]http://pastebin.com/5FHNL8h9[/URL]
The method call is near the end, in [I]protected override void OnRenderFrame(FrameEventArgs e){ ... }[/I].[/QUOTE]
It's because you don't have a bound GL_ELEMENT_BUFFER which stores the vertex indices.
[QUOTE=flayne;36578972]It's because you don't have a bound GL_ELEMENT_BUFFER which stores the vertex indices.[/QUOTE]
Line 50 on the pastebin binds a VBO to GL_ELEMENT_ARRAY_BUFFER, and there are no bind buffer calls after that.
[QUOTE=flayne;36578972]It's because you don't have a bound GL_ELEMENT_BUFFER which stores the vertex indices.[/QUOTE]
[QUOTE=robmaister12;36579204]Line 50 on the pastebin binds a VBO to GL_ELEMENT_ARRAY_BUFFER, and there are no bind buffer calls after that.[/QUOTE]
That was it, [I]GL.BindVertexArray[/I] apparently resets that binding too.
I am trying android programming, and while following this tutorial [url]http://developer.android.com/training/basics/firstapp/building-ui.html[/url] I ran into a problem. I set the orientation to horizontal, and create a text box and a button, however the button overlaps the text box. Isn't it supposed to be shown after the text box? This is my layout:
[code]<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<EditText android:id="@+id/edit_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/edit_message" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send" />
</RelativeLayout>
[/code]
[B]EDIT[/B] Fixed it by changing the layout to linear.
Hey guys, I just came back from like a 4 month programming break and I'm already remembering why. I started fresh on a new Windows 7 install, installed Code::Blocks with the bundled MinGW build and downloaded the OgreSDK v1.8.0. I then followed [url=http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Setting+Up+An+Application+-+CodeBlocks]this[/url] tutorial and managed to compile everything without problems, however when I run the application, I get this:
[quote]The program can't start because libgcc_s_dw2-1.dll is missing from your computer. Try reinstalling the program to fix this problem.[/quote]
So, I decided to resort to Google. The general consensus was either A, to add MinGW to your PATH variable (which I had already done when I installed it) or B, do a static link using -static-libgcc. Long story short it didn't work, and what I understand is that static linking "pulls" out the already compiled code from the DLL to use in the current compiling proccess, and for that to work I'd need libgcc_s_dw2-1.dll to be in my MinGW bin directory. However, it is not. The closest thing I got is libgcc_s_sjlj-1.dll.
So, what do?
Not use MinGW.
Use -static-libgcc. It works.
If it doesn't your MinGW install is borked.
Is there some way to assign a string value to a variable in Python through an input?
[t]http://i.imgur.com/INviG.png[/t]
This isn't so much something I need help with as much as it is just me being curious: when you have a base class that other classes will inherit from, do you need to define the inherited classes' virtual functions as well as the base class's or is it sufficient to only define the base class's virtual functions?
You can't construct a member of a class that has pure virtual functions?
[QUOTE=Jookia;36580829]Not use MinGW.[/QUOTE]
Not too useful.
[QUOTE=esalaka;36580841]Use -static-libgcc. It works.
If it doesn't your MinGW install is borked.[/QUOTE]
I tried and it didn't so I assumed it was already borked. I downloaded a new installer from the MinGW site itself instead of using the one bundled with C::B and it worked. Thanks.
[editline]1st July 2012[/editline]
okay scratch that it isn't working. When I try to open the compiled file it crashes and the faulty module is libstdc++-6.dll, which was another DLL that was missing before I reinstalled MinGW. Debugging just sits at a console window and doesn't even open a real window. Uh...
[QUOTE=Pnukup;36581027]Is there some way to assign a string value to a variable in Python through an input?
[t]http://i.imgur.com/INviG.png[/t][/QUOTE]
raw_input("prompt")?
Should I use NDK OpenGL for android graphics(for a game)?
On top of that, should I use OpenGL ES or the drawables/canvas options?
Sorry, you need to Log In to post a reply to this thread.